@skmtc/core 0.0.939 → 0.0.941
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/CoreContext.d.ts +6 -32
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +15 -60
- package/esm/context/GenerateContext.d.ts +4 -15
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +16 -35
- package/esm/context/ParseContext.d.ts +5 -9
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +11 -18
- package/esm/context/RenderContext.d.ts +6 -209
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +8 -215
- package/esm/context/ResultsHandler.d.ts +0 -67
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/context/ResultsHandler.js +2 -68
- package/esm/context/StackTrail.d.ts +2 -0
- package/esm/context/StackTrail.d.ts.map +1 -1
- package/esm/context/StackTrail.js +26 -0
- package/esm/context/generateTypes.d.ts +2 -2
- package/esm/context/generateTypes.d.ts.map +1 -1
- package/esm/context/parseTypes.d.ts +7 -2
- package/esm/context/parseTypes.d.ts.map +1 -1
- package/esm/oas/_helpers/parseEnum.d.ts +3 -1
- package/esm/oas/_helpers/parseEnum.d.ts.map +1 -1
- package/esm/oas/_helpers/parseEnum.js +2 -1
- package/esm/oas/_helpers/parseNullable.d.ts +4 -1
- package/esm/oas/_helpers/parseNullable.d.ts.map +1 -1
- package/esm/oas/_helpers/parseNullable.js +2 -1
- package/esm/oas/array/toArray.d.ts +5 -2
- package/esm/oas/array/toArray.d.ts.map +1 -1
- package/esm/oas/array/toArray.js +16 -9
- package/esm/oas/boolean/toBoolean.d.ts +5 -2
- package/esm/oas/boolean/toBoolean.d.ts.map +1 -1
- package/esm/oas/boolean/toBoolean.js +16 -8
- package/esm/oas/components/toComponentsV3.d.ts +3 -1
- package/esm/oas/components/toComponentsV3.d.ts.map +1 -1
- package/esm/oas/components/toComponentsV3.js +9 -8
- package/esm/oas/contact/toContactV3.d.ts +2 -1
- package/esm/oas/contact/toContactV3.d.ts.map +1 -1
- package/esm/oas/contact/toContactV3.js +2 -1
- package/esm/oas/discriminator/toDiscriminatorV3.d.ts +3 -1
- package/esm/oas/discriminator/toDiscriminatorV3.d.ts.map +1 -1
- package/esm/oas/discriminator/toDiscriminatorV3.js +7 -2
- package/esm/oas/document/toDocumentFieldsV3.d.ts +3 -1
- package/esm/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/esm/oas/document/toDocumentFieldsV3.js +10 -9
- package/esm/oas/example/toExamplesV3.d.ts +10 -2
- package/esm/oas/example/toExamplesV3.d.ts.map +1 -1
- package/esm/oas/example/toExamplesV3.js +8 -7
- package/esm/oas/externalDocs/toExternalDocs.d.ts +3 -1
- package/esm/oas/externalDocs/toExternalDocs.d.ts.map +1 -1
- package/esm/oas/externalDocs/toExternalDocs.js +1 -1
- package/esm/oas/header/toHeadersV3.d.ts +3 -1
- package/esm/oas/header/toHeadersV3.d.ts.map +1 -1
- package/esm/oas/header/toHeadersV3.js +8 -7
- package/esm/oas/info/toInfoV3.d.ts +3 -1
- package/esm/oas/info/toInfoV3.d.ts.map +1 -1
- package/esm/oas/info/toInfoV3.js +4 -3
- package/esm/oas/integer/toInteger.d.ts +5 -2
- package/esm/oas/integer/toInteger.d.ts.map +1 -1
- package/esm/oas/integer/toInteger.js +17 -9
- package/esm/oas/license/toLicenseV3.d.ts +2 -1
- package/esm/oas/license/toLicenseV3.d.ts.map +1 -1
- package/esm/oas/license/toLicenseV3.js +2 -1
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts +10 -3
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/esm/oas/mediaType/toMediaTypeItemV3.js +9 -8
- package/esm/oas/number/toNumber.d.ts +3 -1
- package/esm/oas/number/toNumber.d.ts.map +1 -1
- package/esm/oas/number/toNumber.js +15 -7
- package/esm/oas/object/toAdditionalPropertiesV3.d.ts +3 -1
- package/esm/oas/object/toAdditionalPropertiesV3.d.ts.map +1 -1
- package/esm/oas/object/toAdditionalPropertiesV3.js +2 -2
- package/esm/oas/object/toObject.d.ts +3 -1
- package/esm/oas/object/toObject.d.ts.map +1 -1
- package/esm/oas/object/toObject.js +15 -9
- package/esm/oas/operation/toOperationsV3.d.ts +5 -2
- package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/oas/operation/toOperationsV3.js +14 -12
- package/esm/oas/parameter/toParameterV3.d.ts +7 -3
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +18 -16
- package/esm/oas/pathItem/toPathItemV3.d.ts +3 -1
- package/esm/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/esm/oas/pathItem/toPathItemV3.js +3 -3
- package/esm/oas/ref/toRefV31.d.ts +3 -1
- package/esm/oas/ref/toRefV31.d.ts.map +1 -1
- package/esm/oas/ref/toRefV31.js +3 -3
- package/esm/oas/requestBody/toRequestBodiesV3.d.ts +5 -2
- package/esm/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/esm/oas/requestBody/toRequestBodiesV3.js +7 -7
- package/esm/oas/response/toResponseV3.d.ts +7 -3
- package/esm/oas/response/toResponseV3.d.ts.map +1 -1
- package/esm/oas/response/toResponseV3.js +10 -9
- package/esm/oas/schema/toSchemasV3.d.ts +9 -4
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +33 -25
- package/esm/oas/securityRequirement/toSecurityRequirement.d.ts +3 -1
- package/esm/oas/securityRequirement/toSecurityRequirement.d.ts.map +1 -1
- package/esm/oas/securityRequirement/toSecurityRequirement.js +1 -1
- package/esm/oas/securitySchemes/toSecuritySchemes.d.ts +3 -1
- package/esm/oas/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/esm/oas/securitySchemes/toSecuritySchemes.js +23 -8
- package/esm/oas/server/toServerV3.d.ts +7 -3
- package/esm/oas/server/toServerV3.d.ts.map +1 -1
- package/esm/oas/server/toServerV3.js +7 -7
- package/esm/oas/serverVariable/toServerVariableV3.d.ts +7 -3
- package/esm/oas/serverVariable/toServerVariableV3.d.ts.map +1 -1
- package/esm/oas/serverVariable/toServerVariableV3.js +6 -5
- package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts +3 -1
- package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts.map +1 -1
- package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.js +2 -2
- package/esm/oas/string/toString.d.ts +6 -2
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +18 -9
- package/esm/oas/tag/toTagsV3.d.ts +5 -2
- package/esm/oas/tag/toTagsV3.d.ts.map +1 -1
- package/esm/oas/tag/toTagsV3.js +4 -3
- package/esm/oas/union/toUnion.d.ts +3 -1
- package/esm/oas/union/toUnion.d.ts.map +1 -1
- package/esm/oas/union/toUnion.js +4 -4
- package/esm/oas/unknown/toUnknown.d.ts +3 -1
- package/esm/oas/unknown/toUnknown.d.ts.map +1 -1
- package/esm/oas/unknown/toUnknown.js +2 -1
- package/esm/run/toArtifacts.d.ts +4 -1
- package/esm/run/toArtifacts.d.ts.map +1 -1
- package/esm/run/toArtifacts.js +2 -1
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +6 -32
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +15 -60
- package/script/context/GenerateContext.d.ts +4 -15
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +16 -35
- package/script/context/ParseContext.d.ts +5 -9
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +11 -18
- package/script/context/RenderContext.d.ts +6 -209
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +8 -215
- package/script/context/ResultsHandler.d.ts +0 -67
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/context/ResultsHandler.js +2 -68
- package/script/context/StackTrail.d.ts +2 -0
- package/script/context/StackTrail.d.ts.map +1 -1
- package/script/context/StackTrail.js +26 -0
- package/script/context/generateTypes.d.ts +2 -2
- package/script/context/generateTypes.d.ts.map +1 -1
- package/script/context/parseTypes.d.ts +7 -2
- package/script/context/parseTypes.d.ts.map +1 -1
- package/script/oas/_helpers/parseEnum.d.ts +3 -1
- package/script/oas/_helpers/parseEnum.d.ts.map +1 -1
- package/script/oas/_helpers/parseEnum.js +2 -1
- package/script/oas/_helpers/parseNullable.d.ts +4 -1
- package/script/oas/_helpers/parseNullable.d.ts.map +1 -1
- package/script/oas/_helpers/parseNullable.js +2 -1
- package/script/oas/array/toArray.d.ts +5 -2
- package/script/oas/array/toArray.d.ts.map +1 -1
- package/script/oas/array/toArray.js +16 -9
- package/script/oas/boolean/toBoolean.d.ts +5 -2
- package/script/oas/boolean/toBoolean.d.ts.map +1 -1
- package/script/oas/boolean/toBoolean.js +16 -8
- package/script/oas/components/toComponentsV3.d.ts +3 -1
- package/script/oas/components/toComponentsV3.d.ts.map +1 -1
- package/script/oas/components/toComponentsV3.js +9 -8
- package/script/oas/contact/toContactV3.d.ts +2 -1
- package/script/oas/contact/toContactV3.d.ts.map +1 -1
- package/script/oas/contact/toContactV3.js +2 -1
- package/script/oas/discriminator/toDiscriminatorV3.d.ts +3 -1
- package/script/oas/discriminator/toDiscriminatorV3.d.ts.map +1 -1
- package/script/oas/discriminator/toDiscriminatorV3.js +7 -2
- package/script/oas/document/toDocumentFieldsV3.d.ts +3 -1
- package/script/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/script/oas/document/toDocumentFieldsV3.js +10 -9
- package/script/oas/example/toExamplesV3.d.ts +10 -2
- package/script/oas/example/toExamplesV3.d.ts.map +1 -1
- package/script/oas/example/toExamplesV3.js +8 -7
- package/script/oas/externalDocs/toExternalDocs.d.ts +3 -1
- package/script/oas/externalDocs/toExternalDocs.d.ts.map +1 -1
- package/script/oas/externalDocs/toExternalDocs.js +1 -1
- package/script/oas/header/toHeadersV3.d.ts +3 -1
- package/script/oas/header/toHeadersV3.d.ts.map +1 -1
- package/script/oas/header/toHeadersV3.js +8 -7
- package/script/oas/info/toInfoV3.d.ts +3 -1
- package/script/oas/info/toInfoV3.d.ts.map +1 -1
- package/script/oas/info/toInfoV3.js +4 -3
- package/script/oas/integer/toInteger.d.ts +5 -2
- package/script/oas/integer/toInteger.d.ts.map +1 -1
- package/script/oas/integer/toInteger.js +17 -9
- package/script/oas/license/toLicenseV3.d.ts +2 -1
- package/script/oas/license/toLicenseV3.d.ts.map +1 -1
- package/script/oas/license/toLicenseV3.js +2 -1
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts +10 -3
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/script/oas/mediaType/toMediaTypeItemV3.js +9 -8
- package/script/oas/number/toNumber.d.ts +3 -1
- package/script/oas/number/toNumber.d.ts.map +1 -1
- package/script/oas/number/toNumber.js +15 -7
- package/script/oas/object/toAdditionalPropertiesV3.d.ts +3 -1
- package/script/oas/object/toAdditionalPropertiesV3.d.ts.map +1 -1
- package/script/oas/object/toAdditionalPropertiesV3.js +2 -2
- package/script/oas/object/toObject.d.ts +3 -1
- package/script/oas/object/toObject.d.ts.map +1 -1
- package/script/oas/object/toObject.js +15 -9
- package/script/oas/operation/toOperationsV3.d.ts +5 -2
- package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/script/oas/operation/toOperationsV3.js +14 -12
- package/script/oas/parameter/toParameterV3.d.ts +7 -3
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +18 -16
- package/script/oas/pathItem/toPathItemV3.d.ts +3 -1
- package/script/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/script/oas/pathItem/toPathItemV3.js +3 -3
- package/script/oas/ref/toRefV31.d.ts +3 -1
- package/script/oas/ref/toRefV31.d.ts.map +1 -1
- package/script/oas/ref/toRefV31.js +3 -3
- package/script/oas/requestBody/toRequestBodiesV3.d.ts +5 -2
- package/script/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/script/oas/requestBody/toRequestBodiesV3.js +7 -7
- package/script/oas/response/toResponseV3.d.ts +7 -3
- package/script/oas/response/toResponseV3.d.ts.map +1 -1
- package/script/oas/response/toResponseV3.js +10 -9
- package/script/oas/schema/toSchemasV3.d.ts +9 -4
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +33 -25
- package/script/oas/securityRequirement/toSecurityRequirement.d.ts +3 -1
- package/script/oas/securityRequirement/toSecurityRequirement.d.ts.map +1 -1
- package/script/oas/securityRequirement/toSecurityRequirement.js +1 -1
- package/script/oas/securitySchemes/toSecuritySchemes.d.ts +3 -1
- package/script/oas/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/script/oas/securitySchemes/toSecuritySchemes.js +23 -8
- package/script/oas/server/toServerV3.d.ts +7 -3
- package/script/oas/server/toServerV3.d.ts.map +1 -1
- package/script/oas/server/toServerV3.js +7 -7
- package/script/oas/serverVariable/toServerVariableV3.d.ts +7 -3
- package/script/oas/serverVariable/toServerVariableV3.d.ts.map +1 -1
- package/script/oas/serverVariable/toServerVariableV3.js +6 -5
- package/script/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts +3 -1
- package/script/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts.map +1 -1
- package/script/oas/specificationExtensions/toSpecificationExtensionsV3.js +2 -2
- package/script/oas/string/toString.d.ts +6 -2
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +18 -9
- package/script/oas/tag/toTagsV3.d.ts +5 -2
- package/script/oas/tag/toTagsV3.d.ts.map +1 -1
- package/script/oas/tag/toTagsV3.js +4 -3
- package/script/oas/union/toUnion.d.ts +3 -1
- package/script/oas/union/toUnion.d.ts.map +1 -1
- package/script/oas/union/toUnion.js +4 -4
- package/script/oas/unknown/toUnknown.d.ts +3 -1
- package/script/oas/unknown/toUnknown.d.ts.map +1 -1
- package/script/oas/unknown/toUnknown.js +2 -1
- package/script/run/toArtifacts.d.ts +4 -1
- package/script/run/toArtifacts.d.ts.map +1 -1
- package/script/run/toArtifacts.js +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
import type { ParseContextType } from '../../context/parseTypes.js';
|
|
3
3
|
import { OasMediaType } from './MediaType.js';
|
|
4
|
+
import type { StackTrail } from '../../context/StackTrail.js';
|
|
4
5
|
/**
|
|
5
6
|
* Arguments for transforming an OpenAPI v3 media type item into an OAS media type.
|
|
6
7
|
*/
|
|
@@ -9,6 +10,8 @@ type ToMediaTypeItemV3Args = {
|
|
|
9
10
|
mediaTypeItem: OpenAPIV3.MediaTypeObject;
|
|
10
11
|
/** The media type string (e.g., 'application/json', 'text/plain') */
|
|
11
12
|
mediaType: string;
|
|
13
|
+
/** The stack trail for tracing */
|
|
14
|
+
stackTrail: StackTrail;
|
|
12
15
|
/** The parsing context for tracing and processing */
|
|
13
16
|
context: ParseContextType;
|
|
14
17
|
};
|
|
@@ -114,13 +117,15 @@ type ToMediaTypeItemV3Args = {
|
|
|
114
117
|
* console.log(Object.keys(result.examples)); // ['success', 'error']
|
|
115
118
|
* ```
|
|
116
119
|
*/
|
|
117
|
-
export declare const toMediaTypeItemV3: ({ mediaTypeItem, mediaType, context }: ToMediaTypeItemV3Args) => OasMediaType;
|
|
120
|
+
export declare const toMediaTypeItemV3: ({ mediaTypeItem, mediaType, stackTrail, context }: ToMediaTypeItemV3Args) => OasMediaType;
|
|
118
121
|
/**
|
|
119
122
|
* Arguments for transforming multiple OpenAPI v3 media type items.
|
|
120
123
|
*/
|
|
121
124
|
type ToMediaTypeItemsV3Args = {
|
|
122
125
|
/** Map of media type strings to OpenAPI v3 MediaType objects */
|
|
123
126
|
content: Record<string, OpenAPIV3.MediaTypeObject>;
|
|
127
|
+
/** The stack trail for tracing */
|
|
128
|
+
stackTrail: StackTrail;
|
|
124
129
|
/** The parsing context for tracing and processing */
|
|
125
130
|
context: ParseContextType;
|
|
126
131
|
};
|
|
@@ -207,13 +212,15 @@ type ToMediaTypeItemsV3Args = {
|
|
|
207
212
|
* console.log(processed['application/x-www-form-urlencoded'].encoding); // Form encoding config
|
|
208
213
|
* ```
|
|
209
214
|
*/
|
|
210
|
-
export declare const toMediaTypeItemsV3: ({ content, context }: ToMediaTypeItemsV3Args) => Record<string, OasMediaType>;
|
|
215
|
+
export declare const toMediaTypeItemsV3: ({ content, stackTrail, context }: ToMediaTypeItemsV3Args) => Record<string, OasMediaType>;
|
|
211
216
|
/**
|
|
212
217
|
* Arguments for optionally transforming OpenAPI v3 media type items.
|
|
213
218
|
*/
|
|
214
219
|
type ToOptionalMediaTypeItemsV3Args = {
|
|
215
220
|
/** Optional map of media type strings to OpenAPI v3 MediaType objects */
|
|
216
221
|
content: Record<string, OpenAPIV3.MediaTypeObject> | undefined;
|
|
222
|
+
/** The stack trail for tracing */
|
|
223
|
+
stackTrail: StackTrail;
|
|
217
224
|
/** The parsing context for tracing and processing */
|
|
218
225
|
context: ParseContextType;
|
|
219
226
|
};
|
|
@@ -304,6 +311,6 @@ type ToOptionalMediaTypeItemsV3Args = {
|
|
|
304
311
|
* }
|
|
305
312
|
* ```
|
|
306
313
|
*/
|
|
307
|
-
export declare const toOptionalMediaTypeItemsV3: ({ content, context }: ToOptionalMediaTypeItemsV3Args) => Record<string, OasMediaType> | undefined;
|
|
314
|
+
export declare const toOptionalMediaTypeItemsV3: ({ content, stackTrail, context }: ToOptionalMediaTypeItemsV3Args) => Record<string, OasMediaType> | undefined;
|
|
308
315
|
export {};
|
|
309
316
|
//# sourceMappingURL=toMediaTypeItemV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toMediaTypeItemV3.d.ts","sourceRoot":"","sources":["../../../src/oas/mediaType/toMediaTypeItemV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"toMediaTypeItemV3.d.ts","sourceRoot":"","sources":["../../../src/oas/mediaType/toMediaTypeItemV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE7D;;GAEG;AACH,KAAK,qBAAqB,GAAG;IAC3B,oDAAoD;IACpD,aAAa,EAAE,SAAS,CAAC,eAAe,CAAA;IACxC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAA;IACjB,kCAAkC;IAClC,UAAU,EAAE,UAAU,CAAA;IACtB,qDAAqD;IACrD,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AACH,eAAO,MAAM,iBAAiB,GAAI,mDAK/B,qBAAqB,KAAG,YA8B1B,CAAA;AAED;;GAEG;AACH,KAAK,sBAAsB,GAAG;IAC5B,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC,CAAA;IAClD,kCAAkC;IAClC,UAAU,EAAE,UAAU,CAAA;IACtB,qDAAqD;IACrD,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AACH,eAAO,MAAM,kBAAkB,GAAI,kCAIhC,sBAAsB,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAWtD,CAAA;AAED;;GAEG;AACH,KAAK,8BAA8B,GAAG;IACpC,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;IAC9D,kCAAkC;IAClC,UAAU,EAAE,UAAU,CAAA;IACtB,qDAAqD;IACrD,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,eAAO,MAAM,0BAA0B,GAAI,kCAIxC,8BAA8B,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,SAMlE,CAAA"}
|
|
@@ -2,7 +2,6 @@ import { toOptionalSchemaV3 } from '../schema/toSchemasV3.js';
|
|
|
2
2
|
import { toExamplesV3 } from '../example/toExamplesV3.js';
|
|
3
3
|
import { OasMediaType } from './MediaType.js';
|
|
4
4
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
5
|
-
import { tracer } from '../../helpers/tracer.js';
|
|
6
5
|
/**
|
|
7
6
|
* Transforms an OpenAPI v3 media type object into an internal OAS media type representation.
|
|
8
7
|
*
|
|
@@ -105,22 +104,24 @@ import { tracer } from '../../helpers/tracer.js';
|
|
|
105
104
|
* console.log(Object.keys(result.examples)); // ['success', 'error']
|
|
106
105
|
* ```
|
|
107
106
|
*/
|
|
108
|
-
export const toMediaTypeItemV3 = ({ mediaTypeItem, mediaType, context }) => {
|
|
107
|
+
export const toMediaTypeItemV3 = ({ mediaTypeItem, mediaType, stackTrail, context }) => {
|
|
109
108
|
const { schema, example, examples, encoding, ...skipped } = mediaTypeItem;
|
|
110
109
|
const extensionFields = toSpecificationExtensionsV3({
|
|
111
110
|
skipped,
|
|
112
111
|
parent: mediaTypeItem,
|
|
113
112
|
context,
|
|
113
|
+
stackTrail,
|
|
114
114
|
parentType: 'mediaType'
|
|
115
115
|
});
|
|
116
116
|
const fields = {
|
|
117
117
|
mediaType,
|
|
118
118
|
encoding,
|
|
119
|
-
schema:
|
|
120
|
-
examples:
|
|
119
|
+
schema: stackTrail.trace('schema', st => toOptionalSchemaV3({ schema, stackTrail: st, context })),
|
|
120
|
+
examples: stackTrail.trace('examples', st => toExamplesV3({
|
|
121
121
|
example,
|
|
122
122
|
examples,
|
|
123
123
|
exampleKey: mediaType,
|
|
124
|
+
stackTrail: st,
|
|
124
125
|
context
|
|
125
126
|
})),
|
|
126
127
|
extensionFields
|
|
@@ -210,11 +211,11 @@ export const toMediaTypeItemV3 = ({ mediaTypeItem, mediaType, context }) => {
|
|
|
210
211
|
* console.log(processed['application/x-www-form-urlencoded'].encoding); // Form encoding config
|
|
211
212
|
* ```
|
|
212
213
|
*/
|
|
213
|
-
export const toMediaTypeItemsV3 = ({ content, context }) => {
|
|
214
|
+
export const toMediaTypeItemsV3 = ({ content, stackTrail, context }) => {
|
|
214
215
|
const output = {};
|
|
215
216
|
const entries = Object.entries(content);
|
|
216
217
|
for (const [mediaType, value] of entries) {
|
|
217
|
-
output[mediaType] =
|
|
218
|
+
output[mediaType] = stackTrail.trace(mediaType, st => toMediaTypeItemV3({ mediaTypeItem: value, mediaType, stackTrail: st, context }));
|
|
218
219
|
}
|
|
219
220
|
return output;
|
|
220
221
|
};
|
|
@@ -305,9 +306,9 @@ export const toMediaTypeItemsV3 = ({ content, context }) => {
|
|
|
305
306
|
* }
|
|
306
307
|
* ```
|
|
307
308
|
*/
|
|
308
|
-
export const toOptionalMediaTypeItemsV3 = ({ content, context }) => {
|
|
309
|
+
export const toOptionalMediaTypeItemsV3 = ({ content, stackTrail, context }) => {
|
|
309
310
|
if (!content) {
|
|
310
311
|
return;
|
|
311
312
|
}
|
|
312
|
-
return toMediaTypeItemsV3({ content, context });
|
|
313
|
+
return toMediaTypeItemsV3({ content, stackTrail, context });
|
|
313
314
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
import type { ParseContextType } from '../../context/parseTypes.js';
|
|
3
3
|
import { OasNumber } from './Number.js';
|
|
4
|
+
import type { StackTrail } from '../../context/StackTrail.js';
|
|
4
5
|
type ToNumberArgs = {
|
|
5
6
|
value: OpenAPIV3.SchemaObject;
|
|
7
|
+
stackTrail: StackTrail;
|
|
6
8
|
context: ParseContextType;
|
|
7
9
|
};
|
|
8
|
-
export declare const toNumber: ({ context, value }: ToNumberArgs) => OasNumber;
|
|
10
|
+
export declare const toNumber: ({ context, value, stackTrail }: ToNumberArgs) => OasNumber;
|
|
9
11
|
export {};
|
|
10
12
|
//# sourceMappingURL=toNumber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toNumber.d.ts","sourceRoot":"","sources":["../../../src/oas/number/toNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAMvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,
|
|
1
|
+
{"version":3,"file":"toNumber.d.ts","sourceRoot":"","sources":["../../../src/oas/number/toNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAMvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,gCAAgC,YAAY,KAAG,SAqCvE,CAAA"}
|
|
@@ -4,22 +4,25 @@ import { oasNumberData, numberFormat } from './number-types.js';
|
|
|
4
4
|
import { parseNullable } from '../_helpers/parseNullable.js';
|
|
5
5
|
import { parseEnum } from '../_helpers/parseEnum.js';
|
|
6
6
|
import * as v from 'valibot';
|
|
7
|
-
export const toNumber = ({ context, value }) => {
|
|
7
|
+
export const toNumber = ({ context, value, stackTrail }) => {
|
|
8
8
|
const { nullable, value: valueWithoutNullable } = parseNullable({
|
|
9
9
|
value,
|
|
10
|
-
context
|
|
10
|
+
context,
|
|
11
|
+
stackTrail
|
|
11
12
|
});
|
|
12
13
|
const { example: unparsedExample, ...valueWithoutExample } = valueWithoutNullable;
|
|
13
14
|
const example = parseExample({
|
|
14
15
|
example: unparsedExample,
|
|
15
16
|
context,
|
|
16
17
|
parent: valueWithoutNullable,
|
|
17
|
-
nullable
|
|
18
|
+
nullable,
|
|
19
|
+
stackTrail
|
|
18
20
|
});
|
|
19
21
|
const { enum: unparsedEnums, ...valueWithoutEnums } = valueWithoutExample;
|
|
20
22
|
const enums = parseEnum({
|
|
21
23
|
value: unparsedEnums,
|
|
22
24
|
nullable,
|
|
25
|
+
stackTrail,
|
|
23
26
|
parent: valueWithoutExample,
|
|
24
27
|
context,
|
|
25
28
|
check: isNumber,
|
|
@@ -30,14 +33,16 @@ export const toNumber = ({ context, value }) => {
|
|
|
30
33
|
nullable,
|
|
31
34
|
example,
|
|
32
35
|
enums,
|
|
33
|
-
value: valueWithoutEnums
|
|
36
|
+
value: valueWithoutEnums,
|
|
37
|
+
stackTrail
|
|
34
38
|
});
|
|
35
39
|
};
|
|
36
|
-
const toParsedNumber = ({ context, nullable, example, enums, value: valueWithoutEnums }) => {
|
|
40
|
+
const toParsedNumber = ({ context, nullable, example, enums, value: valueWithoutEnums, stackTrail }) => {
|
|
37
41
|
const { format: unparsedFormat, ...valueWithoutFormat } = valueWithoutEnums;
|
|
38
42
|
const format = parseNumberFormat({
|
|
39
43
|
format: unparsedFormat,
|
|
40
44
|
context,
|
|
45
|
+
stackTrail,
|
|
41
46
|
parent: valueWithoutEnums
|
|
42
47
|
});
|
|
43
48
|
if (!v.is(oasNumberData, valueWithoutFormat)) {
|
|
@@ -48,6 +53,7 @@ const toParsedNumber = ({ context, nullable, example, enums, value: valueWithout
|
|
|
48
53
|
skipped,
|
|
49
54
|
parent: valueWithoutFormat,
|
|
50
55
|
context,
|
|
56
|
+
stackTrail,
|
|
51
57
|
parentType: 'schema:number'
|
|
52
58
|
});
|
|
53
59
|
return new OasNumber({
|
|
@@ -69,7 +75,7 @@ const toParsedNumber = ({ context, nullable, example, enums, value: valueWithout
|
|
|
69
75
|
deprecated
|
|
70
76
|
});
|
|
71
77
|
};
|
|
72
|
-
const parseNumberFormat = ({ format, context, parent }) => {
|
|
78
|
+
const parseNumberFormat = ({ format, context, parent, stackTrail }) => {
|
|
73
79
|
if (format === undefined) {
|
|
74
80
|
return undefined;
|
|
75
81
|
}
|
|
@@ -79,13 +85,14 @@ const parseNumberFormat = ({ format, context, parent }) => {
|
|
|
79
85
|
level: 'warning',
|
|
80
86
|
message: `Invalid format: ${format}`,
|
|
81
87
|
parent,
|
|
88
|
+
stackTrail,
|
|
82
89
|
type: 'INVALID_FORMAT'
|
|
83
90
|
});
|
|
84
91
|
return undefined;
|
|
85
92
|
}
|
|
86
93
|
return format;
|
|
87
94
|
};
|
|
88
|
-
const parseExample = ({ example, context, parent, nullable }) => {
|
|
95
|
+
const parseExample = ({ example, context, parent, nullable, stackTrail }) => {
|
|
89
96
|
if (example === undefined) {
|
|
90
97
|
return undefined;
|
|
91
98
|
}
|
|
@@ -98,6 +105,7 @@ const parseExample = ({ example, context, parent, nullable }) => {
|
|
|
98
105
|
level: 'warning',
|
|
99
106
|
message: `Removed invalid example. Expected "number", got: ${example}`,
|
|
100
107
|
parent,
|
|
108
|
+
stackTrail,
|
|
101
109
|
type: 'INVALID_EXAMPLE'
|
|
102
110
|
});
|
|
103
111
|
return undefined;
|
|
@@ -2,10 +2,12 @@ import type { OpenAPIV3 } from 'openapi-types';
|
|
|
2
2
|
import type { ParseContextType } from '../../context/parseTypes.js';
|
|
3
3
|
import type { OasSchema } from '../schema/Schema.js';
|
|
4
4
|
import type { OasRef } from '../ref/Ref.js';
|
|
5
|
+
import type { StackTrail } from '../../context/StackTrail.js';
|
|
5
6
|
type ToAdditionalPropertiesV3Args = {
|
|
6
7
|
additionalProperties: boolean | OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | undefined;
|
|
8
|
+
stackTrail: StackTrail;
|
|
7
9
|
context: ParseContextType;
|
|
8
10
|
};
|
|
9
|
-
export declare const toAdditionalPropertiesV3: ({ additionalProperties, context }: ToAdditionalPropertiesV3Args) => OasSchema | OasRef<"schema"> | boolean | undefined;
|
|
11
|
+
export declare const toAdditionalPropertiesV3: ({ additionalProperties, stackTrail, context }: ToAdditionalPropertiesV3Args) => OasSchema | OasRef<"schema"> | boolean | undefined;
|
|
10
12
|
export {};
|
|
11
13
|
//# sourceMappingURL=toAdditionalPropertiesV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toAdditionalPropertiesV3.d.ts","sourceRoot":"","sources":["../../../src/oas/object/toAdditionalPropertiesV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"toAdditionalPropertiesV3.d.ts","sourceRoot":"","sources":["../../../src/oas/object/toAdditionalPropertiesV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE7D,KAAK,4BAA4B,GAAG;IAClC,oBAAoB,EAAE,OAAO,GAAG,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAA;IAC9F,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,+CAItC,4BAA4B,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,OAAO,GAAG,SAU1E,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { toSchemaV3 } from '../schema/toSchemasV3.js';
|
|
2
|
-
export const toAdditionalPropertiesV3 = ({ additionalProperties, context }) => {
|
|
2
|
+
export const toAdditionalPropertiesV3 = ({ additionalProperties, stackTrail, context }) => {
|
|
3
3
|
if (typeof additionalProperties === 'boolean') {
|
|
4
4
|
return additionalProperties;
|
|
5
5
|
}
|
|
6
6
|
if (additionalProperties === undefined) {
|
|
7
7
|
return undefined;
|
|
8
8
|
}
|
|
9
|
-
return toSchemaV3({ schema: additionalProperties, context });
|
|
9
|
+
return toSchemaV3({ schema: additionalProperties, stackTrail, context });
|
|
10
10
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
import type { ParseContextType } from '../../context/parseTypes.js';
|
|
3
3
|
import { OasObject } from './Object.js';
|
|
4
|
+
import type { StackTrail } from '../../context/StackTrail.js';
|
|
4
5
|
type ToObjectArgs = {
|
|
5
6
|
value: OpenAPIV3.SchemaObject;
|
|
6
7
|
context: ParseContextType;
|
|
8
|
+
stackTrail: StackTrail;
|
|
7
9
|
};
|
|
8
|
-
export declare const toObject: ({ value, context }: ToObjectArgs) => OasObject;
|
|
10
|
+
export declare const toObject: ({ value, context, stackTrail }: ToObjectArgs) => OasObject;
|
|
9
11
|
export {};
|
|
10
12
|
//# sourceMappingURL=toObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toObject.d.ts","sourceRoot":"","sources":["../../../src/oas/object/toObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"toObject.d.ts","sourceRoot":"","sources":["../../../src/oas/object/toObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAOvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE7D,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,gBAAgB,CAAA;IACzB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,gCAAgC,YAAY,KAAG,SAqCvE,CAAA"}
|
|
@@ -4,18 +4,19 @@ import { toAdditionalPropertiesV3 } from './toAdditionalPropertiesV3.js';
|
|
|
4
4
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
5
5
|
import { parseNullable } from '../_helpers/parseNullable.js';
|
|
6
6
|
import { parseEnum } from '../_helpers/parseEnum.js';
|
|
7
|
-
|
|
8
|
-
export const toObject = ({ value, context }) => {
|
|
7
|
+
export const toObject = ({ value, context, stackTrail }) => {
|
|
9
8
|
const { nullable, value: valueWithoutNullable } = parseNullable({
|
|
10
9
|
value,
|
|
11
|
-
context
|
|
10
|
+
context,
|
|
11
|
+
stackTrail
|
|
12
12
|
});
|
|
13
13
|
const { example: unparsedExample, ...valueWithoutExample } = valueWithoutNullable;
|
|
14
14
|
const example = parseExample({
|
|
15
15
|
example: unparsedExample,
|
|
16
16
|
context,
|
|
17
17
|
parent: valueWithoutNullable,
|
|
18
|
-
nullable
|
|
18
|
+
nullable,
|
|
19
|
+
stackTrail
|
|
19
20
|
});
|
|
20
21
|
const { enum: unparsedEnums, ...valueWithoutEnums } = valueWithoutExample;
|
|
21
22
|
const enums = parseEnum({
|
|
@@ -23,6 +24,7 @@ export const toObject = ({ value, context }) => {
|
|
|
23
24
|
nullable,
|
|
24
25
|
parent: valueWithoutExample,
|
|
25
26
|
context,
|
|
27
|
+
stackTrail,
|
|
26
28
|
check: isObject,
|
|
27
29
|
toMessage: item => `Removed invalid enum. Expected "object", got: ${item}`
|
|
28
30
|
});
|
|
@@ -31,15 +33,17 @@ export const toObject = ({ value, context }) => {
|
|
|
31
33
|
nullable,
|
|
32
34
|
example,
|
|
33
35
|
enums,
|
|
34
|
-
value: valueWithoutEnums
|
|
36
|
+
value: valueWithoutEnums,
|
|
37
|
+
stackTrail
|
|
35
38
|
});
|
|
36
39
|
};
|
|
37
|
-
const toParsedObject = ({ context, nullable, example, enums, value }) => {
|
|
40
|
+
const toParsedObject = ({ context, stackTrail, nullable, example, enums, value }) => {
|
|
38
41
|
const { type: _type, title, description, deprecated, properties, required, maxProperties, minProperties, additionalProperties, default: defaultValue, readOnly, writeOnly, ...skipped } = value;
|
|
39
42
|
const extensionFields = toSpecificationExtensionsV3({
|
|
40
43
|
skipped,
|
|
41
44
|
parent: value,
|
|
42
45
|
context,
|
|
46
|
+
stackTrail,
|
|
43
47
|
parentType: 'schema:object'
|
|
44
48
|
});
|
|
45
49
|
return new OasObject({
|
|
@@ -48,14 +52,15 @@ const toParsedObject = ({ context, nullable, example, enums, value }) => {
|
|
|
48
52
|
nullable,
|
|
49
53
|
example,
|
|
50
54
|
enums,
|
|
51
|
-
properties:
|
|
55
|
+
properties: stackTrail.trace('properties', st => toOptionalSchemasV3({
|
|
52
56
|
schemas: properties,
|
|
57
|
+
stackTrail: st,
|
|
53
58
|
context
|
|
54
59
|
})),
|
|
55
60
|
required,
|
|
56
61
|
maxProperties,
|
|
57
62
|
minProperties,
|
|
58
|
-
additionalProperties:
|
|
63
|
+
additionalProperties: stackTrail.trace('additionalProperties', st => toAdditionalPropertiesV3({ additionalProperties, stackTrail: st, context })),
|
|
59
64
|
extensionFields,
|
|
60
65
|
default: defaultValue,
|
|
61
66
|
deprecated,
|
|
@@ -63,7 +68,7 @@ const toParsedObject = ({ context, nullable, example, enums, value }) => {
|
|
|
63
68
|
writeOnly
|
|
64
69
|
});
|
|
65
70
|
};
|
|
66
|
-
const parseExample = ({ example, context, parent, nullable }) => {
|
|
71
|
+
const parseExample = ({ example, context, parent, nullable, stackTrail }) => {
|
|
67
72
|
if (example === undefined) {
|
|
68
73
|
return undefined;
|
|
69
74
|
}
|
|
@@ -76,6 +81,7 @@ const parseExample = ({ example, context, parent, nullable }) => {
|
|
|
76
81
|
level: 'warning',
|
|
77
82
|
message: `Invalid example: ${example}`,
|
|
78
83
|
parent,
|
|
84
|
+
stackTrail,
|
|
79
85
|
type: 'INVALID_EXAMPLE'
|
|
80
86
|
});
|
|
81
87
|
return undefined;
|
|
@@ -3,6 +3,7 @@ import type { Method } from '../../types/Method.js';
|
|
|
3
3
|
import type { ParseContextType } from '../../context/parseTypes.js';
|
|
4
4
|
import { OasOperation } from './Operation.js';
|
|
5
5
|
import type { OasPathItem } from '../pathItem/PathItem.js';
|
|
6
|
+
import type { StackTrail } from '../../context/StackTrail.js';
|
|
6
7
|
type OperationInfo = {
|
|
7
8
|
method: Method;
|
|
8
9
|
path: string;
|
|
@@ -11,13 +12,15 @@ type OperationInfo = {
|
|
|
11
12
|
type ToOperationV3Args = {
|
|
12
13
|
operation: OpenAPIV3.OperationObject;
|
|
13
14
|
operationInfo: OperationInfo;
|
|
15
|
+
stackTrail: StackTrail;
|
|
14
16
|
context: ParseContextType;
|
|
15
17
|
};
|
|
16
|
-
export declare const toOperationV3: ({ operation, operationInfo, context }: ToOperationV3Args) => OasOperation;
|
|
18
|
+
export declare const toOperationV3: ({ operation, operationInfo, stackTrail, context }: ToOperationV3Args) => OasOperation;
|
|
17
19
|
type ToOperationsV3Args = {
|
|
18
20
|
paths: OpenAPIV3.PathsObject;
|
|
21
|
+
stackTrail: StackTrail;
|
|
19
22
|
context: ParseContextType;
|
|
20
23
|
};
|
|
21
|
-
export declare const toOperationsV3: ({ paths, context }: ToOperationsV3Args) => OasOperation[];
|
|
24
|
+
export declare const toOperationsV3: ({ paths, stackTrail, context }: ToOperationsV3Args) => OasOperation[];
|
|
22
25
|
export {};
|
|
23
26
|
//# sourceMappingURL=toOperationsV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAInE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAInE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAQ1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAE7D,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,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,YAuDtB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,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,EAwEnC,CAAA"}
|
|
@@ -8,16 +8,16 @@ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecif
|
|
|
8
8
|
import { toSecurityRequirementsV3 } from '../securityRequirement/toSecurityRequirement.js';
|
|
9
9
|
import invariant from 'tiny-invariant';
|
|
10
10
|
import { isEmpty } from '../../helpers/isEmpty.js';
|
|
11
|
-
import { tracer } from '../../helpers/tracer.js';
|
|
12
11
|
import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
|
|
13
12
|
import { toOptionalServersV3 } from '../server/toServerV3.js';
|
|
14
|
-
export const toOperationV3 = ({ operation, operationInfo, context }) => {
|
|
13
|
+
export const toOperationV3 = ({ operation, operationInfo, stackTrail, context }) => {
|
|
15
14
|
const { method, path, pathItem } = operationInfo;
|
|
16
15
|
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers, ...skipped } = operation;
|
|
17
16
|
const extensionFields = toSpecificationExtensionsV3({
|
|
18
17
|
skipped,
|
|
19
18
|
parent: operation,
|
|
20
19
|
context,
|
|
20
|
+
stackTrail,
|
|
21
21
|
parentType: 'operation'
|
|
22
22
|
});
|
|
23
23
|
return new OasOperation({
|
|
@@ -28,19 +28,19 @@ export const toOperationV3 = ({ operation, operationInfo, context }) => {
|
|
|
28
28
|
summary,
|
|
29
29
|
tags,
|
|
30
30
|
description,
|
|
31
|
-
parameters:
|
|
32
|
-
requestBody:
|
|
33
|
-
responses:
|
|
31
|
+
parameters: stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context })),
|
|
32
|
+
requestBody: stackTrail.trace('requestBody', st => toRequestBodyV3({ requestBody, stackTrail: st, context })),
|
|
33
|
+
responses: stackTrail.trace('responses', st => toResponsesV3({ responses, stackTrail: st, context })),
|
|
34
34
|
deprecated,
|
|
35
|
-
security:
|
|
36
|
-
externalDocs:
|
|
37
|
-
servers:
|
|
35
|
+
security: stackTrail.trace('security', st => toSecurityRequirementsV3({ security, stackTrail: st, context })),
|
|
36
|
+
externalDocs: stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context })),
|
|
37
|
+
servers: stackTrail.trace('servers', st => toOptionalServersV3({ servers, stackTrail: st, context })),
|
|
38
38
|
extensionFields
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
export const toOperationsV3 = ({ paths, context }) => {
|
|
41
|
+
export const toOperationsV3 = ({ paths, stackTrail, context }) => {
|
|
42
42
|
return Object.entries(paths).flatMap(([path, pathItem]) => {
|
|
43
|
-
return
|
|
43
|
+
return stackTrail.trace(path, st => {
|
|
44
44
|
if (!pathItem) {
|
|
45
45
|
return [];
|
|
46
46
|
}
|
|
@@ -62,11 +62,11 @@ export const toOperationsV3 = ({ paths, context }) => {
|
|
|
62
62
|
methodObject: {}
|
|
63
63
|
});
|
|
64
64
|
const pathItemObject = !isEmpty(cleaned.rest)
|
|
65
|
-
? toPathItemV3({ pathItem: cleaned.rest, context })
|
|
65
|
+
? toPathItemV3({ pathItem: cleaned.rest, stackTrail: st, context })
|
|
66
66
|
: undefined;
|
|
67
67
|
return Object.entries(cleaned.methodObject)
|
|
68
68
|
.map(([method, operation]) => {
|
|
69
|
-
return
|
|
69
|
+
return stackTrail.trace(method, st => {
|
|
70
70
|
if (!operation) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
@@ -78,6 +78,7 @@ export const toOperationsV3 = ({ paths, context }) => {
|
|
|
78
78
|
path,
|
|
79
79
|
pathItem: pathItemObject
|
|
80
80
|
},
|
|
81
|
+
stackTrail: st,
|
|
81
82
|
context
|
|
82
83
|
});
|
|
83
84
|
}
|
|
@@ -88,6 +89,7 @@ export const toOperationsV3 = ({ paths, context }) => {
|
|
|
88
89
|
parent: operation,
|
|
89
90
|
level: 'error',
|
|
90
91
|
error,
|
|
92
|
+
stackTrail: st,
|
|
91
93
|
type: 'INVALID_OPERATION'
|
|
92
94
|
});
|
|
93
95
|
return undefined;
|
|
@@ -2,20 +2,24 @@ import type { ParseContextType } from '../../context/parseTypes.js';
|
|
|
2
2
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
3
|
import { OasParameter } from './Parameter.js';
|
|
4
4
|
import type { OasRef } from '../ref/Ref.js';
|
|
5
|
+
import type { StackTrail } from '../../context/StackTrail.js';
|
|
5
6
|
type ToParameterListV3Args = {
|
|
6
7
|
parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[] | undefined;
|
|
8
|
+
stackTrail: StackTrail;
|
|
7
9
|
context: ParseContextType;
|
|
8
10
|
};
|
|
9
|
-
export declare const toParameterListV3: ({ parameters, context }: ToParameterListV3Args) => (OasParameter | OasRef<"parameter">)[] | undefined;
|
|
11
|
+
export declare const toParameterListV3: ({ parameters, stackTrail, context }: ToParameterListV3Args) => (OasParameter | OasRef<"parameter">)[] | undefined;
|
|
10
12
|
type ToParametersV3Args = {
|
|
11
13
|
parameters: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject>;
|
|
14
|
+
stackTrail: StackTrail;
|
|
12
15
|
context: ParseContextType;
|
|
13
16
|
};
|
|
14
|
-
export declare const toParametersV3: ({ parameters, context }: ToParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">>;
|
|
17
|
+
export declare const toParametersV3: ({ parameters, stackTrail, context }: ToParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">>;
|
|
15
18
|
type ToOptionalParametersV3Args = {
|
|
16
19
|
parameters: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject> | undefined;
|
|
20
|
+
stackTrail: StackTrail;
|
|
17
21
|
context: ParseContextType;
|
|
18
22
|
};
|
|
19
|
-
export declare const toOptionalParametersV3: ({ parameters, context }: ToOptionalParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">> | undefined;
|
|
23
|
+
export declare const toOptionalParametersV3: ({ parameters, stackTrail, context }: ToOptionalParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">> | undefined;
|
|
20
24
|
export {};
|
|
21
25
|
//# sourceMappingURL=toParameterV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAK3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,CAAC,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GAAG,SAAS,CAAA;IACjF,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,qCAI/B,qBAAqB,KAAG,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,SAQnE,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,CAAA;IACjF,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,qCAI5B,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAsBxE,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;IAC7F,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,qCAIpC,0BAA0B,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,SAMpF,CAAA"}
|
|
@@ -9,21 +9,20 @@ import { match } from 'ts-pattern';
|
|
|
9
9
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
10
10
|
import * as v from 'valibot';
|
|
11
11
|
import invariant from 'tiny-invariant';
|
|
12
|
-
|
|
13
|
-
export const toParameterListV3 = ({ parameters, context }) => {
|
|
12
|
+
export const toParameterListV3 = ({ parameters, stackTrail, context }) => {
|
|
14
13
|
if (!parameters) {
|
|
15
14
|
return undefined;
|
|
16
15
|
}
|
|
17
16
|
return parameters.map((parameter, index) => {
|
|
18
|
-
return
|
|
17
|
+
return stackTrail.trace(`${index}`, st => toParameterV3({ parameter, stackTrail: st, context }));
|
|
19
18
|
});
|
|
20
19
|
};
|
|
21
|
-
export const toParametersV3 = ({ parameters, context }) => {
|
|
20
|
+
export const toParametersV3 = ({ parameters, stackTrail, context }) => {
|
|
22
21
|
const output = {};
|
|
23
22
|
const entries = Object.entries(parameters);
|
|
24
23
|
for (const [key, parameter] of entries) {
|
|
25
24
|
try {
|
|
26
|
-
output[key] =
|
|
25
|
+
output[key] = stackTrail.trace(key, st => toParameterV3({ parameter, stackTrail: st, context }));
|
|
27
26
|
}
|
|
28
27
|
catch (error) {
|
|
29
28
|
invariant(error instanceof Error, 'Invalid error');
|
|
@@ -32,27 +31,29 @@ export const toParametersV3 = ({ parameters, context }) => {
|
|
|
32
31
|
level: 'error',
|
|
33
32
|
error,
|
|
34
33
|
parent: parameter,
|
|
34
|
+
stackTrail,
|
|
35
35
|
type: 'INVALID_PARAMETER'
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
return output;
|
|
40
40
|
};
|
|
41
|
-
export const toOptionalParametersV3 = ({ parameters, context }) => {
|
|
41
|
+
export const toOptionalParametersV3 = ({ parameters, stackTrail, context }) => {
|
|
42
42
|
if (!parameters) {
|
|
43
43
|
return undefined;
|
|
44
44
|
}
|
|
45
|
-
return toParametersV3({ parameters, context });
|
|
45
|
+
return toParametersV3({ parameters, stackTrail, context });
|
|
46
46
|
};
|
|
47
|
-
const toParameterV3 = ({ parameter, context }) => {
|
|
47
|
+
const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
48
48
|
if (isRef(parameter)) {
|
|
49
|
-
return toRefV31({ ref: parameter, refType: 'parameter', context });
|
|
49
|
+
return toRefV31({ ref: parameter, refType: 'parameter', stackTrail, context });
|
|
50
50
|
}
|
|
51
51
|
const { name, in: location, description, required, deprecated, allowEmptyValue, allowReserved, schema, example, examples, content, style, explode, ...skipped } = parameter;
|
|
52
52
|
const extensionFields = toSpecificationExtensionsV3({
|
|
53
53
|
skipped,
|
|
54
54
|
parent: parameter,
|
|
55
55
|
context,
|
|
56
|
+
stackTrail,
|
|
56
57
|
parentType: 'parameter'
|
|
57
58
|
});
|
|
58
59
|
const parsedLocation = v.parse(oasParameterLocation, location);
|
|
@@ -67,23 +68,24 @@ const toParameterV3 = ({ parameter, context }) => {
|
|
|
67
68
|
description,
|
|
68
69
|
required: defaultRequired,
|
|
69
70
|
deprecated,
|
|
70
|
-
style:
|
|
71
|
-
explode:
|
|
71
|
+
style: stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st })),
|
|
72
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
72
73
|
allowEmptyValue,
|
|
73
74
|
allowReserved,
|
|
74
|
-
schema:
|
|
75
|
-
examples:
|
|
75
|
+
schema: stackTrail.trace('schema', st => toOptionalSchemaV3({ schema, stackTrail: st, context })),
|
|
76
|
+
examples: stackTrail.trace('examples', st => toExamplesV3({
|
|
76
77
|
examples,
|
|
77
78
|
example,
|
|
78
79
|
exampleKey: `${name}-${parsedLocation}`,
|
|
80
|
+
stackTrail: st,
|
|
79
81
|
context
|
|
80
82
|
})),
|
|
81
|
-
content:
|
|
83
|
+
content: stackTrail.trace('content', st => toOptionalMediaTypeItemsV3({ content, stackTrail: st, context })),
|
|
82
84
|
extensionFields
|
|
83
85
|
};
|
|
84
86
|
return new OasParameter(fields);
|
|
85
87
|
};
|
|
86
|
-
const toStyle = ({ style, location }) => {
|
|
88
|
+
const toStyle = ({ style, location, stackTrail }) => {
|
|
87
89
|
const parsed = v.parse(v.optional(oasParameterStyle), style);
|
|
88
90
|
return (parsed ??
|
|
89
91
|
match(location)
|
|
@@ -93,7 +95,7 @@ const toStyle = ({ style, location }) => {
|
|
|
93
95
|
.with('cookie', () => 'form')
|
|
94
96
|
.exhaustive());
|
|
95
97
|
};
|
|
96
|
-
const toExplode = ({ explode, style }) => {
|
|
98
|
+
const toExplode = ({ explode, style, stackTrail }) => {
|
|
97
99
|
return (explode ??
|
|
98
100
|
match(style)
|
|
99
101
|
.with('form', () => true)
|