@skmtc/core 0.0.613 → 0.0.614

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 (65) hide show
  1. package/esm/context/CoreContext.js +1 -1
  2. package/esm/context/ParseContext.d.ts +35 -15
  3. package/esm/context/ParseContext.d.ts.map +1 -1
  4. package/esm/context/ParseContext.js +62 -11
  5. package/esm/context/StackTrail.d.ts +3 -0
  6. package/esm/context/StackTrail.d.ts.map +1 -1
  7. package/esm/context/StackTrail.js +20 -0
  8. package/esm/context/types.d.ts +1 -1
  9. package/esm/context/types.d.ts.map +1 -1
  10. package/esm/oas/components/Components.d.ts +2 -0
  11. package/esm/oas/components/Components.d.ts.map +1 -1
  12. package/esm/oas/components/Components.js +14 -0
  13. package/esm/oas/document/Document.d.ts +4 -0
  14. package/esm/oas/document/Document.d.ts.map +1 -1
  15. package/esm/oas/document/Document.js +22 -0
  16. package/esm/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
  17. package/esm/oas/document/toDocumentFieldsV3.js +1 -2
  18. package/esm/oas/integer/toInteger.d.ts +1 -1
  19. package/esm/oas/integer/toInteger.d.ts.map +1 -1
  20. package/esm/oas/integer/toInteger.js +8 -3
  21. package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
  22. package/esm/oas/operation/toOperationsV3.js +5 -2
  23. package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
  24. package/esm/oas/parameter/toParameterV3.js +16 -2
  25. package/esm/oas/ref/toRefV31.d.ts.map +1 -1
  26. package/esm/oas/ref/toRefV31.js +3 -3
  27. package/esm/oas/response/toResponseV3.d.ts.map +1 -1
  28. package/esm/oas/response/toResponseV3.js +5 -2
  29. package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
  30. package/esm/oas/schema/toSchemasV3.js +13 -6
  31. package/esm/oas/string/toString.d.ts.map +1 -1
  32. package/esm/oas/string/toString.js +2 -1
  33. package/package.json +1 -1
  34. package/script/context/CoreContext.js +1 -1
  35. package/script/context/ParseContext.d.ts +35 -15
  36. package/script/context/ParseContext.d.ts.map +1 -1
  37. package/script/context/ParseContext.js +62 -11
  38. package/script/context/StackTrail.d.ts +3 -0
  39. package/script/context/StackTrail.d.ts.map +1 -1
  40. package/script/context/StackTrail.js +20 -0
  41. package/script/context/types.d.ts +1 -1
  42. package/script/context/types.d.ts.map +1 -1
  43. package/script/oas/components/Components.d.ts +2 -0
  44. package/script/oas/components/Components.d.ts.map +1 -1
  45. package/script/oas/components/Components.js +15 -1
  46. package/script/oas/document/Document.d.ts +4 -0
  47. package/script/oas/document/Document.d.ts.map +1 -1
  48. package/script/oas/document/Document.js +22 -0
  49. package/script/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
  50. package/script/oas/document/toDocumentFieldsV3.js +1 -2
  51. package/script/oas/integer/toInteger.d.ts +1 -1
  52. package/script/oas/integer/toInteger.d.ts.map +1 -1
  53. package/script/oas/integer/toInteger.js +8 -3
  54. package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
  55. package/script/oas/operation/toOperationsV3.js +8 -2
  56. package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
  57. package/script/oas/parameter/toParameterV3.js +19 -2
  58. package/script/oas/ref/toRefV31.d.ts.map +1 -1
  59. package/script/oas/ref/toRefV31.js +3 -3
  60. package/script/oas/response/toResponseV3.d.ts.map +1 -1
  61. package/script/oas/response/toResponseV3.js +8 -2
  62. package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
  63. package/script/oas/schema/toSchemasV3.js +16 -6
  64. package/script/oas/string/toString.d.ts.map +1 -1
  65. package/script/oas/string/toString.js +2 -1
@@ -71,7 +71,7 @@ export class CoreContext {
71
71
  __classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, documentObject), "f");
72
72
  return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
73
73
  });
