@skmtc/core 0.0.444 → 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.
Files changed (33) hide show
  1. package/esm/context/ParseContext.d.ts +3 -1
  2. package/esm/context/ParseContext.d.ts.map +1 -1
  3. package/esm/context/ParseContext.js +11 -13
  4. package/esm/oas/components/toComponentsV3.d.ts.map +1 -1
  5. package/esm/oas/components/toComponentsV3.js +1 -1
  6. package/esm/oas/object/toObject.d.ts.map +1 -1
  7. package/esm/oas/object/toObject.js +2 -4
  8. package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
  9. package/esm/oas/operation/toOperationsV3.js +5 -1
  10. package/esm/oas/schema/toSchemasV3.d.ts +4 -2
  11. package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
  12. package/esm/oas/schema/toSchemasV3.js +18 -4
  13. package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts +4 -0
  14. package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts.map +1 -1
  15. package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.js +7 -4
  16. package/esm/oas/string/toString.js +3 -3
  17. package/package.json +1 -1
  18. package/script/context/ParseContext.d.ts +3 -1
  19. package/script/context/ParseContext.d.ts.map +1 -1
  20. package/script/context/ParseContext.js +11 -13
  21. package/script/oas/components/toComponentsV3.d.ts.map +1 -1
  22. package/script/oas/components/toComponentsV3.js +1 -1
  23. package/script/oas/object/toObject.d.ts.map +1 -1
  24. package/script/oas/object/toObject.js +2 -4
  25. package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
  26. package/script/oas/operation/toOperationsV3.js +5 -1
  27. package/script/oas/schema/toSchemasV3.d.ts +4 -2
  28. package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
  29. package/script/oas/schema/toSchemasV3.js +18 -4
  30. package/script/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts +4 -0
  31. package/script/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts.map +1 -1
  32. package/script/oas/specificationExtensions/toSpecificationExtensionsV3.js +10 -6
  33. package/script/oas/string/toString.js +3 -3
@@ -13,6 +13,7 @@ export type ParseReturn = {
13
13
  };
14
14
  type RegisterExtensionArgs = {
15
15
  type: string;
16
+ stackTrail: string[];
16
17
  extensionFields: Record<string, unknown>;
17
18
  };
18
19
  export declare class ParseContext {
@@ -20,11 +21,12 @@ export declare class ParseContext {
20
21
  schema: string;
21
22
  logger: log.Logger;
22
23
  oasDocument: OasDocument;
24
+ stackTrail: StackTrail;
23
25
  extentions: Record<string, unknown>;
24
26
  constructor({ schema, logger, stackTrail }: ConstructorArgs);
25
27
  parse(): OasDocument;
26
28
  trace<T>(token: string | string[], fn: () => T): T;
27
- registerExtension({ extensionFields, type }: RegisterExtensionArgs): void;
29
+ registerExtension({ extensionFields, stackTrail, type }: RegisterExtensionArgs): void;
28
30
  logSkippedFields(skipped: Record<string, unknown>): void;
29
31
  }
30
32
  export declare const parseSchema: (schema: string) => OpenAPIV3.Document<{}>;
@@ -1 +1 @@
1
- {"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,KAAK,qBA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AAA;CACpC,CAAA;AAED,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACzC,CAAA;AAED,qBAAa,YAAY;;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAEvB,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,eAAe;IAQ3D,KAAK;IAeL,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAiBlD,iBAAiB,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,qBAAqB,GAAG,IAAI;IAIrF,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAUlD;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,2BAMzC,CAAA"}
@@ -1,15 +1,9 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
1
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
2
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
5
  };
12
- var _ParseContext_instances, _ParseContext_stackTrail, _ParseContext_parseSchema, _ParseContext_parseDocument;
6
+ var _ParseContext_instances, _ParseContext_parseSchema, _ParseContext_parseDocument;
13
7
  import * as Sentry from '@sentry/deno';
14
8
  import { parse as parseYaml } from '../deps/jsr.io/@std/yaml/0.215.0/mod.js';
15
9
  import { toDocumentFieldsV3 } from '../oas/document/toDocumentFieldsV3.js';
@@ -37,7 +31,12 @@ export class ParseContext {
37
31
  writable: true,
38
32
  value: void 0
39
33
  });
40
- _ParseContext_stackTrail.set(this, void 0);
34
+ Object.defineProperty(this, "stackTrail", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: void 0
39
+ });
41
40
  Object.defineProperty(this, "extentions", {
42
41
  enumerable: true,
43
42
  configurable: true,
@@ -46,7 +45,7 @@ export class ParseContext {
46
45
  });
47
46
  this.schema = schema;
48
47
  this.logger = logger;
49
- __classPrivateFieldSet(this, _ParseContext_stackTrail, stackTrail, "f");
48
+ this.stackTrail = stackTrail;
50
49
  this.extentions = {};
51
50
  this.oasDocument = new OasDocument();
52
51
  }
@@ -55,10 +54,9 @@ export class ParseContext {
55
54
  return __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_parseDocument).call(this, documentObject);
56
55
  }
