@skmtc/core 0.0.445 → 0.0.446

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.
@@ -1 +1 @@
1
- {"version":3,"file":"toComponentsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/components/toComponentsV3.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI/C,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAA;IAClD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,aAAa,GAAG,SAgCvC,CAAA"}
1
+ {"version":3,"file":"toComponentsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/components/toComponentsV3.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI/C,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAA;IAClD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,aAAa,GAAG,SAkCvC,CAAA"}
@@ -13,7 +13,7 @@ export const toComponentsV3 = ({ components, context }) => {
13
13
  const { schemas, responses, parameters, examples, requestBodies, headers, ...skipped } = components;
14
14
  const extensionFields = toSpecificationExtensionsV3({ skipped, context });
15
15
  const fields = {
16
- schemas: context.trace('schemas', () => toOptionalSchemasV3({ schemas, context })),
16
+ schemas: context.trace('schemas', () => toOptionalSchemasV3({ schemas, context, childOfComponents: true })),
17
17
  responses: context.trace('responses', () => toOptionalResponsesV3({ responses, context })),
18
18
  parameters: context.trace('parameters', () => toOptionalParametersV3({
19
19
  parameters,
@@ -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;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,KAAG,SA+C3D,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,SAsC3D,CAAA"}
@@ -8,14 +8,6 @@ export const toObject = ({ value, context }) => {
8
8
  skipped,
9
9
  context
10
10
  });
11
- if (extensionFields && Object.keys(extensionFields).length > 0) {
12
- const last = context.stackTrail.stackTrail.slice(-1);
13
- context.registerExtension({
14
- extensionFields,
15
- type: 'model',
16
- stackTrail: ['models', last.toString()]
17
- });
18
- }
19
11
  const fields = {
20
12
  title,
21
13
  description,
@@ -23,7 +15,8 @@ export const toObject = ({ value, context }) => {
23
15
  example,
24
16
  properties: context.trace('properties', () => toOptionalSchemasV3({
25
17
  schemas: properties,
26
- context
18
+ context,
19
+ childOfComponents: false
27
20
  })),
28
21
  required: required,
29
22
  additionalProperties: context.trace('additionalProperties', () => toAdditionalPropertiesV3({ additionalProperties, context })),
@@ -5,13 +5,15 @@ import type { OasRef } from '../ref/Ref.js';
5
5
  type ToSchemasV3Args = {
6
6
  schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject>;
7
7
  context: ParseContext;
8
+ childOfComponents: boolean;
8
9
  };
9
- export declare const toSchemasV3: ({ schemas, context }: ToSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">>;
10
+ export declare const toSchemasV3: ({ schemas, context, childOfComponents }: ToSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">>;
10
11
  type ToOptionalSchemasV3Args = {
11
12
  schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject> | undefined;
12
13
  context: ParseContext;
14
+ childOfComponents: boolean;
13
15
  };
14
- export declare const toOptionalSchemasV3: ({ schemas, context }: ToOptionalSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">> | undefined;
16
+ export declare const toOptionalSchemasV3: ({ schemas, context, childOfComponents }: ToOptionalSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">> | undefined;
15
17
  type ToSchemaV3Args = {
16
18
  schema: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;
17
19
  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,KAA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M,kBAAkB,wBAG5B,sBAAsB,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAM1D,CAAA"}
@@ -10,16 +10,30 @@ import { toString } from '../string/toString.js';
10
10
  import { toUnknown } from '../unknown/toUnknown.js';
11
11
  import { toUnion } from '../union/toUnion.js';
12
12
  import { toIntersection } from '../intersection/toIntersection.js';
13
- export const toSchemasV3 = ({ schemas, context }) => {
13
+ import { extractExtensions } from '../specificationExtensions/toSpecificationExtensionsV3.js';
14
+ export const toSchemasV3 = ({ schemas, context, childOfComponents }) => {
14
15
  return Object.fromEntries(Object.entries(schemas).map(([key, schema]) => {
15
- return [key, context.trace(key, () => toSchemaV3({ schema, context }))];
16
+ return [
17
+ key,
18
+ context.trace(key, () => {
19
+ if (childOfComponents && !isRef(schema)) {
20
+ const { extensionFields } = extractExtensions(schema);
21
+ context.registerExtension({
22
+ extensionFields: extensionFields ?? {},
23
+ stackTrail: ['models', key],
24
+ type: 'schema'
25
+ });
26
+ }
27
+ return toSchemaV3({ schema, context });
28
+ })
29
+ ];
16
30
  }));
17
31
  };
18
- export const toOptionalSchemasV3 = ({ schemas, context }) => {
32
+ export const toOptionalSchemasV3 = ({ schemas, context, childOfComponents }) => {
19
33
  if (!schemas) {
20
34
  return undefined;
21
35
  }
22
- return toSchemasV3({ schemas, context });
36
+ return toSchemasV3({ schemas, context, childOfComponents });
23
37
  };
24
38
  export const toSchemaV3 = ({ schema, context }) => {
25
39
  if (isRef(schema)) {
@@ -4,5 +4,9 @@ type ToSpecificationExtensionsV3Args = {
4
4
  context: ParseContext;
5
5
  };
6
6
  export declare const toSpecificationExtensionsV3: ({ skipped: s, context }: ToSpecificationExtensionsV3Args) => Record<string, unknown> | undefined;
7
+ export declare const extractExtensions: (item: Record<string, unknown>) => {
8
+ skipped: Record<string, unknown>;
9
+ extensionFields: Record<string, unknown> | undefined;
10
+ };
7
11
  export {};
8
12
  //# sourceMappingURL=toSpecificationExtensionsV3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toSpecificationExtensionsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/specificationExtensions/toSpecificationExtensionsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,KAAK,+BAA+B,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,2BAA2B,4BAGrC,+BAA+B,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SA4B9D,CAAA"}
1
+ {"version":3,"file":"toSpecificationExtensionsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/specificationExtensions/toSpecificationExtensionsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,KAAK,+BAA+B,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,2BAA2B,4BAGrC,+BAA+B,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAM9D,CAAA;AAED,eAAO,MAAM,iBAAiB,SAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;aAElD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;qBACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;CAqBvD,CAAA"}
@@ -1,5 +1,10 @@
1
1
  export const toSpecificationExtensionsV3 = ({ skipped: s, context }) => {
2
- const { skipped, extensionFields } = Object.entries(s).reduce((acc, [key, value]) => {
2
+ const { skipped, extensionFields } = extractExtensions(s);
3
+ context.logSkippedFields(skipped);
4
+ return extensionFields;
5
+ };
6
+ export const extractExtensions = (item) => {
7
+ return Object.entries(item).reduce((acc, [key, value]) => {
3
8
  if (!key.startsWith('x-')) {
4
9
  return acc;
5
10
  }
@@ -12,7 +17,5 @@ export const toSpecificationExtensionsV3 = ({ skipped: s, context }) => {
12
17
  [key]: value
13
18
  }
14
19
  };
15
- }, { skipped: s, extensionFields: undefined });
16
- context.logSkippedFields(skipped);
17
- return extensionFields;
20
+ }, { skipped: item, extensionFields: undefined });
18
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.445",
3
+ "version": "0.0.446",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"toComponentsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/components/toComponentsV3.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI/C,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAA;IAClD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,aAAa,GAAG,SAgCvC,CAAA"}
1
+ {"version":3,"file":"toComponentsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/components/toComponentsV3.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAI/C,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAA;IAClD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,aAAa,GAAG,SAkCvC,CAAA"}
@@ -16,7 +16,7 @@ const toComponentsV3 = ({ components, context }) => {
16
16
  const { schemas, responses, parameters, examples, requestBodies, headers, ...skipped } = components;
17
17
  const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({ skipped, context });
18
18
  const fields = {
19
- schemas: context.trace('schemas', () => (0, toSchemasV3_js_1.toOptionalSchemasV3)({ schemas, context })),
19
+ schemas: context.trace('schemas', () => (0, toSchemasV3_js_1.toOptionalSchemasV3)({ schemas, context, childOfComponents: true })),
20
20
  responses: context.trace('responses', () => (0, toResponseV3_js_1.toOptionalResponsesV3)({ responses, context })),
21
21
  parameters: context.trace('parameters', () => (0, toParameterV3_js_1.toOptionalParametersV3)({
22
22
  parameters,
@@ -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;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,KAAG,SA+C3D,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,SAsC3D,CAAA"}
@@ -11,14 +11,6 @@ const toObject = ({ value, context }) => {
11
11
  skipped,
12
12
  context
13
13
  });
14
- if (extensionFields && Object.keys(extensionFields).length > 0) {
15
- const last = context.stackTrail.stackTrail.slice(-1);
16
- context.registerExtension({
17
- extensionFields,
18
- type: 'model',
19
- stackTrail: ['models', last.toString()]
20
- });
21
- }
22
14
  const fields = {
23
15
  title,
24
16
  description,
@@ -26,7 +18,8 @@ const toObject = ({ value, context }) => {
26
18
  example,
27
19
  properties: context.trace('properties', () => (0, toSchemasV3_js_1.toOptionalSchemasV3)({
28
20
  schemas: properties,
29
- context
21
+ context,
22
+ childOfComponents: false
30
23
  })),
31
24
  required: required,
32
25
  additionalProperties: context.trace('additionalProperties', () => (0, toAdditionalPropertiesV3_js_1.toAdditionalPropertiesV3)({ additionalProperties, context })),
@@ -5,13 +5,15 @@ import type { OasRef } from '../ref/Ref.js';
5
5
  type ToSchemasV3Args = {
6
6
  schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject>;
7
7
  context: ParseContext;
8
+ childOfComponents: boolean;
8
9
  };
9
- export declare const toSchemasV3: ({ schemas, context }: ToSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">>;
10
+ export declare const toSchemasV3: ({ schemas, context, childOfComponents }: ToSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">>;
10
11
  type ToOptionalSchemasV3Args = {
11
12
  schemas: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject> | undefined;
12
13
  context: ParseContext;
14
+ childOfComponents: boolean;
13
15
  };
14
- export declare const toOptionalSchemasV3: ({ schemas, context }: ToOptionalSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">> | undefined;
16
+ export declare const toOptionalSchemasV3: ({ schemas, context, childOfComponents }: ToOptionalSchemasV3Args) => Record<string, OasSchema | OasRef<"schema">> | undefined;
15
17
  type ToSchemaV3Args = {
16
18
  schema: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;
17
19
  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;AAW3C,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,yBAGrB,eAAe,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAM/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;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,yBAG7B,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,KA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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"}
@@ -13,17 +13,31 @@ const toString_js_1 = require("../string/toString.js");
13
13
  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
- const toSchemasV3 = ({ schemas, context }) => {
16
+ const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
17
+ const toSchemasV3 = ({ schemas, context, childOfComponents }) => {
17
18
  return Object.fromEntries(Object.entries(schemas).map(([key, schema]) => {
18
- return [key, context.trace(key, () => (0, exports.toSchemaV3)({ schema, context }))];
19
+ return [
20
+ key,
21
+ context.trace(key, () => {
22
+ if (childOfComponents && !(0, refFns_js_1.isRef)(schema)) {
23
+ const { extensionFields } = (0, toSpecificationExtensionsV3_js_1.extractExtensions)(schema);
24
+ context.registerExtension({
25
+ extensionFields: extensionFields ?? {},
26
+ stackTrail: ['models', key],
27
+ type: 'schema'
28
+ });
29
+ }
30
+ return (0, exports.toSchemaV3)({ schema, context });
31
+ })
32
+ ];
19
33
  }));
20
34
  };
21
35
  exports.toSchemasV3 = toSchemasV3;
22
- const toOptionalSchemasV3 = ({ schemas, context }) => {
36
+ const toOptionalSchemasV3 = ({ schemas, context, childOfComponents }) => {
23
37
  if (!schemas) {
24
38
  return undefined;
25
39
  }
26
- return (0, exports.toSchemasV3)({ schemas, context });
40
+ return (0, exports.toSchemasV3)({ schemas, context, childOfComponents });
27
41
  };
28
42
  exports.toOptionalSchemasV3 = toOptionalSchemasV3;
29
43
  const toSchemaV3 = ({ schema, context }) => {
@@ -4,5 +4,9 @@ type ToSpecificationExtensionsV3Args = {
4
4
  context: ParseContext;
5
5
  };
6
6
  export declare const toSpecificationExtensionsV3: ({ skipped: s, context }: ToSpecificationExtensionsV3Args) => Record<string, unknown> | undefined;
7
+ export declare const extractExtensions: (item: Record<string, unknown>) => {
8
+ skipped: Record<string, unknown>;
9
+ extensionFields: Record<string, unknown> | undefined;
10
+ };
7
11
  export {};
8
12
  //# sourceMappingURL=toSpecificationExtensionsV3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toSpecificationExtensionsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/specificationExtensions/toSpecificationExtensionsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,KAAK,+BAA+B,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,2BAA2B,4BAGrC,+BAA+B,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SA4B9D,CAAA"}
1
+ {"version":3,"file":"toSpecificationExtensionsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/specificationExtensions/toSpecificationExtensionsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,KAAK,+BAA+B,GAAG;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,2BAA2B,4BAGrC,+BAA+B,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAM9D,CAAA;AAED,eAAO,MAAM,iBAAiB,SAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;aAElD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;qBACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;CAqBvD,CAAA"}
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toSpecificationExtensionsV3 = void 0;
3
+ exports.extractExtensions = exports.toSpecificationExtensionsV3 = void 0;
4
4
  const toSpecificationExtensionsV3 = ({ skipped: s, context }) => {
5
- const { skipped, extensionFields } = Object.entries(s).reduce((acc, [key, value]) => {
5
+ const { skipped, extensionFields } = (0, exports.extractExtensions)(s);
6
+ context.logSkippedFields(skipped);
7
+ return extensionFields;
8
+ };
9
+ exports.toSpecificationExtensionsV3 = toSpecificationExtensionsV3;
10
+ const extractExtensions = (item) => {
11
+ return Object.entries(item).reduce((acc, [key, value]) => {
6
12
  if (!key.startsWith('x-')) {
7
13
  return acc;
8
14
  }
@@ -15,8 +21,6 @@ const toSpecificationExtensionsV3 = ({ skipped: s, context }) => {
15
21
  [key]: value
16
22
  }
17
23
  };
18
- }, { skipped: s, extensionFields: undefined });
19
- context.logSkippedFields(skipped);
20
- return extensionFields;
24
+ }, { skipped: item, extensionFields: undefined });
21
25
  };
22
- exports.toSpecificationExtensionsV3 = toSpecificationExtensionsV3;
26
+ exports.extractExtensions = extractExtensions;