74
- const { files, previews, schemaOptions } = this.trace('toArtifacts', () => {
74
+ const { files, previews, schemaOptions } = this.trace('generate', () => {
75
75
  __classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
76
76
  toGeneratorConfigMap,
77
77
  oasDocument,
@@ -4,7 +4,7 @@ import { OasDocument } from '../oas/document/Document.js';
4
4
  import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
5
5
  import type { StackTrail } from './StackTrail.js';
6
6
  import * as v from 'valibot';
7
- import type { WarningType } from './types.js';
7
+ import type { IssueType } from './types.js';
8
8
  type ConstructorArgs = {
9
9
  documentObject: OpenAPIV3.Document;
10
10
  logger: log.Logger;
@@ -13,18 +13,25 @@ type ConstructorArgs = {
13
13
  };
14
14
  export type ParseReturn = {
15
15
  oasDocument: OasDocument;
16
- warnings: ParseWarning[];
16
+ issues: ParseIssue[];
17
17
  };
18
- export type LogWarningArgs = {
18
+ type ParseWarningBase = {
19
+ level: 'warning';
20
+ message: string;
21
+ };
22
+ type ParseErrorBase = {
23
+ level: 'error';
24
+ error: Error;
25
+ };
26
+ type ParseIssueBase = ParseErrorBase | ParseWarningBase;
27
+ export type LogIssueArgs = ParseIssueBase & {
19
28
  key: string;
20
29
  parent: unknown;
21
- message: string;
22
- type: WarningType;
30
+ type: IssueType;
23
31
  };
24
- export type LogWarningNoKeyArgs = {
32
+ export type LogIssueNoKeyArgs = ParseIssueBase & {
25
33
  parent: unknown;
26
- message: string;
27
- type: WarningType;
34
+ type: IssueType;
28
35
  };
29
36
  export type ProvisionalParseArgs<T> = {
30
37
  key: string;
@@ -32,33 +39,46 @@ export type ProvisionalParseArgs<T> = {
32
39
  parent: unknown;
33
40
  schema: v.GenericSchema<T>;
34
41
  toMessage: (value: unknown) => string;
35
- type: WarningType;
42
+ type: IssueType;
36
43
  };
37
44
  export type LogSkippedValuesArgs = {
38
45
  skipped: Record<string, unknown>;
39
46
  parent: unknown;
40
47
  parentType: string;
41
48
  };
42
- type ParseWarning = {
49
+ export type ParseError = {
50
+ level: 'error';
51
+ error: Error;
52
+ location: string;
53
+ parent: unknown;
54
+ type: IssueType;
55
+ };
56
+ export type ParseWarning = {
57
+ level: 'warning';
43
58
  message: string;
44
- location: StackTrail;
59
+ location: string;
45
60
  parent: unknown;
46
- type: WarningType;
61
+ type: IssueType;
47
62
  };
63
+ export type ParseIssue = ParseError | ParseWarning;
48
64
  export declare class ParseContext {
65
+ #private;
49
66
  documentObject: OpenAPIV3.Document;
50
67
  logger: log.Logger;
51
68
  oasDocument: OasDocument;
52
69
  stackTrail: StackTrail;
53
- warnings: ParseWarning[];
70
+ issues: ParseIssue[];
54
71
  silent: boolean;
55
72
  constructor({ documentObject, logger, stackTrail, silent }: ConstructorArgs);
56
73
  parse(): OasDocument;
74
+ removeErroredItems(): void;
75
+ registerRef(stackTrail: StackTrail, $ref: string): void;
76
+ registerRefError(error: Error, $ref: string | undefined): void;
57
77
  trace<T>(token: string | string[], fn: () => T): T;
58
78
  logSkippedFields({ skipped, parent, parentType }: LogSkippedValuesArgs): void;
59
79
  provisionalParse<T>({ key, value, parent, schema, toMessage, type }: ProvisionalParseArgs<T>): T | undefined;
60
- logWarning({ key, parent, message, type }: LogWarningArgs): void;
61
- logWarningNoKey({ parent, message, type }: LogWarningNoKeyArgs): void;
80
+ logIssue({ key, parent, type, ...issue }: LogIssueArgs): void;
81
+ logIssueNoKey({ parent, type, ...issue }: LogIssueNoKeyArgs): void;
62
82
  }
63
83
  export declare const parseSchema: (schema: string) => OpenAPIV3.Document<{}>;
64
84
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,KAAK,GAAG,MAAM,wCA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;IAIlD,gBAAgB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,oBAAoB;IAYtE,gBAAgB,CAAC,CAAC,EAAE,EAClB,GAAG,EACH,KAAK,EACL,MAAM,EACN,MAAM,EACN,SAAS,EACT,IAAI,EACL,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAgB1C,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY;IAItD,aAAa,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB;CAqB5D;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,2BAMzC,CAAA"}
@@ -1,3 +1,15 @@
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
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ 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
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _ParseContext_refStackTrails, _ParseContext_refErrors;
1
13
  import "../_dnt.polyfills.js";
2
14
  import { parse as parseYaml } from '../deps/jsr.io/@std/yaml/1.0.5/mod.js';
3
15
  import { toDocumentFieldsV3 } from '../oas/document/toDocumentFieldsV3.js';
@@ -30,7 +42,7 @@ export class ParseContext {
30
42
  writable: true,
31
43
  value: void 0
32
44
  });
33
- Object.defineProperty(this, "warnings", {
45
+ Object.defineProperty(this, "issues", {
34
46
  enumerable: true,
35
47
  configurable: true,
36
48
  writable: true,
@@ -42,28 +54,62 @@ export class ParseContext {
42
54
  writable: true,
43
55
  value: void 0
44
56
  });
57
+ _ParseContext_refStackTrails.set(this, void 0);
58
+ _ParseContext_refErrors.set(this, void 0);
45
59
  this.documentObject = documentObject;
46
60
  this.logger = logger;
47
61
  this.stackTrail = stackTrail;
48
62
  this.oasDocument = new OasDocument();
49
63
  this.silent = silent;
50
- this.warnings = [];
64
+ this.issues = [];
65
+ __classPrivateFieldSet(this, _ParseContext_refStackTrails, {}, "f");
66
+ __classPrivateFieldSet(this, _ParseContext_refErrors, {}, "f");
51
67
  }
52
68
  parse() {
53
69
  this.oasDocument.fields = toDocumentFieldsV3({
54
70
  documentObject: this.documentObject,
55
71
  context: this
56
72
  });
73
+ this.removeErroredItems();
57
74
  return this.oasDocument;
58
75
  }
76
+ removeErroredItems() {
77
+ Object.entries(__classPrivateFieldGet(this, _ParseContext_refErrors, "f")).forEach(([$ref, errors]) => {
78
+ errors.forEach(error => {
79
+ __classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref]?.forEach(stackTrail => {
80
+ const removed = this.oasDocument.removeItem(stackTrail);
81
+ if (removed) {
82
+ this.issues.push({
83
+ level: 'error',
84
+ error,
85
+ location: stackTrail.toString(),
86
+ parent: removed,
87
+ type: 'INVALID_DEPENDENCY_REF'
88
+ });
89
+ }
90
+ });
91
+ });
92
+ });
93
+ }
94
+ registerRef(stackTrail, $ref) {
95
+ const refStackTrails = __classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref];
96
+ refStackTrails ? refStackTrails.push(stackTrail) : (__classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref] = [stackTrail]);
97
+ }
98
+ registerRefError(error, $ref) {
99
+ if ($ref) {
100
+ const refErrors = __classPrivateFieldGet(this, _ParseContext_refErrors, "f")[$ref];
101
+ refErrors ? refErrors.push(error) : (__classPrivateFieldGet(this, _ParseContext_refErrors, "f")[$ref] = [error]);
102
+ }
103
+ }
59
104
  trace(token, fn) {
60
105
  return tracer(this.stackTrail, token, fn);
61
106
  }
62
107
  logSkippedFields({ skipped, parent, parentType }) {
63
108
  Object.keys(skipped).forEach(key => {
64
- this.logWarning({
109
+ this.logIssue({
65
110
  key,
66
111
  parent,
112
+ level: 'warning',
67
113
  message: `Unexpected property '${key}' in '${parentType}'`,
68
114
  type: 'UNEXPECTED_PROPERTY'
69
115
  });
@@ -74,33 +120,38 @@ export class ParseContext {
74
120
  if (parsed.success) {
75
121
  return parsed.output;
76
122
  }
77
- this.logWarning({
123
+ this.logIssue({
78
124
  key,
79
125
  parent,
126
+ level: 'warning',
80
127
  message: toMessage(value),
81
128
  type
82
129
  });
83
130
  }
84
- logWarning({ key, parent, message, type }) {
85
- this.trace(key, () => this.logWarningNoKey({ parent, message, type }));
131
+ logIssue({ key, parent, type, ...issue }) {
132
+ this.trace(key, () => this.logIssueNoKey({ parent, type, ...issue }));
86
133
  }
87
- logWarningNoKey({ parent, message, type }) {
88
- this.warnings.push({
89
- message,
90
- location: this.stackTrail.clone(),
134
+ logIssueNoKey({ parent, type, ...issue }) {
135
+ if (issue.level === 'error') {
136
+ this.registerRefError(issue.error, this.stackTrail.toStackRef());
137
+ }
138
+ this.issues.push({
139
+ ...issue,
140
+ location: this.stackTrail.toString(),
91
141
  parent,
92
142
  type
93
143
  });
94
144
  if (!this.silent) {
95
145
  this.logger.warn({
146
+ ...issue,
96
147
  location: this.stackTrail.toString(),
97
148
  parent: JSON.stringify(parent),
98
- message,
99
149
  type
100
150
  });
101
151
  }
102
152
  }
103
153
  }
154
+ _ParseContext_refStackTrails = new WeakMap(), _ParseContext_refErrors = new WeakMap();
104
155
  export const parseSchema = (schema) => {
105
156
  if (schema.trimStart().startsWith('{')) {
106
157
  return JSON.parse(schema);
@@ -4,12 +4,15 @@ export declare class StackTrail {
4
4
  constructor(stack?: (string | number)[]);
5
5
  clone(): StackTrail;
6
6
  slice(start: number, end?: number): StackTrail;
7
+ includes(frames: string[]): boolean;
7
8
  get stackTrail(): (string | number)[];
8
9
  append(frame: string | string[]): StackTrail;
9
10
  getParentOf(frame: string): string | undefined;
11
+ toStackRef(): string | undefined;
10
12
  remove(frame: string | string[]): StackTrail;
11
13
  static join(...stacks: (StackTrail | string)[]): string;
12
14
  static parse(value: string): StackTrail;
15
+ toJSON(): string;
13
16
  toString(): string;
14
17
  }
15
18
  //# sourceMappingURL=StackTrail.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,qBAAa,UAAU;;gBAGT,KAAK,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO;IAI3C,KAAK;IAIL,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAIjC,IAAI,UAAU,wBAEb;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAW9C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC,QAAQ;CAOT"}
1
+ {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAG9B,qBAAa,UAAU;;gBAGT,KAAK,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO;IAI3C,KAAK;IAIL,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAIjC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE;IAIzB,IAAI,UAAU,wBAEb;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAW9C,UAAU,IAAI,MAAM,GAAG,SAAS;IAkBhC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC,MAAM;IAIN,QAAQ;CAOT"}
@@ -11,6 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _StackTrail_stack;
13
13
  import "../_dnt.polyfills.js";
14
+ import { componentsKeys } from '../oas/components/Components.js';
14
15
  export class StackTrail {
15
16
  constructor(stack = []) {
16
17
  _StackTrail_stack.set(this, void 0);
@@ -22,6 +23,9 @@ export class StackTrail {
22
23
  slice(start, end) {
23
24
  return new StackTrail(__classPrivateFieldGet(this, _StackTrail_stack, "f").slice(start, end));
24
25
  }
26
+ includes(frames) {
27
+ return frames.every(frame => __classPrivateFieldGet(this, _StackTrail_stack, "f").includes(frame));
28
+ }
25
29
  get stackTrail() {
26
30
  return __classPrivateFieldGet(this, _StackTrail_stack, "f");
27
31
  }
@@ -44,6 +48,19 @@ export class StackTrail {
44
48
  return typeof parentName === 'string' ? parentName : undefined;
45
49
  }
46
50
  }
51
+ toStackRef() {
52
+ const [first, second, third] = this.stackTrail;
53
+ if (first !== 'components') {
54
+ return;
55
+ }
56
+ if (typeof second !== 'string' || !componentsKeys.includes(second)) {
57
+ return;
58
+ }
59
+ if (typeof third !== 'string') {
60
+ return;
61
+ }
62
+ return `#/${first}/${second}/${third}`;
63
+ }
47
64
  remove(frame) {
48
65
  if (typeof frame === 'string') {
49
66
  const lastItem = __classPrivateFieldGet(this, _StackTrail_stack, "f")[__classPrivateFieldGet(this, _StackTrail_stack, "f").length - 1];
@@ -71,6 +88,9 @@ export class StackTrail {
71
88
  });
72
89
  return new StackTrail(stack);
73
90
  }
91
+ toJSON() {
92
+ return this.toString();
93
+ }
74
94
  toString() {
75
95
  return __classPrivateFieldGet(this, _StackTrail_stack, "f")
76
96
  .map(item => {
@@ -23,5 +23,5 @@ export type RenderResult = {
23
23
  results: Record<string, ResultType>;
24
24
  };
25
25
  export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3_1.Document;
26
- export type WarningType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA';
26
+ export type IssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_DEPENDENCY_REF';
27
27
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.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AAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,aAAa,EAAE,YAAY,EAAE,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;AAE3F,MAAM,MAAM,SAAS,GACjB,qBAAqB,GACrB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,wBAAwB,CAAA"}
@@ -9,6 +9,7 @@ import type { OasRef } from '../ref/Ref.js';
9
9
  import type { OasSchema } from '../schema/Schema.js';
10
10
  import type { RefName } from '../../types/RefName.js';
11
11
  import type { OasSecurityScheme } from '../securitySchemes/SecurityScheme.js';
12
+ export declare const componentsKeys: string[];
12
13
  export type ComponentsFields = {
13
14
  schemas?: Record<RefName, OasSchema | OasRef<'schema'>>;
14
15
  responses?: Record<RefName, OasResponse | OasRef<'response'>>;
@@ -31,6 +32,7 @@ export declare class OasComponents {
31
32
  toSchemasRefNames(): RefName[];
32
33
  /** Record holding re-usable {@link OasSchema} objects or Refs */
33
34
  get schemas(): Record<RefName, OasSchema | OasRef<'schema'>> | undefined;
35
+ removeSchema(refName: RefName): OasSchema | OasRef<'schema'>;
34
36
  /** Record holding re-usable {@link OasResponse} objects or Refs */
35
37
  get responses(): Record<RefName, OasResponse | OasRef<'response'>> | undefined;
36
38
  /** Record holding re-usable {@link OasParameter} objects or Refs */
@@ -1 +1 @@
1
- {"version":3,"file":"Components.d.ts","sourceRoot":"","sources":["../../../src/oas/components/Components.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,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M,EAAE,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,GAAG,SAAS,CAE9F;IAED,qCAAqC;IACrC,IAAI,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEzD;CACF"}
@@ -12,6 +12,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _OasComponents_fields;
13
13
  import "../../_dnt.polyfills.js";
14
14
  import "../../_dnt.polyfills.js";
15
+ export const componentsKeys = [
16
+ 'schemas',
17
+ 'responses',
18
+ 'parameters',
19
+ 'examples',
20
+ 'requestBodies',
21
+ 'headers',
22
+ 'securitySchemes'
23
+ ];
15
24
  /** Container object for re-usable schema items within the API
16
25
  *
17
26
  * Fields not yet implemented: **securitySchemes**, **links**, **callbacks**
@@ -36,6 +45,11 @@ export class OasComponents {
36
45
  get schemas() {
37
46
  return __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas;
38
47
  }
48
+ removeSchema(refName) {
49
+ const { [refName]: removed, ...rest } = __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas;
50
+ __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas = rest;
51
+ return removed;
52
+ }
39
53
  /** Record holding re-usable {@link OasResponse} objects or Refs */
40
54
  get responses() {
41
55
  return __classPrivateFieldGet(this, _OasComponents_fields, "f").responses;
@@ -5,6 +5,9 @@ import type { OasOperation } from '../operation/Operation.js';
5
5
  import type { OasInfo } from '../info/Info.js';
6
6
  import type { OasServer } from '../server/Server.js';
7
7
  import type { OasSecurityRequirement } from '../securityRequirement/SecurityRequirement.js';
8
+ import type { StackTrail } from '../../context/StackTrail.js';
9
+ import type { OasSchema } from '../schema/Schema.js';
10
+ import type { OasRef } from '../ref/Ref.js';
8
11
  export type DocumentFields = {
9
12
  openapi: string;
10
13
  info: OasInfo;
@@ -21,6 +24,7 @@ export declare class OasDocument {
21
24
  /** Static identifier property for OasDocument */
22
25
  oasType: 'openapi';
23
26
  constructor(fields?: DocumentFields);
27
+ removeItem(stackTrail: StackTrail): OasOperation | OasSchema | OasRef<'schema'> | undefined;
24
28
  set fields(fields: DocumentFields);
25
29
  /** OpenAPI specification version */
26
30
  get openapi(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"Document.d.ts","sourceRoot":"","sources":["../../../src/oas/document/Document.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAA;AAE3F,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,SAAS,CAAA;IACjC,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACtC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,sBAAsB,EAAE,GAAG,SAAS,CAAA;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,mDAAmD;AACnD,qBAAa,WAAW;;IACtB,iDAAiD;IACjD,OAAO,EAAE,SAAS,CAAY;gBAIlB,MAAM,CAAC,EAAE,cAAc;IAInC,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,EAEhC;IAED,oCAAoC;IACpC,IAAI,OAAO,IAAI,MAAM,CAMpB;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AU,EAAE,YAAY,EAAE,CAAA;IAC1B,UAAU,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACtC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,sBAAsB,EAAE,GAAG,SAAS,CAAA;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,mDAAmD;AACnD,qBAAa,WAAW;;IACtB,iDAAiD;IACjD,OAAO,EAAE,SAAS,CAAY;gBAIlB,MAAM,CAAC,EAAE,cAAc;IAInC,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IA6B3F,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,EAEhC;IAED,oCAAoC;IACpC,IAAI,OAAO,IAAI,MAAM,CAMpB;IAED,mBAAmB;IACnB,IAAI,IAAI,IAAI,OAAO,CAMlB;IAED,IAAI,OAAO,IAAI,SAAS,EAAE,GAAG,SAAS,CAMrC;IAED,yCAAyC;IACzC,IAAI,UAAU,IAAI,YAAY,EAAE,CAM/B;IAED,iEAAiE;IACjE,IAAI,UAAU,IAAI,aAAa,GAAG,SAAS,CAM1C;IAED,wDAAwD;IACxD,IAAI,IAAI,IAAI,MAAM,EAAE,GAAG,SAAS,CAM/B;IAED,gDAAgD;IAChD,IAAI,QAAQ,IAAI,sBAAsB,EAAE,GAAG,SAAS,CAMnD;IAED,qCAAqC;IACrC,IAAI,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAMzD;CACF"}
@@ -11,6 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _OasDocument_fields;
13
13
  import "../../_dnt.polyfills.js";
14
+ import { match } from 'ts-pattern';
14
15
  /** Top level document object describing the API */
15
16
  export class OasDocument {
16
17
  constructor(fields) {
@@ -25,6 +26,27 @@ export class OasDocument {
25
26
  _OasDocument_fields.set(this, void 0);
26
27
  __classPrivateFieldSet(this, _OasDocument_fields, fields, "f");
27
28
  }
29
+ removeItem(stackTrail) {
30
+ const [first, second, third] = stackTrail.stackTrail;
31
+ return match(first)
32
+ .with('paths', () => {
33
+ const index = __classPrivateFieldGet(this, _OasDocument_fields, "f").operations.findIndex(({ path, method }) => path === second && method === third);
34
+ if (index === -1) {
35
+ return undefined;
36
+ }
37
+ const [removed] = __classPrivateFieldGet(this, _OasDocument_fields, "f").operations.splice(index, 1);
38
+ return removed;
39
+ })
40
+ .with('components', () => {
41
+ if (typeof third !== 'string') {
42
+ throw new Error(`RefName cannot be a number: ${third}`);
43
+ }
44
+ return __classPrivateFieldGet(this, _OasDocument_fields, "f").components.removeSchema(third);
45
+ })
46
+ .otherwise(() => {
47
+ throw new Error(`Unexpected stack trail: ${stackTrail}`);
48
+ });
49
+ }
28
50
  set fields(fields) {
29
51
  __classPrivateFieldSet(this, _OasDocument_fields, fields, "f");
30
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"toDocumentFieldsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/document/toDocumentFieldsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAKjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,KAAK,gBAAgB,GAAG;IACtB,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,gCAG5B,gBAAgB,KAAG,cAsBrB,CAAA"}
1
+ {"version":3,"file":"toDocumentFieldsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/document/toDocumentFieldsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAKjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,KAAK,gBAAgB,GAAG;IACtB,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,gCAG5B,gBAAgB,KAAG,cAoBrB,CAAA"}
@@ -13,7 +13,7 @@ export const toDocumentFieldsV3 = ({ documentObject, context }) => {
13
13
  context,
14
14
  parentType: 'document'
15
15
  });
16
- const fields = {
16
+ return {
17
17
  openapi,
18
18
  info: context.trace('info', () => toInfoV3({ info, context })),
19
19
  servers: context.trace('servers', () => toOptionalServersV3({ servers, context })),
@@ -23,5 +23,4 @@ export const toDocumentFieldsV3 = ({ documentObject, context }) => {
23
23
  security: context.trace('security', () => toSecurityRequirementsV3({ security, context })),
24
24
  extensionFields
25
25
  };
26
- return fields;
27
26
  };
@@ -13,6 +13,6 @@ type ToParsedIntegerArgs<Nullable extends boolean | undefined> = {
13
13
  example: Nullable extends true ? number | null | undefined : number | undefined;
14
14
  enums: Nullable extends true ? (number | null)[] | undefined : number[] | undefined;
15
15
  };
16
- export declare const toParsedInteger: <Nullable extends boolean | undefined>({ context, nullable, example, enums, value }: ToParsedIntegerArgs<Nullable>) => OasInteger<Nullable>;
16
+ export declare const toParsedInteger: <Nullable extends boolean | undefined>({ context, nullable, example, enums, value: valueWithoutEnums }: ToParsedIntegerArgs<Nullable>) => OasInteger<Nullable>;
17
17
  export {};
18
18
  //# sourceMappingURL=toInteger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toInteger.d.ts","sourceRoot":"","sources":["../../../src/oas/integer/toInteger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,E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,uBAAwB,aAAa,KAAG,UA2B7D,CAAA;AAED,KAAK,mBAAmB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC/D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAA;IACrE,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;IAC/E,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;CACpF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,mEAMjE,mBAAmB,CAAC,QAAQ,CAAC,KAAG,UAAU,CAAC,QAAQ,CA2CrD,CAAA"}
@@ -30,11 +30,16 @@ export const toInteger = ({ value, context }) => {
30
30
  value: valueWithoutEnums
31
31
  });
32
32
  };
33
- export const toParsedInteger = ({ context, nullable, example, enums, value }) => {
34
- const { type: _type, title, description, default: defaultValue, format, multipleOf, maximum, exclusiveMaximum, minimum, exclusiveMinimum, ...skipped } = v.parse(oasIntegerData, value);
33
+ export const toParsedInteger = ({ context, nullable, example, enums, value: valueWithoutEnums }) => {
34
+ // const { format, value: valueWithoutFormat } = parseFormat({
35
+ // value: valueWithoutEnums,
36
+ // valibotSchema: integerFormat,
37
+ // context
38
+ // })
39
+ const { type: _type, title, description, default: defaultValue, multipleOf, maximum, exclusiveMaximum, minimum, format, exclusiveMinimum, ...skipped } = v.parse(oasIntegerData, valueWithoutEnums);
35
40
  const extensionFields = toSpecificationExtensionsV3({
36
41
  skipped,
37
- parent: value,
42
+ parent: valueWithoutEnums,
38
43
  context,
39
44
  parentType: 'schema:integer'
40
45
  });
@@ -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,YAsCtB,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,EAiEnF,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;AAK1D,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,YAsCtB,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,EAoEnF,CAAA"}
@@ -6,6 +6,7 @@ import { toPathItemV3 } from '../pathItem/toPathItemV3.js';
6
6
  import { methodValues } from '../../types/Method.js';
7
7
  import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
8
8
  import { toSecurityRequirementsV3 } from '../securityRequirement/toSecurityRequirement.js';
9
+ import invariant from 'tiny-invariant';
9
10
  export const toOperationV3 = ({ operation, operationInfo, context }) => {
10
11
  const { method, path, pathItem } = operationInfo;
11
12
  const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, ...skipped } = operation;
@@ -73,10 +74,12 @@ export const toOperationsV3 = ({ paths, context }) => {
73
74
  });
74
75
  }
75
76
  catch (error) {
76
- context.logWarning({
77
+ invariant(error instanceof Error, 'Invalid error');
78
+ context.logIssue({
77
79
  key: method,
78
- message: error instanceof Error ? error.message : 'Failed to parse operation',
79
80
  parent: operation,
81
+ level: 'error',
82
+ error,
80
83
  type: 'INVALID_OPERATION'
81
84
  });
82
85
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.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YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,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;AAM3C,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE,CAAC,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GAAG,SAAS,CAAA;IACjF,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iBAAiB,4BAG3B,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,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAoBxE,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;IAC7F,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,sBAAsB,4BAGhC,0BAA0B,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,SAMpF,CAAA"}
@@ -8,6 +8,7 @@ import { OasParameter } from './Parameter.js';
8
8
  import { match } from 'ts-pattern';
9
9
  import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
10
10
  import * as v from 'valibot';
11
+ import invariant from 'tiny-invariant';
11
12
  export const toParameterListV3 = ({ parameters, context }) => {
12
13
  if (!parameters) {
13
14
  return undefined;
@@ -17,8 +18,21 @@ export const toParameterListV3 = ({ parameters, context }) => {
17
18
  });
18
19
  };
19
20
  export const toParametersV3 = ({ parameters, context }) => {
20
- return Object.fromEntries(Object.entries(parameters).map(([key, value]) => {
21
- return [key, context.trace(key, () => toParameterV3({ parameter: value, context }))];
21
+ return Object.fromEntries(Object.entries(parameters).map(([key, parameter]) => {
22
+ try {
23
+ return [key, context.trace(key, () => toParameterV3({ parameter, context }))];
24
+ }
25
+ catch (error) {
26
+ invariant(error instanceof Error, 'Invalid error');
27
+ context.logIssue({
28
+ key: key,
29
+ level: 'error',
30
+ error,
31
+ parent: parameter,
32
+ type: 'INVALID_PARAMETER'
33
+ });
34
+ return [];
35
+ }
22
36
  }));
23
37
  };
24
38
  export const toOptionalParametersV3 = ({ parameters, context }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"toRefV31.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/toRefV31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,KAAK,YAAY,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI;IACnD,GAAG,EAAE,WAAW,CAAC,eAAe,CAAA;IAChC,OAAO,EAAE,CAAC,CAAA;IACV,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,6BAIrD,YAAY,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CAa5B,CAAA"}
1
+ {"version":3,"file":"toRefV31.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/toRefV31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,KAAK,YAAY,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI;IACnD,GAAG,EAAE,WAAW,CAAC,eAAe,CAAA;IAChC,OAAO,EAAE,CAAC,CAAA;IACV,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,6BAIrD,YAAY,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CAgB5B,CAAA"}
@@ -2,11 +2,11 @@ import { OasRef } from './Ref.js';
2
2
  export const toRefV31 = ({ ref, refType, context }) => {
3
3
  const { $ref, summary, description, ...skipped } = ref;
4
4
  context.logSkippedFields({ skipped, parent: ref, parentType: 'ref' });
5
- const fields = {
5
+ context.registerRef(context.stackTrail.clone(), $ref);
6
+ return new OasRef({
6
7
  refType,
7
8
  $ref,
8
9
  summary,
9
10
  description
10
- };
11
- return new OasRef(fields, context.oasDocument);
11
+ }, context.oasDocument);
12
12
  };