@skmtc/core 0.16.1 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +10 -0
- package/esm/context/ParseIssue.d.ts +24 -4
- package/esm/context/ParseIssue.d.ts.map +1 -1
- package/esm/context/ParseIssue.js +12 -4
- package/esm/context/parseTypes.d.ts +23 -1
- package/esm/context/parseTypes.d.ts.map +1 -1
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +2 -11
- package/esm/oas/response/toPrimaryResponseCode.d.ts +19 -0
- package/esm/oas/response/toPrimaryResponseCode.d.ts.map +1 -0
- package/esm/oas/response/toPrimaryResponseCode.js +33 -0
- package/esm/oas/webhook/Webhook.d.ts +40 -3
- package/esm/oas/webhook/Webhook.d.ts.map +1 -1
- package/esm/oas/webhook/Webhook.js +52 -3
- package/esm/parse/v3-0/integer/toInteger.js +4 -1
- package/esm/parse/v3-0/number/toNumber.js +4 -1
- package/esm/parse/v3-0/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/parse/v3-0/operation/toOperationsV3.js +5 -1
- package/esm/parse/v3-0/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/parse/v3-0/schema/toSchemasV3.js +27 -1
- package/esm/parse/v3-0/string/toString.d.ts.map +1 -1
- package/esm/parse/v3-0/string/toString.js +4 -11
- package/esm/parse/v3-1/integer/toInteger.js +4 -1
- package/esm/parse/v3-1/number/toNumber.js +4 -1
- package/esm/parse/v3-1/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/parse/v3-1/operation/toOperationsV3.js +5 -1
- package/esm/parse/v3-1/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/parse/v3-1/schema/toSchemasV3.js +26 -7
- package/esm/parse/v3-1/string/toString.d.ts.map +1 -1
- package/esm/parse/v3-1/string/toString.js +4 -11
- package/esm/types/Manifest.d.ts.map +1 -1
- package/esm/types/Manifest.js +14 -0
- package/package.json +1 -1
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +10 -0
- package/script/context/ParseIssue.d.ts +24 -4
- package/script/context/ParseIssue.d.ts.map +1 -1
- package/script/context/ParseIssue.js +12 -4
- package/script/context/parseTypes.d.ts +23 -1
- package/script/context/parseTypes.d.ts.map +1 -1
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +2 -11
- package/script/oas/response/toPrimaryResponseCode.d.ts +19 -0
- package/script/oas/response/toPrimaryResponseCode.d.ts.map +1 -0
- package/script/oas/response/toPrimaryResponseCode.js +37 -0
- package/script/oas/webhook/Webhook.d.ts +40 -3
- package/script/oas/webhook/Webhook.d.ts.map +1 -1
- package/script/oas/webhook/Webhook.js +52 -3
- package/script/parse/v3-0/integer/toInteger.js +4 -1
- package/script/parse/v3-0/number/toNumber.js +4 -1
- package/script/parse/v3-0/operation/toOperationsV3.d.ts.map +1 -1
- package/script/parse/v3-0/operation/toOperationsV3.js +5 -1
- package/script/parse/v3-0/schema/toSchemasV3.d.ts.map +1 -1
- package/script/parse/v3-0/schema/toSchemasV3.js +27 -1
- package/script/parse/v3-0/string/toString.d.ts.map +1 -1
- package/script/parse/v3-0/string/toString.js +3 -10
- package/script/parse/v3-1/integer/toInteger.js +4 -1
- package/script/parse/v3-1/number/toNumber.js +4 -1
- package/script/parse/v3-1/operation/toOperationsV3.d.ts.map +1 -1
- package/script/parse/v3-1/operation/toOperationsV3.js +5 -1
- package/script/parse/v3-1/schema/toSchemasV3.d.ts.map +1 -1
- package/script/parse/v3-1/schema/toSchemasV3.js +26 -7
- package/script/parse/v3-1/string/toString.d.ts.map +1 -1
- package/script/parse/v3-1/string/toString.js +3 -10
- package/script/types/Manifest.d.ts.map +1 -1
- package/script/types/Manifest.js +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts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EACP,UAAU,EACV,MAAM,EACN,UAAU,EACV,IAA4B,EAC7B,EAAE,oBAAoB,GAAG,IAAI;CAY/B"}
|
|
@@ -413,6 +413,16 @@ export class ParseContext {
|
|
|
413
413
|
}, parent);
|
|
414
414
|
break;
|
|
415
415
|
}
|
|
416
|
+
case 'debug': {
|
|
417
|
+
this.logIssueAt({
|
|
418
|
+
protocol,
|
|
419
|
+
level: 'debug',
|
|
420
|
+
type,
|
|
421
|
+
location,
|
|
422
|
+
message: issue.message
|
|
423
|
+
}, parent);
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
416
426
|
default: {
|
|
417
427
|
const _exhaustive = issue;
|
|
418
428
|
throw new Error(`Unhandled parse-issue level: ${JSON.stringify(_exhaustive)}`);
|
|
@@ -3,10 +3,18 @@
|
|
|
3
3
|
* GraphQL parsing. Each variant stands on its own — no shared base —
|
|
4
4
|
* so TypeScript narrows cleanly on `protocol` and `level`.
|
|
5
5
|
*
|
|
6
|
-
* `cause?: unknown` is only present on the error variants. Warnings
|
|
7
|
-
* synthesized by the parser with all the information
|
|
8
|
-
* `message`; errors usually wrap a thrown `Error`, which
|
|
9
|
-
* `cause` for debugging without forcing renderers to know
|
|
6
|
+
* `cause?: unknown` is only present on the error variants. Warnings and
|
|
7
|
+
* `debug` issues are synthesized by the parser with all the information
|
|
8
|
+
* needed for the `message`; errors usually wrap a thrown `Error`, which
|
|
9
|
+
* we keep in `cause` for debugging without forcing renderers to know
|
|
10
|
+
* about it.
|
|
11
|
+
*
|
|
12
|
+
* Three severities: `error` (broken — drives exit status), `warning` (a
|
|
13
|
+
* real deviation that was handled, e.g. a 3.0 schema missing `type`), and
|
|
14
|
+
* `debug` (informational — the parser handled the input gracefully and
|
|
15
|
+
* recorded what it assumed or dropped; spec-legal-but-lossy or
|
|
16
|
+
* dialect-benign cases live here). All three are recorded on the manifest;
|
|
17
|
+
* consumers filter `debug` out of the default view.
|
|
10
18
|
*
|
|
11
19
|
* `location` is the schema-level address of the issue: for OAS it's the
|
|
12
20
|
* stringified stack trail (e.g. `components.schemas.User.properties.email`);
|
|
@@ -63,6 +71,12 @@ export type ParseIssue = {
|
|
|
63
71
|
type: OasIssueType;
|
|
64
72
|
location: string;
|
|
65
73
|
message: string;
|
|
74
|
+
} | {
|
|
75
|
+
protocol: 'oas';
|
|
76
|
+
level: 'debug';
|
|
77
|
+
type: OasIssueType;
|
|
78
|
+
location: string;
|
|
79
|
+
message: string;
|
|
66
80
|
} | {
|
|
67
81
|
protocol: 'gql';
|
|
68
82
|
level: 'error';
|
|
@@ -76,5 +90,11 @@ export type ParseIssue = {
|
|
|
76
90
|
type: GqlIssueType;
|
|
77
91
|
location: string;
|
|
78
92
|
message: string;
|
|
93
|
+
} | {
|
|
94
|
+
protocol: 'gql';
|
|
95
|
+
level: 'debug';
|
|
96
|
+
type: GqlIssueType;
|
|
97
|
+
location: string;
|
|
98
|
+
message: string;
|
|
79
99
|
};
|
|
80
100
|
//# sourceMappingURL=ParseIssue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseIssue.d.ts","sourceRoot":"","sources":["../../src/context/ParseIssue.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ParseIssue.d.ts","sourceRoot":"","sources":["../../src/context/ParseIssue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,YAAY,GACpB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,yBAAyB,GACzB,iBAAiB,GACjB,yBAAyB,GACzB,wBAAwB,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,YAAY,kYAQvB,CAAA;AAKF,MAAM,MAAM,UAAU,GAClB;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
|
@@ -3,10 +3,18 @@
|
|
|
3
3
|
* GraphQL parsing. Each variant stands on its own — no shared base —
|
|
4
4
|
* so TypeScript narrows cleanly on `protocol` and `level`.
|
|
5
5
|
*
|
|
6
|
-
* `cause?: unknown` is only present on the error variants. Warnings
|
|
7
|
-
* synthesized by the parser with all the information
|
|
8
|
-
* `message`; errors usually wrap a thrown `Error`, which
|
|
9
|
-
* `cause` for debugging without forcing renderers to know
|
|
6
|
+
* `cause?: unknown` is only present on the error variants. Warnings and
|
|
7
|
+
* `debug` issues are synthesized by the parser with all the information
|
|
8
|
+
* needed for the `message`; errors usually wrap a thrown `Error`, which
|
|
9
|
+
* we keep in `cause` for debugging without forcing renderers to know
|
|
10
|
+
* about it.
|
|
11
|
+
*
|
|
12
|
+
* Three severities: `error` (broken — drives exit status), `warning` (a
|
|
13
|
+
* real deviation that was handled, e.g. a 3.0 schema missing `type`), and
|
|
14
|
+
* `debug` (informational — the parser handled the input gracefully and
|
|
15
|
+
* recorded what it assumed or dropped; spec-legal-but-lossy or
|
|
16
|
+
* dialect-benign cases live here). All three are recorded on the manifest;
|
|
17
|
+
* consumers filter `debug` out of the default view.
|
|
10
18
|
*
|
|
11
19
|
* `location` is the schema-level address of the issue: for OAS it's the
|
|
12
20
|
* stringified stack trail (e.g. `components.schemas.User.properties.email`);
|
|
@@ -48,7 +48,17 @@ export type ParseWarningInput = {
|
|
|
48
48
|
level: 'warning';
|
|
49
49
|
message: string;
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Informational diagnostic — the parser handled the input gracefully and
|
|
53
|
+
* is recording what it assumed or dropped (a spec-legal-but-lossy or
|
|
54
|
+
* dialect-benign case). Recorded on the manifest but filtered out of the
|
|
55
|
+
* default view; never affects exit status.
|
|
56
|
+
*/
|
|
57
|
+
export type ParseDebugInput = {
|
|
58
|
+
level: 'debug';
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
|
61
|
+
export type ParseIssueInput = ParseErrorInput | ParseWarningInput | ParseDebugInput;
|
|
52
62
|
/**
|
|
53
63
|
* Arguments accepted by `ParseContext.logIssue` (StackTrail-based
|
|
54
64
|
* location, computed via `stackTrail.trace(key, ...)`).
|
|
@@ -149,6 +159,12 @@ export type LogIssueAtArgs = {
|
|
|
149
159
|
type: OasIssueType;
|
|
150
160
|
location: string;
|
|
151
161
|
message: string;
|
|
162
|
+
} | {
|
|
163
|
+
protocol: 'oas';
|
|
164
|
+
level: 'debug';
|
|
165
|
+
type: OasIssueType;
|
|
166
|
+
location: string;
|
|
167
|
+
message: string;
|
|
152
168
|
} | {
|
|
153
169
|
protocol: 'gql';
|
|
154
170
|
level: 'error';
|
|
@@ -162,6 +178,12 @@ export type LogIssueAtArgs = {
|
|
|
162
178
|
type: GqlIssueType;
|
|
163
179
|
location: string;
|
|
164
180
|
message: string;
|
|
181
|
+
} | {
|
|
182
|
+
protocol: 'gql';
|
|
183
|
+
level: 'debug';
|
|
184
|
+
type: GqlIssueType;
|
|
185
|
+
location: string;
|
|
186
|
+
message: string;
|
|
165
187
|
};
|
|
166
188
|
/**
|
|
167
189
|
* Options accepted by the GQL parse phase. Passed through the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseTypes.d.ts","sourceRoot":"","sources":["../../src/context/parseTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAA;AAE3C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,SAAS,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,eAAe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,CAAC,EAAE,OAAO,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,SAAS,CAAA;IAChB,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,GACD;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAEL;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/Operation.ts"],"names":[],"mappings":"AAAA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AAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,YAAY,EAAE;IAQzD;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS;IAY9D;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe;IAiBrE;;;;OAIG;IACH,MAAM,IAAI,MAAM;CAcjB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
2
|
import { OasObject } from '../object/Object.js';
|
|
3
|
+
import { toPrimaryResponseCode } from '../response/toPrimaryResponseCode.js';
|
|
3
4
|
import { OasBase } from '../../types/OasBase.js';
|
|
4
5
|
export class OasOperation extends OasBase {
|
|
5
6
|
/**
|
|
@@ -156,17 +157,7 @@ export class OasOperation extends OasBase {
|
|
|
156
157
|
* @returns Success status code as string or undefined if none found
|
|
157
158
|
*/
|
|
158
159
|
toSuccessResponseCode() {
|
|
159
|
-
|
|
160
|
-
.map(httpCode => parseInt(httpCode))
|
|
161
|
-
.sort((a, b) => a - b)
|
|
162
|
-
.find(httpCode => httpCode >= 200 && httpCode < 300);
|
|
163
|
-
if (successCode) {
|
|
164
|
-
return successCode.toString();
|
|
165
|
-
}
|
|
166
|
-
if (this.responses.default) {
|
|
167
|
-
return 'default';
|
|
168
|
-
}
|
|
169
|
-
return undefined;
|
|
160
|
+
return toPrimaryResponseCode(this.responses);
|
|
170
161
|
}
|
|
171
162
|
/**
|
|
172
163
|
* Maps the request body schema to a custom value using the provided mapping function.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { OasResponse } from './Response.js';
|
|
2
|
+
import type { OasRef } from '../ref/Ref.js';
|
|
3
|
+
/**
|
|
4
|
+
* The status code of the primary success/ack response in a `responses` map.
|
|
5
|
+
*
|
|
6
|
+
* OpenAPI response keys may be a specific code (`200`), a range (`2XX`, `4XX`,
|
|
7
|
+
* …), or `default`. The primary 2xx is resolved in that order of specificity:
|
|
8
|
+
* 1. the lowest specific `2xx` numeric code,
|
|
9
|
+
* 2. otherwise a `2XX` range key (case-insensitive),
|
|
10
|
+
* 3. otherwise `default`,
|
|
11
|
+
* 4. otherwise `undefined`.
|
|
12
|
+
*
|
|
13
|
+
* `parseInt('2XX')` is `2` (< 200), so the numeric scan never mis-claims a
|
|
14
|
+
* range key — the range step handles it explicitly. Shared by
|
|
15
|
+
* `OasOperation.toSuccessResponseCode` and `OasWebhook.toAckResponseCode` so
|
|
16
|
+
* the two cannot drift.
|
|
17
|
+
*/
|
|
18
|
+
export declare const toPrimaryResponseCode: (responses: Record<string, OasResponse | OasRef<"response">>) => string | undefined;
|
|
19
|
+
//# sourceMappingURL=toPrimaryResponseCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toPrimaryResponseCode.d.ts","sourceRoot":"","sources":["../../../src/oas/response/toPrimaryResponseCode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,KAC1D,MAAM,GAAG,SAqBX,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The status code of the primary success/ack response in a `responses` map.
|
|
3
|
+
*
|
|
4
|
+
* OpenAPI response keys may be a specific code (`200`), a range (`2XX`, `4XX`,
|
|
5
|
+
* …), or `default`. The primary 2xx is resolved in that order of specificity:
|
|
6
|
+
* 1. the lowest specific `2xx` numeric code,
|
|
7
|
+
* 2. otherwise a `2XX` range key (case-insensitive),
|
|
8
|
+
* 3. otherwise `default`,
|
|
9
|
+
* 4. otherwise `undefined`.
|
|
10
|
+
*
|
|
11
|
+
* `parseInt('2XX')` is `2` (< 200), so the numeric scan never mis-claims a
|
|
12
|
+
* range key — the range step handles it explicitly. Shared by
|
|
13
|
+
* `OasOperation.toSuccessResponseCode` and `OasWebhook.toAckResponseCode` so
|
|
14
|
+
* the two cannot drift.
|
|
15
|
+
*/
|
|
16
|
+
export const toPrimaryResponseCode = (responses) => {
|
|
17
|
+
const keys = Object.keys(responses);
|
|
18
|
+
const [lowest2xx] = keys
|
|
19
|
+
.map(code => parseInt(code))
|
|
20
|
+
.filter(code => code >= 200 && code < 300)
|
|
21
|
+
.sort((a, b) => a - b);
|
|
22
|
+
if (lowest2xx !== undefined) {
|
|
23
|
+
return lowest2xx.toString();
|
|
24
|
+
}
|
|
25
|
+
const range2xx = keys.find(code => /^2XX$/i.test(code));
|
|
26
|
+
if (range2xx !== undefined) {
|
|
27
|
+
return range2xx;
|
|
28
|
+
}
|
|
29
|
+
if (responses.default) {
|
|
30
|
+
return 'default';
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
};
|
|
@@ -2,6 +2,8 @@ import "../../_dnt.polyfills.js";
|
|
|
2
2
|
import type { Method } from '../../types/Method.js';
|
|
3
3
|
import type { OasPathItem } from '../pathItem/PathItem.js';
|
|
4
4
|
import type { OasParameter } from '../parameter/Parameter.js';
|
|
5
|
+
import type { OasParameterLocation } from '../parameter/parameter-types.js';
|
|
6
|
+
import type { OasSchema } from '../schema/Schema.js';
|
|
5
7
|
import type { OasRequestBody } from '../requestBody/RequestBody.js';
|
|
6
8
|
import type { OasResponse } from '../response/Response.js';
|
|
7
9
|
import type { OasRef } from '../ref/Ref.js';
|
|
@@ -63,9 +65,12 @@ export type WebhookFields = {
|
|
|
63
65
|
* receive one: webhook code generation is a *receiver/handler* concern,
|
|
64
66
|
* not a client-call concern.
|
|
65
67
|
*
|
|
66
|
-
*
|
|
67
|
-
* (
|
|
68
|
-
*
|
|
68
|
+
* Carries webhook-semantic accessors named for the RECEIVER —
|
|
69
|
+
* `toPayload`/`toPayloadSchema` (the received payload), `toParams` (inbound
|
|
70
|
+
* params), `toAckResponse`/`toAckResponseCode` (the ack the handler returns).
|
|
71
|
+
* These deliberately avoid the client-framed {@link OasOperation} names
|
|
72
|
+
* (`toRequestBody`, `toSuccessResponse`) so the inversion stays explicit in
|
|
73
|
+
* generator code. (Signature-verification helpers still accrue on demand.)
|
|
69
74
|
*/
|
|
70
75
|
export declare class OasWebhook extends OasBase {
|
|
71
76
|
/** Type identifier for OAS webhook objects */
|
|
@@ -101,6 +106,38 @@ export declare class OasWebhook extends OasBase {
|
|
|
101
106
|
/** Servers for this webhook */
|
|
102
107
|
servers: OasServer[] | undefined;
|
|
103
108
|
constructor(fields: WebhookFields, context?: ParseContextType);
|
|
109
|
+
/**
|
|
110
|
+
* The received-payload body — the request body the API delivers TO the
|
|
111
|
+
* consumer's handler. Webhook semantics are inverted: this is what the
|
|
112
|
+
* handler RECEIVES, not what a client sends. A `$ref` body is resolved.
|
|
113
|
+
*/
|
|
114
|
+
toPayload(): OasRequestBody | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* The schema of the received payload for `mediaType` (default
|
|
117
|
+
* `application/json`) — the inbound body shape a handler generator emits a
|
|
118
|
+
* type for. `undefined` when there is no body or no schema for that media
|
|
119
|
+
* type.
|
|
120
|
+
*/
|
|
121
|
+
toPayloadSchema(mediaType?: string): OasSchema | OasRef<'schema'> | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Resolve the inbound parameters (e.g. the signature/headers a handler
|
|
124
|
+
* receives), optionally filtered by location. Mirrors
|
|
125
|
+
* {@link OasOperation.toParams}; the parameters carry the same shape, only
|
|
126
|
+
* their direction is inbound.
|
|
127
|
+
*/
|
|
128
|
+
toParams(filter?: OasParameterLocation[]): OasParameter[];
|
|
129
|
+
/**
|
|
130
|
+
* The status code of the primary acknowledgement response — the lowest 2xx
|
|
131
|
+
* the handler returns to ack the delivery, falling back to `default`. Named
|
|
132
|
+
* for the receiver: a webhook's `responses` are what the handler RETURNS,
|
|
133
|
+
* not what a client receives (cf. {@link OasOperation.toSuccessResponseCode}).
|
|
134
|
+
*/
|
|
135
|
+
toAckResponseCode(): string | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* The primary acknowledgement response definition (the body/headers the
|
|
138
|
+
* handler returns), or `undefined` when none is declared.
|
|
139
|
+
*/
|
|
140
|
+
toAckResponse(): OasResponse | OasRef<'response'> | undefined;
|
|
104
141
|
/**
|
|
105
142
|
* Serializes the webhook to a plain JavaScript object.
|
|
106
143
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Webhook.d.ts","sourceRoot":"","sources":["../../../src/oas/webhook/Webhook.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"Webhook.d.ts","sourceRoot":"","sources":["../../../src/oas/webhook/Webhook.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OA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AAY,EAAE,eAAe,GAAG,SAAS,CAAA;IACzC,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD,+BAA+B;IAC/B,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,CAAA;gBAEpB,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAmB7D;;;;OAIG;IACH,SAAS,IAAI,cAAc,GAAG,SAAS;IAIvC;;;;;OAKG;IACH,eAAe,CAAC,SAAS,SAAqB,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IAIzF;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,YAAY,EAAE;IAQzD;;;;;OAKG;IACH,iBAAiB,IAAI,MAAM,GAAG,SAAS;IAIvC;;;OAGG;IACH,aAAa,IAAI,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,SAAS;IAM7D;;OAEG;IACH,MAAM,IAAI,MAAM;CAgBjB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
|
+
import { toPrimaryResponseCode } from '../response/toPrimaryResponseCode.js';
|
|
2
3
|
import { OasBase } from '../../types/OasBase.js';
|
|
3
4
|
/**
|
|
4
5
|
* Represents an OpenAPI 3.1 webhook — a third OAS subject, peer to
|
|
@@ -9,9 +10,12 @@ import { OasBase } from '../../types/OasBase.js';
|
|
|
9
10
|
* receive one: webhook code generation is a *receiver/handler* concern,
|
|
10
11
|
* not a client-call concern.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
* (
|
|
14
|
-
*
|
|
13
|
+
* Carries webhook-semantic accessors named for the RECEIVER —
|
|
14
|
+
* `toPayload`/`toPayloadSchema` (the received payload), `toParams` (inbound
|
|
15
|
+
* params), `toAckResponse`/`toAckResponseCode` (the ack the handler returns).
|
|
16
|
+
* These deliberately avoid the client-framed {@link OasOperation} names
|
|
17
|
+
* (`toRequestBody`, `toSuccessResponse`) so the inversion stays explicit in
|
|
18
|
+
* generator code. (Signature-verification helpers still accrue on demand.)
|
|
15
19
|
*/
|
|
16
20
|
export class OasWebhook extends OasBase {
|
|
17
21
|
constructor(fields, context) {
|
|
@@ -144,6 +148,51 @@ export class OasWebhook extends OasBase {
|
|
|
144
148
|
this.extensionFields = fields.extensionFields;
|
|
145
149
|
this.servers = fields.servers;
|
|
146
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* The received-payload body — the request body the API delivers TO the
|
|
153
|
+
* consumer's handler. Webhook semantics are inverted: this is what the
|
|
154
|
+
* handler RECEIVES, not what a client sends. A `$ref` body is resolved.
|
|
155
|
+
*/
|
|
156
|
+
toPayload() {
|
|
157
|
+
return this.requestBody?.resolve();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The schema of the received payload for `mediaType` (default
|
|
161
|
+
* `application/json`) — the inbound body shape a handler generator emits a
|
|
162
|
+
* type for. `undefined` when there is no body or no schema for that media
|
|
163
|
+
* type.
|
|
164
|
+
*/
|
|
165
|
+
toPayloadSchema(mediaType = 'application/json') {
|
|
166
|
+
return this.toPayload()?.content[mediaType]?.schema;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Resolve the inbound parameters (e.g. the signature/headers a handler
|
|
170
|
+
* receives), optionally filtered by location. Mirrors
|
|
171
|
+
* {@link OasOperation.toParams}; the parameters carry the same shape, only
|
|
172
|
+
* their direction is inbound.
|
|
173
|
+
*/
|
|
174
|
+
toParams(filter) {
|
|
175
|
+
return (this.parameters
|
|
176
|
+
?.map(param => param.resolve())
|
|
177
|
+
.filter(param => (filter?.length ? filter.includes(param.location) : true)) ?? []);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The status code of the primary acknowledgement response — the lowest 2xx
|
|
181
|
+
* the handler returns to ack the delivery, falling back to `default`. Named
|
|
182
|
+
* for the receiver: a webhook's `responses` are what the handler RETURNS,
|
|
183
|
+
* not what a client receives (cf. {@link OasOperation.toSuccessResponseCode}).
|
|
184
|
+
*/
|
|
185
|
+
toAckResponseCode() {
|
|
186
|
+
return toPrimaryResponseCode(this.responses);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The primary acknowledgement response definition (the body/headers the
|
|
190
|
+
* handler returns), or `undefined` when none is declared.
|
|
191
|
+
*/
|
|
192
|
+
toAckResponse() {
|
|
193
|
+
const ackCode = this.toAckResponseCode();
|
|
194
|
+
return ackCode ? this.responses[ackCode] : undefined;
|
|
195
|
+
}
|
|
147
196
|
/**
|
|
148
197
|
* Serializes the webhook to a plain JavaScript object.
|
|
149
198
|
*/
|
|
@@ -95,9 +95,12 @@ const parseIntegerFormat = ({ format, context, parent, stackTrail }) => {
|
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
|
97
97
|
if (!v.is(integerFormat, format)) {
|
|
98
|
+
// `format` is an open vocabulary; a value the IR's integerFormat can't
|
|
99
|
+
// hold is dropped. Recorded at `debug` — the dropped hint is
|
|
100
|
+
// informational, not a correctness issue.
|
|
98
101
|
context.logIssue({
|
|
99
102
|
key: 'format',
|
|
100
|
-
level: '
|
|
103
|
+
level: 'debug',
|
|
101
104
|
message: `Invalid format: ${format}`,
|
|
102
105
|
parent,
|
|
103
106
|
stackTrail,
|
|
@@ -95,9 +95,12 @@ const parseNumberFormat = ({ format, context, parent, stackTrail }) => {
|
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
|
97
97
|
if (!v.is(numberFormat, format)) {
|
|
98
|
+
// `format` is an open vocabulary; a value the IR's numberFormat can't
|
|
99
|
+
// hold (e.g. `decimal`) is dropped. Recorded at `debug` — the dropped
|
|
100
|
+
// hint is informational, not a correctness issue.
|
|
98
101
|
context.logIssue({
|
|
99
102
|
key: 'format',
|
|
100
|
-
level: '
|
|
103
|
+
level: 'debug',
|
|
101
104
|
message: `Invalid format: ${format}`,
|
|
102
105
|
parent,
|
|
103
106
|
stackTrail,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../../src/parse/v3-0/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAItE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAOpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAOD,eAAO,MAAM,aAAa,GAAI,mDAK3B,iBAAiB,KAAG,
|
|
1
|
+
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../../src/parse/v3-0/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAItE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAOpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAOD,eAAO,MAAM,aAAa,GAAI,mDAK3B,iBAAiB,KAAG,YAuEtB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,SAAS,CAAC,WAAW,CAAA;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,gCAI5B,kBAAkB,KAAG,YAAY,EA6EnC,CAAA"}
|
|
@@ -11,7 +11,11 @@ import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
|
|
|
11
11
|
import { toOptionalServersV3 } from '../server/toServerV3.js';
|
|
12
12
|
export const toOperationV3 = ({ operation, operationInfo, stackTrail, context }) => {
|
|
13
13
|
const { method, path, pathItem } = operationInfo;
|
|
14
|
-
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers,
|
|
14
|
+
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers,
|
|
15
|
+
// Callbacks are a deliberate non-goal (no out-of-band callback codegen).
|
|
16
|
+
// Pull it out so it is dropped silently instead of warned as an
|
|
17
|
+
// unexpected property on every operation that declares one.
|
|
18
|
+
callbacks: _callbacks, ...skipped } = operation;
|
|
15
19
|
const extensionFields = toSpecificationExtensionsV3({
|
|
16
20
|
skipped,
|
|
17
21
|
parent: operation,
|
|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M,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAA;IAC1D,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AA0CD,eAAO,MAAM,UAAU,GAAI,iCAIxB,cAAc,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAoP9C,CAAA;AA+CD,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAA;IACtE,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,iCAIhC,sBAAsB,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAM1D,CAAA"}
|
|
@@ -75,6 +75,27 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
|
|
|
75
75
|
}
|
|
76
76
|
if ('allOf' in schema && Array.isArray(schema.allOf)) {
|
|
77
77
|
return stackTrail.trace('allOf', st => {
|
|
78
|
+
// A single-member allOf collapses to its sole member — the value must
|
|
79
|
+
// satisfy exactly that one schema. When the member is a `$ref`, keep it
|
|
80
|
+
// LAZY (as an OasRef) rather than resolving + merging its target: a
|
|
81
|
+
// `{ allOf: [{$ref: self}], nullable: true }` (a nullable reference
|
|
82
|
+
// written as a one-member allOf — common in real specs) is
|
|
83
|
+
// self-referential, and eagerly resolving it would not terminate. The
|
|
84
|
+
// ref resolves at use time like every other ref. This mirrors the
|
|
85
|
+
// single-member oneOf/anyOf handling below.
|
|
86
|
+
const { allOf, ...value } = schema;
|
|
87
|
+
const members = allOf ?? [];
|
|
88
|
+
if (members.length === 1) {
|
|
89
|
+
const [member] = members;
|
|
90
|
+
if (isRef(member) && value.nullable) {
|
|
91
|
+
return toRefV31({ ref: member, refType: 'schema', nullable: true, stackTrail: st, context });
|
|
92
|
+
}
|
|
93
|
+
return toSchemaV3({
|
|
94
|
+
schema: collapseSingleMember(value, member),
|
|
95
|
+
stackTrail: st,
|
|
96
|
+
context
|
|
97
|
+
});
|
|
98
|
+
}
|
|
78
99
|
const merged = mergeIntersection({
|
|
79
100
|
schema,
|
|
80
101
|
getRef: toGetRef(context.documentObject)
|
|
@@ -185,8 +206,13 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
|
|
|
185
206
|
}
|
|
186
207
|
// Otherwise cases
|
|
187
208
|
if (possibleObject(schema)) {
|
|
209
|
+
// 3.0 requires `type`, so its absence is a real (if benign) deviation —
|
|
210
|
+
// recorded at `debug` rather than `warning`: `properties` makes the
|
|
211
|
+
// intent unambiguous and inferring `object` is reliable, so it is noise
|
|
212
|
+
// in the default view but worth keeping in the record. (The v3-1 parser
|
|
213
|
+
// is silent here — type-less is valid in 3.1.)
|
|
188
214
|
context.logIssueNoKey({
|
|
189
|
-
level: '
|
|
215
|
+
level: 'debug',
|
|
190
216
|
message: 'Object has "properties" property, but is missing type="object" property',
|
|
191
217
|
parent: schema,
|
|
192
218
|
stackTrail,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../../src/parse/v3-0/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAQzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,wEAAwE;IACxE,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,kCAAkC;IAClC,UAAU,EAAE,UAAU,CAAA;IACtB,iEAAiE;IACjE,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;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@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OasString } from '../../../oas/string/String.js';
|
|
2
2
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
-
import { oasStringData
|
|
3
|
+
import { oasStringData } from '../../../oas/string/string-types.js';
|
|
4
4
|
import * as v from 'valibot';
|
|
5
5
|
import { parseNullable } from '../_helpers/parseNullable.js';
|
|
6
6
|
import { parseEnum } from '../_helpers/parseEnum.js';
|
|
@@ -186,16 +186,9 @@ export const toParsedString = ({ context, nullable, example, enums, defaultValue
|
|
|
186
186
|
stackTrail,
|
|
187
187
|
parentType: 'schema:string'
|
|
188
188
|
});
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
level: 'warning',
|
|
193
|
-
message: `Unexpected format: ${format}`,
|
|
194
|
-
parent: value,
|
|
195
|
-
stackTrail,
|
|
196
|
-
type: 'UNEXPECTED_FORMAT'
|
|
197
|
-
});
|
|
198
|
-
}
|
|
189
|
+
// `format` is an open vocabulary — custom string formats (e.g. `decimal`,
|
|
190
|
+
// `utc_datetime`) are spec-legal. The value is preserved on the OasString
|
|
191
|
+
// below, so an unrecognised format is passed through, not warned.
|
|
199
192
|
return context.withStackTrail(stackTrail, () => new OasString({
|
|
200
193
|
title,
|
|
201
194
|
description,
|
|
@@ -95,9 +95,12 @@ const parseIntegerFormat = ({ format, context, parent, stackTrail }) => {
|
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
|
97
97
|
if (!v.is(integerFormat, format)) {
|
|
98
|
+
// `format` is an open vocabulary; a value the IR's integerFormat can't
|
|
99
|
+
// hold is dropped. Recorded at `debug` — the dropped hint is
|
|
100
|
+
// informational, not a correctness issue.
|
|
98
101
|
context.logIssue({
|
|
99
102
|
key: 'format',
|
|
100
|
-
level: '
|
|
103
|
+
level: 'debug',
|
|
101
104
|
message: `Invalid format: ${format}`,
|
|
102
105
|
parent,
|
|
103
106
|
stackTrail,
|
|
@@ -95,9 +95,12 @@ const parseNumberFormat = ({ format, context, parent, stackTrail }) => {
|
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
|
97
97
|
if (!v.is(numberFormat, format)) {
|
|
98
|
+
// `format` is an open vocabulary; a value the IR's numberFormat can't
|
|
99
|
+
// hold (e.g. `decimal`) is dropped. Recorded at `debug` — the dropped
|
|
100
|
+
// hint is informational, not a correctness issue.
|
|
98
101
|
context.logIssue({
|
|
99
102
|
key: 'format',
|
|
100
|
-
level: '
|
|
103
|
+
level: 'debug',
|
|
101
104
|
message: `Invalid format: ${format}`,
|
|
102
105
|
parent,
|
|
103
106
|
stackTrail,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../../src/parse/v3-1/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAItE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAOpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAOD,eAAO,MAAM,aAAa,GAAI,mDAK3B,iBAAiB,KAAG,
|
|
1
|
+
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../../src/parse/v3-1/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAItE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAOpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAOD,eAAO,MAAM,aAAa,GAAI,mDAK3B,iBAAiB,KAAG,YAuEtB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAG/B,KAAK,EAAE,SAAS,CAAC,WAAW,GAAG,SAAS,CAAA;IACxC,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,gCAI5B,kBAAkB,KAAG,YAAY,EAiFnC,CAAA"}
|
|
@@ -11,7 +11,11 @@ import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
|
|
|
11
11
|
import { toOptionalServersV3 } from '../server/toServerV3.js';
|
|
12
12
|
export const toOperationV3 = ({ operation, operationInfo, stackTrail, context }) => {
|
|
13
13
|
const { method, path, pathItem } = operationInfo;
|
|
14
|
-
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers,
|
|
14
|
+
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers,
|
|
15
|
+
// Callbacks are a deliberate non-goal (no out-of-band callback codegen).
|
|
16
|
+
// Pull it out so it is dropped silently instead of warned as an
|
|
17
|
+
// unexpected property on every operation that declares one.
|
|
18
|
+
callbacks: _callbacks, ...skipped } = operation;
|
|
15
19
|
const extensionFields = toSpecificationExtensionsV3({
|
|
16
20
|
skipped,
|
|
17
21
|
parent: operation,
|