Skip to content

Commit 61e4957

Browse files
committed
Update Schema
1 parent 20bc4ff commit 61e4957

File tree

10 files changed

+713
-104
lines changed

10 files changed

+713
-104
lines changed

generate/extractInfoFromSchema.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import JsonRefParser, {
2-
type JSONSchema,
3-
} from '@apidevtools/json-schema-ref-parser';
1+
import * as JsonRefParser from '@apidevtools/json-schema-ref-parser';
42
import fetch from 'cross-fetch';
53
import { compile as hyperschemaToTypings } from 'hyperschema-to-ts';
64
import simplifySchema from './generateSimplifiedSchema';
@@ -67,21 +65,25 @@ type JSONHyperschemaLink = {
6765
title: string;
6866
href: string;
6967
private?: boolean;
70-
hrefSchema?: JSONSchema;
71-
schema?: JSONSchema;
72-
targetSchema?: JSONSchema;
73-
jobSchema?: JSONSchema;
68+
hrefSchema?: JsonRefParser.JSONSchema;
69+
schema?: JsonRefParser.JSONSchema;
70+
targetSchema?: JsonRefParser.JSONSchema;
71+
jobSchema?: JsonRefParser.JSONSchema;
7472
};
7573

76-
type JSONSchemaWithLinks = JSONSchema & { links: JSONHyperschemaLink[] };
74+
type JSONSchemaWithLinks = JsonRefParser.JSONSchema & {
75+
links: JSONHyperschemaLink[];
76+
};
7777

7878
const relToMethodName: Record<string, string> = {
7979
instances: 'list',
8080
self: 'find',
8181
me: 'findMe',
8282
};
8383

84-
function hasLinks(schema: JSONSchema): schema is JSONSchemaWithLinks {
84+
function hasLinks(
85+
schema: JsonRefParser.JSONSchema,
86+
): schema is JSONSchemaWithLinks {
8587
return 'links' in schema;
8688
}
8789

@@ -261,7 +263,7 @@ function findPropertiesInDataProperty(
261263
function generateResourceInfo(
262264
isCma: boolean,
263265
jsonApiType: string,
264-
schema: JSONSchema,
266+
schema: JsonRefParser.JSONSchema,
265267
): ResourceInfo {
266268
if (!hasLinks(schema)) {
267269
throw new Error('Missing links!');

package-lock.json

Lines changed: 53 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Stefano Verna <[email protected]>",
1818
"license": "MIT",
1919
"devDependencies": {
20-
"@apidevtools/json-schema-ref-parser": "^9.0.9",
20+
"@apidevtools/json-schema-ref-parser": "^11.7.0",
2121
"@biomejs/biome": "1.8.3",
2222
"@total-typescript/ts-reset": "^0.5.1",
2323
"@types/jest": "^29.5.6",

packages/cma-client/resources.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3008,7 +3008,8 @@
30083008
"http_basic_password",
30093009
"enabled",
30103010
"payload_api_version",
3011-
"nested_items_in_payload"
3011+
"nested_items_in_payload",
3012+
"auto_retry"
30123013
],
30133014
"relationships": []
30143015
},
@@ -3051,7 +3052,8 @@
30513052
"http_basic_password",
30523053
"enabled",
30533054
"payload_api_version",
3054-
"nested_items_in_payload"
3055+
"nested_items_in_payload",
3056+
"auto_retry"
30553057
],
30563058
"relationships": []
30573059
},
@@ -3150,6 +3152,31 @@
31503152
"name": "list",
31513153
"rawName": "rawList"
31523154
},
3155+
{
3156+
"returnsCollection": false,
3157+
"docUrl": "https://www.datocms.com/docs/content-management-api/resources/webhook-call/self",
3158+
"rel": "self",
3159+
"urlTemplate": "/webhook_calls/${webhookCallId}",
3160+
"method": "GET",
3161+
"comment": "Retrieve a webhook call",
3162+
"urlPlaceholders": [
3163+
{
3164+
"variableName": "webhookCallId",
3165+
"isEntityId": true,
3166+
"relType": "WebhookCallData"
3167+
}
3168+
],
3169+
"entityIdPlaceholder": {
3170+
"variableName": "webhookCallId",
3171+
"isEntityId": true,
3172+
"relType": "WebhookCallData"
3173+
},
3174+
"optionalRequestBody": false,
3175+
"queryParamsRequired": false,
3176+
"responseType": "WebhookCallSelfTargetSchema",
3177+
"name": "find",
3178+
"rawName": "rawFind"
3179+
},
31533180
{
31543181
"returnsCollection": false,
31553182
"docUrl": "https://www.datocms.com/docs/content-management-api/resources/webhook-call/resend_webhook",

0 commit comments

Comments
 (0)