@skmtc/core 0.0.447 → 0.0.449
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/oas/object/toObject.d.ts +1 -2
- package/esm/oas/object/toObject.d.ts.map +1 -1
- package/esm/oas/object/toObject.js +2 -3
- package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/oas/operation/toOperationsV3.js +8 -7
- package/esm/oas/schema/toSchemasV3.d.ts +3 -6
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +26 -13
- package/package.json +1 -1
- package/script/oas/object/toObject.d.ts +1 -2
- package/script/oas/object/toObject.d.ts.map +1 -1
- package/script/oas/object/toObject.js +2 -3
- package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/script/oas/operation/toOperationsV3.js +8 -7
- package/script/oas/schema/toSchemasV3.d.ts +3 -6
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +26 -13
|
@@ -4,8 +4,7 @@ import { OasObject } from './Object.js';
|
|
|
4
4
|
type ToObjectArgs = {
|
|
5
5
|
value: OpenAPIV3.NonArraySchemaObject;
|
|
6
6
|
context: ParseContext;
|
|
7
|
-
childOfComponents?: boolean;
|
|
8
7
|
};
|
|
9
|
-
export declare const toObject: ({ value, context
|
|
8
|
+
export declare const toObject: ({ value, context }: ToObjectArgs) => OasObject;
|
|
10
9
|
export {};
|
|
11
10
|
//# 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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAA;AAK7D,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAA;IACrC,OAAO,EAAE,YAAY,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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAA;AAK7D,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAA;IACrC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,KAAG,SAqC3D,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { OasObject } from './Object.js';
|
|
|
2
2
|
import { toOptionalSchemasV3 } from '../schema/toSchemasV3.js';
|
|
3
3
|
import { toAdditionalPropertiesV3 } from './toAdditionalPropertiesV3.js';
|
|
4
4
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
5
|
-
export const toObject = ({ value, context
|
|
5
|
+
export const toObject = ({ value, context }) => {
|
|
6
6
|
const { type: _type, title, description, properties, required, additionalProperties, nullable, example, ...skipped } = value;
|
|
7
7
|
const extensionFields = toSpecificationExtensionsV3({
|
|
8
8
|
skipped,
|
|
@@ -15,8 +15,7 @@ export const toObject = ({ value, context, childOfComponents }) => {
|
|
|
15
15
|
example,
|
|
16
16
|
properties: context.trace('properties', () => toOptionalSchemasV3({
|
|
17
17
|
schemas: properties,
|
|
18
|
-
context
|
|
19
|
-
childOfObject: childOfComponents
|
|
18
|
+
context
|
|
20
19
|
})),
|
|
21
20
|
required: required,
|
|
22
21
|
additionalProperties: context.trace('additionalProperties', () => toAdditionalPropertiesV3({ additionalProperties, context })),
|
|
@@ -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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAOD,eAAO,MAAM,aAAa,0CAIvB,iBAAiB,KAAG,
|
|
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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAOD,eAAO,MAAM,aAAa,0CAIvB,iBAAiB,KAAG,YAwCtB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,SAAS,CAAC,WAAW,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,uBAAwB,kBAAkB,KAAG,YAAY,EAsDnF,CAAA"}
|
|
@@ -9,13 +9,14 @@ export const toOperationV3 = ({ operation, operationInfo, context }) => {
|
|
|
9
9
|
const { method, path, pathItem } = operationInfo;
|
|
10
10
|
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, ...skipped } = operation;
|
|
11
11
|
const extensionFields = toSpecificationExtensionsV3({ skipped, context });
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
extensionFields,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
context.registerExtension({
|
|
13
|
+
extensionFields: {
|
|
14
|
+
Label: extensionFields?.['x-label'] ?? '',
|
|
15
|
+
Description: extensionFields?.['x-description'] ?? ''
|
|
16
|
+
},
|
|
17
|
+
type: 'operation',
|
|
18
|
+
stackTrail: ['operations', `${method.toUpperCase()} ${path}`]
|
|
19
|
+
});
|
|
19
20
|
return new OasOperation({
|
|
20
21
|
pathItem,
|
|
21
22
|
path,
|
|
@@ -6,22 +6,19 @@ type ToSchemasV3Args = {
|
|
|
6
6
|
schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject>;
|
|
7
7
|
context: ParseContext;
|
|
8
8
|
childOfComponents?: boolean;
|
|
9
|
-
childOfObject?: boolean;
|
|
10
9
|
};
|
|
11
|
-
export declare const toSchemasV3: ({ schemas, context, childOfComponents
|
|
10
|
+
export declare const toSchemasV3: ({ schemas, context, childOfComponents }: ToSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">>;
|
|
12
11
|
type ToOptionalSchemasV3Args = {
|
|
13
12
|
schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject> | undefined;
|
|
14
13
|
context: ParseContext;
|
|
15
14
|
childOfComponents?: boolean;
|
|
16
|
-
childOfObject?: boolean;
|
|
17
15
|
};
|
|
18
|
-
export declare const toOptionalSchemasV3: ({ schemas, context, childOfComponents
|
|
16
|
+
export declare const toOptionalSchemasV3: ({ schemas, context, childOfComponents }: ToOptionalSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">> | undefined;
|
|
19
17
|
type ToSchemaV3Args = {
|
|
20
18
|
schema: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;
|
|
21
19
|
context: ParseContext;
|
|
22
|
-
childOfComponents?: boolean;
|
|
23
20
|
};
|
|
24
|
-
export declare const toSchemaV3: ({ schema, context
|
|
21
|
+
export declare const toSchemaV3: ({ schema, context }: ToSchemaV3Args) => OasSchema | OasRef<"schema">;
|
|
25
22
|
type ToOptionalSchemaV3Args = {
|
|
26
23
|
schema: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | undefined;
|
|
27
24
|
context: ParseContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toSchemasV3.d.ts","sourceRoot":"","sources":["../../../src/oas/schema/toSchemasV3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAY3C,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"toSchemasV3.d.ts","sourceRoot":"","sources":["../../../src/oas/schema/toSchemasV3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAY3C,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,WAAW,4CAIrB,eAAe,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAoC/D,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAA;IACvF,OAAO,EAAE,YAAY,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,mBAAmB,4CAI7B,uBAAuB,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,SAM3E,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAA;IAC1D,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,wBAAyB,cAAc,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAuC3F,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAA;IACtE,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,wBAG5B,sBAAsB,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAM1D,CAAA"}
|
|
@@ -11,33 +11,46 @@ import { toUnknown } from '../unknown/toUnknown.js';
|
|
|
11
11
|
import { toUnion } from '../union/toUnion.js';
|
|
12
12
|
import { toIntersection } from '../intersection/toIntersection.js';
|
|
13
13
|
import { extractExtensions } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
14
|
-
export const toSchemasV3 = ({ schemas, context, childOfComponents
|
|
14
|
+
export const toSchemasV3 = ({ schemas, context, childOfComponents }) => {
|
|
15
15
|
return Object.fromEntries(Object.entries(schemas).map(([key, schema]) => {
|
|
16
16
|
return [
|
|
17
17
|
key,
|
|
18
18
|
context.trace(key, () => {
|
|
19
|
-
if (
|
|
19
|
+
if (!isRef(schema)) {
|
|
20
20
|
const { extensionFields } = extractExtensions(schema);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
if (childOfComponents) {
|
|
22
|
+
context.registerExtension({
|
|
23
|
+
extensionFields: {
|
|
24
|
+
Label: extensionFields?.['x-label'] ?? '',
|
|
25
|
+
Description: extensionFields?.['x-description'] ?? ''
|
|
26
|
+
},
|
|
27
|
+
stackTrail: ['models', key],
|
|
28
|
+
type: 'schema'
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log('STACK TRAIL X', context.stackTrail.clone().toString());
|
|
33
|
+
context.registerExtension({
|
|
34
|
+
extensionFields: {
|
|
35
|
+
Label: extensionFields?.['x-label'] ?? ''
|
|
36
|
+
},
|
|
37
|
+
stackTrail: ['models', 'XXX', key],
|
|
38
|
+
type: 'schema'
|
|
39
|
+
});
|
|
40
|
+
}
|
|
28
41
|
}
|
|
29
42
|
return toSchemaV3({ schema, context });
|
|
30
43
|
})
|
|
31
44
|
];
|
|
32
45
|
}));
|
|
33
46
|
};
|
|
34
|
-
export const toOptionalSchemasV3 = ({ schemas, context, childOfComponents
|
|
47
|
+
export const toOptionalSchemasV3 = ({ schemas, context, childOfComponents }) => {
|
|
35
48
|
if (!schemas) {
|
|
36
49
|
return undefined;
|
|
37
50
|
}
|
|
38
|
-
return toSchemasV3({ schemas, context, childOfComponents
|
|
51
|
+
return toSchemasV3({ schemas, context, childOfComponents });
|
|
39
52
|
};
|
|
40
|
-
export const toSchemaV3 = ({ schema, context
|
|
53
|
+
export const toSchemaV3 = ({ schema, context }) => {
|
|
41
54
|
if (isRef(schema)) {
|
|
42
55
|
return toRefV31({ ref: schema, refType: 'schema', context });
|
|
43
56
|
}
|
|
@@ -64,7 +77,7 @@ export const toSchemaV3 = ({ schema, context, childOfComponents }) => {
|
|
|
64
77
|
// }
|
|
65
78
|
return context.trace('allOf', () => toIntersection({ value, members, context }));
|
|
66
79
|
})
|
|
67
|
-
.with({ type: 'object' }, value => toObject({ value, context
|
|
80
|
+
.with({ type: 'object' }, value => toObject({ value, context }))
|
|
68
81
|
.with({ type: 'array' }, value => toArray({ value, context }))
|
|
69
82
|
.with({ type: 'integer' }, value => toInteger({ value, context }))
|
|
70
83
|
.with({ type: 'number' }, value => toNumber({ value, context }))
|
package/package.json
CHANGED
|
@@ -4,8 +4,7 @@ import { OasObject } from './Object.js';
|
|
|
4
4
|
type ToObjectArgs = {
|
|
5
5
|
value: OpenAPIV3.NonArraySchemaObject;
|
|
6
6
|
context: ParseContext;
|
|
7
|
-
childOfComponents?: boolean;
|
|
8
7
|
};
|
|
9
|
-
export declare const toObject: ({ value, context
|
|
8
|
+
export declare const toObject: ({ value, context }: ToObjectArgs) => OasObject;
|
|
10
9
|
export {};
|
|
11
10
|
//# 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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAA;AAK7D,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAA;IACrC,OAAO,EAAE,YAAY,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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAwB,MAAM,aAAa,CAAA;AAK7D,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAA;IACrC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,KAAG,SAqC3D,CAAA"}
|
|
@@ -5,7 +5,7 @@ const Object_js_1 = require("./Object.js");
|
|
|
5
5
|
const toSchemasV3_js_1 = require("../schema/toSchemasV3.js");
|
|
6
6
|
const toAdditionalPropertiesV3_js_1 = require("./toAdditionalPropertiesV3.js");
|
|
7
7
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
8
|
-
const toObject = ({ value, context
|
|
8
|
+
const toObject = ({ value, context }) => {
|
|
9
9
|
const { type: _type, title, description, properties, required, additionalProperties, nullable, example, ...skipped } = value;
|
|
10
10
|
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
11
11
|
skipped,
|
|
@@ -18,8 +18,7 @@ const toObject = ({ value, context, childOfComponents }) => {
|
|
|
18
18
|
example,
|
|
19
19
|
properties: context.trace('properties', () => (0, toSchemasV3_js_1.toOptionalSchemasV3)({
|
|
20
20
|
schemas: properties,
|
|
21
|
-
context
|
|
22
|
-
childOfObject: childOfComponents
|
|
21
|
+
context
|
|
23
22
|
})),
|
|
24
23
|
required: required,
|
|
25
24
|
additionalProperties: context.trace('additionalProperties', () => (0, toAdditionalPropertiesV3_js_1.toAdditionalPropertiesV3)({ additionalProperties, context })),
|
|
@@ -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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAOD,eAAO,MAAM,aAAa,0CAIvB,iBAAiB,KAAG,
|
|
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,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAOD,eAAO,MAAM,aAAa,0CAIvB,iBAAiB,KAAG,YAwCtB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,SAAS,CAAC,WAAW,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,uBAAwB,kBAAkB,KAAG,YAAY,EAsDnF,CAAA"}
|
|
@@ -12,13 +12,14 @@ const toOperationV3 = ({ operation, operationInfo, context }) => {
|
|
|
12
12
|
const { method, path, pathItem } = operationInfo;
|
|
13
13
|
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, ...skipped } = operation;
|
|
14
14
|
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({ skipped, context });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
extensionFields,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
context.registerExtension({
|
|
16
|
+
extensionFields: {
|
|
17
|
+
Label: extensionFields?.['x-label'] ?? '',
|
|
18
|
+
Description: extensionFields?.['x-description'] ?? ''
|
|
19
|
+
},
|
|
20
|
+
type: 'operation',
|
|
21
|
+
stackTrail: ['operations', `${method.toUpperCase()} ${path}`]
|
|
22
|
+
});
|
|
22
23
|
return new Operation_js_1.OasOperation({
|
|
23
24
|
pathItem,
|
|
24
25
|
path,
|
|
@@ -6,22 +6,19 @@ type ToSchemasV3Args = {
|
|
|
6
6
|
schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject>;
|
|
7
7
|
context: ParseContext;
|
|
8
8
|
childOfComponents?: boolean;
|
|
9
|
-
childOfObject?: boolean;
|
|
10
9
|
};
|
|
11
|
-
export declare const toSchemasV3: ({ schemas, context, childOfComponents
|
|
10
|
+
export declare const toSchemasV3: ({ schemas, context, childOfComponents }: ToSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">>;
|
|
12
11
|
type ToOptionalSchemasV3Args = {
|
|
13
12
|
schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject> | undefined;
|
|
14
13
|
context: ParseContext;
|
|
15
14
|
childOfComponents?: boolean;
|
|
16
|
-
childOfObject?: boolean;
|
|
17
15
|
};
|
|
18
|
-
export declare const toOptionalSchemasV3: ({ schemas, context, childOfComponents
|
|
16
|
+
export declare const toOptionalSchemasV3: ({ schemas, context, childOfComponents }: ToOptionalSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">> | undefined;
|
|
19
17
|
type ToSchemaV3Args = {
|
|
20
18
|
schema: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;
|
|
21
19
|
context: ParseContext;
|
|
22
|
-
childOfComponents?: boolean;
|
|
23
20
|
};
|
|
24
|
-
export declare const toSchemaV3: ({ schema, context
|
|
21
|
+
export declare const toSchemaV3: ({ schema, context }: ToSchemaV3Args) => OasSchema | OasRef<"schema">;
|
|
25
22
|
type ToOptionalSchemaV3Args = {
|
|
26
23
|
schema: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | undefined;
|
|
27
24
|
context: ParseContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toSchemasV3.d.ts","sourceRoot":"","sources":["../../../src/oas/schema/toSchemasV3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAY3C,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"toSchemasV3.d.ts","sourceRoot":"","sources":["../../../src/oas/schema/toSchemasV3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAY3C,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,WAAW,4CAIrB,eAAe,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAoC/D,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAA;IACvF,OAAO,EAAE,YAAY,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,mBAAmB,4CAI7B,uBAAuB,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,SAM3E,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAA;IAC1D,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,wBAAyB,cAAc,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAuC3F,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAA;IACtE,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,wBAG5B,sBAAsB,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAM1D,CAAA"}
|
|
@@ -14,20 +14,33 @@ const toUnknown_js_1 = require("../unknown/toUnknown.js");
|
|
|
14
14
|
const toUnion_js_1 = require("../union/toUnion.js");
|
|
15
15
|
const toIntersection_js_1 = require("../intersection/toIntersection.js");
|
|
16
16
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
17
|
-
const toSchemasV3 = ({ schemas, context, childOfComponents
|
|
17
|
+
const toSchemasV3 = ({ schemas, context, childOfComponents }) => {
|
|
18
18
|
return Object.fromEntries(Object.entries(schemas).map(([key, schema]) => {
|
|
19
19
|
return [
|
|
20
20
|
key,
|
|
21
21
|
context.trace(key, () => {
|
|
22
|
-
if (
|
|
22
|
+
if (!(0, refFns_js_1.isRef)(schema)) {
|
|
23
23
|
const { extensionFields } = (0, toSpecificationExtensionsV3_js_1.extractExtensions)(schema);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if (childOfComponents) {
|
|
25
|
+
context.registerExtension({
|
|
26
|
+
extensionFields: {
|
|
27
|
+
Label: extensionFields?.['x-label'] ?? '',
|
|
28
|
+
Description: extensionFields?.['x-description'] ?? ''
|
|
29
|
+
},
|
|
30
|
+
stackTrail: ['models', key],
|
|
31
|
+
type: 'schema'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.log('STACK TRAIL X', context.stackTrail.clone().toString());
|
|
36
|
+
context.registerExtension({
|
|
37
|
+
extensionFields: {
|
|
38
|
+
Label: extensionFields?.['x-label'] ?? ''
|
|
39
|
+
},
|
|
40
|
+
stackTrail: ['models', 'XXX', key],
|
|
41
|
+
type: 'schema'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
31
44
|
}
|
|
32
45
|
return (0, exports.toSchemaV3)({ schema, context });
|
|
33
46
|
})
|
|
@@ -35,14 +48,14 @@ const toSchemasV3 = ({ schemas, context, childOfComponents, childOfObject }) =>
|
|
|
35
48
|
}));
|
|
36
49
|
};
|
|
37
50
|
exports.toSchemasV3 = toSchemasV3;
|
|
38
|
-
const toOptionalSchemasV3 = ({ schemas, context, childOfComponents
|
|
51
|
+
const toOptionalSchemasV3 = ({ schemas, context, childOfComponents }) => {
|
|
39
52
|
if (!schemas) {
|
|
40
53
|
return undefined;
|
|
41
54
|
}
|
|
42
|
-
return (0, exports.toSchemasV3)({ schemas, context, childOfComponents
|
|
55
|
+
return (0, exports.toSchemasV3)({ schemas, context, childOfComponents });
|
|
43
56
|
};
|
|
44
57
|
exports.toOptionalSchemasV3 = toOptionalSchemasV3;
|
|
45
|
-
const toSchemaV3 = ({ schema, context
|
|
58
|
+
const toSchemaV3 = ({ schema, context }) => {
|
|
46
59
|
if ((0, refFns_js_1.isRef)(schema)) {
|
|
47
60
|
return (0, toRefV31_js_1.toRefV31)({ ref: schema, refType: 'schema', context });
|
|
48
61
|
}
|
|
@@ -69,7 +82,7 @@ const toSchemaV3 = ({ schema, context, childOfComponents }) => {
|
|
|
69
82
|
// }
|
|
70
83
|
return context.trace('allOf', () => (0, toIntersection_js_1.toIntersection)({ value, members, context }));
|
|
71
84
|
})
|
|
72
|
-
.with({ type: 'object' }, value => (0, toObject_js_1.toObject)({ value, context
|
|
85
|
+
.with({ type: 'object' }, value => (0, toObject_js_1.toObject)({ value, context }))
|
|
73
86
|
.with({ type: 'array' }, value => (0, toArray_js_1.toArray)({ value, context }))
|
|
74
87
|
.with({ type: 'integer' }, value => (0, toInteger_js_1.toInteger)({ value, context }))
|
|
75
88
|
.with({ type: 'number' }, value => (0, toNumber_js_1.toNumber)({ value, context }))
|