57
56
  trace(token, fn) {
58
- return tracer(__classPrivateFieldGet(this, _ParseContext_stackTrail, "f"), token, fn);
57
+ return tracer(this.stackTrail, token, fn);
59
58
  }
60
- registerExtension({ extensionFields, type }) {
61
- const { stackTrail } = __classPrivateFieldGet(this, _ParseContext_stackTrail, "f").slice(1);
59
+ registerExtension({ extensionFields, stackTrail, type }) {
62
60
  setWith(this.extentions, stackTrail.concat('__x__'), { type, extensionFields }, Object);
63
61
  }
64
62
  logSkippedFields(skipped) {
@@ -71,7 +69,7 @@ export class ParseContext {
71
69
  });
72
70
  }
73
71
  }
74
- _ParseContext_stackTrail = new WeakMap(), _ParseContext_instances = new WeakSet(), _ParseContext_parseSchema = function _ParseContext_parseSchema() {
72
+ _ParseContext_instances = new WeakSet(), _ParseContext_parseSchema = function _ParseContext_parseSchema() {
75
73
  const documentObject = Sentry.startSpan({ name: 'Parse string schema to object' }, () => parseSchema(this.schema));
76
74
  return documentObject;
77
75
  }, _ParseContext_parseDocument = function _ParseContext_parseDocument(documentObject) {
@@ -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,SAyC3D,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,9 +8,6 @@ export const toObject = ({ value, context }) => {
8
8
  skipped,
9
9
  context
10
10
  });
11
- if (extensionFields && Object.keys(extensionFields).length > 0) {
12
- context.registerExtension({ extensionFields, type: 'model' });
13
- }
14
11
  const fields = {
15
12
  title,
16
13
  description,
@@ -18,7 +15,8 @@ export const toObject = ({ value, context }) => {
18
15
  example,
19
16
  properties: context.trace('properties', () => toOptionalSchemasV3({
20
17
  schemas: properties,
21
- context
18
+ context,
19
+ childOfComponents: false
22
20
  })),
23
21
  required: required,
24
22
  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,YAmCtB,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"}
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,YAuCtB,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"}
@@ -10,7 +10,11 @@ export const toOperationV3 = ({ operation, operationInfo, context }) => {
10
10
  const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, ...skipped } = operation;
11
11
  const extensionFields = toSpecificationExtensionsV3({ skipped, context });
12
12
  if (extensionFields && Object.keys(extensionFields).length > 0) {
13
- context.registerExtension({ extensionFields, type: 'operation' });
13
+ context.registerExtension({
14
+ extensionFields,
15
+ type: 'operation',
16
+ stackTrail: ['operations', path, method]
17
+ });
14
18
  }
15
19
  return new OasOperation({
16
20
  pathItem,
@@ -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,yBAGr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AM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;IACrB,iBAAiB,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,WAAW,4CAIrB,eAAe,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAqB/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,EAAE,OAAO,CAAA;CAC3B,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"}
@@ -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
  };
@@ -7,9 +7,9 @@ export const toString = ({ value, context }) => {
7
7
  skipped,
8
8
  context
9
9
  });
10
- if (extensionFields && Object.keys(extensionFields).length > 0) {
11
- context.registerExtension({ extensionFields, type: 'string' });
12
- }
10
+ // if (extensionFields && Object.keys(extensionFields).length > 0) {
11
+ // context.registerExtension({ extensionFields, type: 'string' })
12
+ // }
13
13
  return new OasString({
14
14
  title,
15
15
  description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.444",
3
+ "version": "0.0.446",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -13,6 +13,7 @@ export type ParseReturn = {
13
13
  };
14
14
  type RegisterExtensionArgs = {
15
15
  type: string;
16
+ stackTrail: string[];
16
17
  extensionFields: Record<string, unknown>;
17
18
  };
18
19
  export declare class ParseContext {
@@ -20,11 +21,12 @@ export declare class ParseContext {
20
21
  schema: string;
21
22
  logger: log.Logger;
22
23
  oasDocument: OasDocument;
24
+ stackTrail: StackTrail;
23
25
  extentions: Record<string, unknown>;
24
26
  constructor({ schema, logger, stackTrail }: ConstructorArgs);
25
27
  parse(): OasDocument;
26
28
  trace<T>(token: string | string[], fn: () => T): T;
27
- registerExtension({ extensionFields, type }: RegisterExtensionArgs): void;
29
+ registerExtension({ extensionFields, stackTrail, type }: RegisterExtensionArgs): void;
28
30
  logSkippedFields(skipped: Record<string, unknown>): void;
29
31
  }
30
32
  export declare const parseSchema: (schema: string) => OpenAPIV3.Document<{}>;
@@ -1 +1 @@
1
- {"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAA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,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,KAAK,qBAAqB,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACzC,CAAA;AAED,qBAAa,YAAY;;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAEvB,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,eAAe;IAQ3D,KAAK;IAeL,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAiBlD,iBAAiB,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,qBAAqB,GAAG,IAAI;IAIrF,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAUlD;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,2BAMzC,CAAA"}
@@ -22,18 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
26
- if (kind === "m") throw new TypeError("Private method is not writable");
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
28
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
29
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
30
- };
31
25
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
32
26
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
33
27
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
34
28
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
35
29
  };
36
- var _ParseContext_instances, _ParseContext_stackTrail, _ParseContext_parseSchema, _ParseContext_parseDocument;
30
+ var _ParseContext_instances, _ParseContext_parseSchema, _ParseContext_parseDocument;
37
31
  Object.defineProperty(exports, "__esModule", { value: true });
38
32
  exports.parseSchema = exports.ParseContext = void 0;
39
33
  const Sentry = __importStar(require("@sentry/deno"));
@@ -63,7 +57,12 @@ class ParseContext {
63
57
  writable: true,
64
58
  value: void 0
65
59
  });
66
- _ParseContext_stackTrail.set(this, void 0);
60
+ Object.defineProperty(this, "stackTrail", {
61
+ enumerable: true,
62
+ configurable: true,
63
+ writable: true,
64
+ value: void 0
65
+ });
67
66
  Object.defineProperty(this, "extentions", {
68
67
  enumerable: true,
69
68
  configurable: true,
@@ -72,7 +71,7 @@ class ParseContext {
72
71
  });
73
72
  this.schema = schema;
74
73
  this.logger = logger;
75
- __classPrivateFieldSet(this, _ParseContext_stackTrail, stackTrail, "f");
74
+ this.stackTrail = stackTrail;
76
75
  this.extentions = {};
77
76
  this.oasDocument = new Document_js_1.OasDocument();
78
77
  }
@@ -81,10 +80,9 @@ class ParseContext {
81
80
  return __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_parseDocument).call(this, documentObject);
82
81
  }
83
82
  trace(token, fn) {
84
- return (0, tracer_js_1.tracer)(__classPrivateFieldGet(this, _ParseContext_stackTrail, "f"), token, fn);
83
+ return (0, tracer_js_1.tracer)(this.stackTrail, token, fn);
85
84
  }
86
- registerExtension({ extensionFields, type }) {
87
- const { stackTrail } = __classPrivateFieldGet(this, _ParseContext_stackTrail, "f").slice(1);
85
+ registerExtension({ extensionFields, stackTrail, type }) {
88
86
  (0, lodash_es_1.setWith)(this.extentions, stackTrail.concat('__x__'), { type, extensionFields }, Object);
89
87
  }
90
88
  logSkippedFields(skipped) {
@@ -98,7 +96,7 @@ class ParseContext {
98
96
  }
99
97
  }
100
98
  exports.ParseContext = ParseContext;
101
- _ParseContext_stackTrail = new WeakMap(), _ParseContext_instances = new WeakSet(), _ParseContext_parseSchema = function _ParseContext_parseSchema() {
99
+ _ParseContext_instances = new WeakSet(), _ParseContext_parseSchema = function _ParseContext_parseSchema() {
102
100
  const documentObject = Sentry.startSpan({ name: 'Parse string schema to object' }, () => (0, exports.parseSchema)(this.schema));
103
101
  return documentObject;
104
102
  }, _ParseContext_parseDocument = function _ParseContext_parseDocument(documentObject) {
@@ -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,SAyC3D,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,9 +11,6 @@ const toObject = ({ value, context }) => {
11
11
  skipped,
12
12
  context
13
13
  });
14
- if (extensionFields && Object.keys(extensionFields).length > 0) {
15
- context.registerExtension({ extensionFields, type: 'model' });
16
- }
17
14
  const fields = {
18
15
  title,
19
16
  description,
@@ -21,7 +18,8 @@ const toObject = ({ value, context }) => {
21
18
  example,
22
19
  properties: context.trace('properties', () => (0, toSchemasV3_js_1.toOptionalSchemasV3)({
23
20
  schemas: properties,
24
- context
21
+ context,
22
+ childOfComponents: false
25
23
  })),
26
24
  required: required,
27
25
  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,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M,aAAa,0CAIvB,iBAAiB,KAAG,YAuCtB,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"}
@@ -13,7 +13,11 @@ const toOperationV3 = ({ operation, operationInfo, context }) => {
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
15
  if (extensionFields && Object.keys(extensionFields).length > 0) {
16
- context.registerExtension({ extensionFields, type: 'operation' });
16
+ context.registerExtension({
17
+ extensionFields,
18
+ type: 'operation',
19
+ stackTrail: ['operations', path, method]
20
+ });
17
21
  }
18
22
  return new Operation_js_1.OasOperation({
19
23
  pathItem,
@@ -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,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAuC3F,CA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AED,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;
@@ -10,9 +10,9 @@ const toString = ({ value, context }) => {
10
10
  skipped,
11
11
  context
12
12
  });
13
- if (extensionFields && Object.keys(extensionFields).length > 0) {
14
- context.registerExtension({ extensionFields, type: 'string' });
15
- }
13
+ // if (extensionFields && Object.keys(extensionFields).length > 0) {
14
+ // context.registerExtension({ extensionFields, type: 'string' })
15
+ // }
16
16
  return new String_js_1.OasString({
17
17
  title,
18
18
  description,