@skmtc/core 0.0.612 → 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.
- package/esm/context/CoreContext.js +1 -1
- package/esm/context/ParseContext.d.ts +35 -15
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +62 -11
- package/esm/context/StackTrail.d.ts +3 -0
- package/esm/context/StackTrail.d.ts.map +1 -1
- package/esm/context/StackTrail.js +20 -0
- package/esm/context/types.d.ts +1 -1
- package/esm/context/types.d.ts.map +1 -1
- package/esm/oas/components/Components.d.ts +2 -0
- package/esm/oas/components/Components.d.ts.map +1 -1
- package/esm/oas/components/Components.js +14 -0
- package/esm/oas/document/Document.d.ts +4 -0
- package/esm/oas/document/Document.d.ts.map +1 -1
- package/esm/oas/document/Document.js +22 -0
- package/esm/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/esm/oas/document/toDocumentFieldsV3.js +1 -2
- package/esm/oas/integer/toInteger.d.ts +1 -1
- package/esm/oas/integer/toInteger.d.ts.map +1 -1
- package/esm/oas/integer/toInteger.js +8 -3
- package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/oas/operation/toOperationsV3.js +5 -2
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +16 -2
- package/esm/oas/ref/toRefV31.d.ts.map +1 -1
- package/esm/oas/ref/toRefV31.js +3 -3
- package/esm/oas/response/toResponseV3.d.ts.map +1 -1
- package/esm/oas/response/toResponseV3.js +5 -2
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +19 -10
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +2 -1
- package/package.json +1 -1
- package/script/context/CoreContext.js +1 -1
- package/script/context/ParseContext.d.ts +35 -15
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +62 -11
- package/script/context/StackTrail.d.ts +3 -0
- package/script/context/StackTrail.d.ts.map +1 -1
- package/script/context/StackTrail.js +20 -0
- package/script/context/types.d.ts +1 -1
- package/script/context/types.d.ts.map +1 -1
- package/script/oas/components/Components.d.ts +2 -0
- package/script/oas/components/Components.d.ts.map +1 -1
- package/script/oas/components/Components.js +15 -1
- package/script/oas/document/Document.d.ts +4 -0
- package/script/oas/document/Document.d.ts.map +1 -1
- package/script/oas/document/Document.js +22 -0
- package/script/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/script/oas/document/toDocumentFieldsV3.js +1 -2
- package/script/oas/integer/toInteger.d.ts +1 -1
- package/script/oas/integer/toInteger.d.ts.map +1 -1
- package/script/oas/integer/toInteger.js +8 -3
- package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/script/oas/operation/toOperationsV3.js +8 -2
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +19 -2
- package/script/oas/ref/toRefV31.d.ts.map +1 -1
- package/script/oas/ref/toRefV31.js +3 -3
- package/script/oas/response/toResponseV3.d.ts.map +1 -1
- package/script/oas/response/toResponseV3.js +8 -2
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +22 -10
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toResponseV3.d.ts","sourceRoot":"","sources":["../../../src/oas/response/toResponseV3.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,aAAa,2BAGvB,iBAAiB,KAAG,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"toResponseV3.d.ts","sourceRoot":"","sources":["../../../src/oas/response/toResponseV3.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,aAAa,2BAGvB,iBAAiB,KAAG,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAsBrE,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAA;IAChD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,qBAAqB,2BAG/B,yBAAyB,KAAG,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,SAMjF,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,cAAc,CAAA;IAC9D,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,YAAY,0BAGtB,gBAAgB,KAAG,WAAW,GAAG,MAAM,CAAC,UAAU,CAsBpD,CAAA"}
|
|
@@ -4,6 +4,7 @@ import { isRef } from '../../helpers/refFns.js';
|
|
|
4
4
|
import { toOptionalMediaTypeItemsV3 } from '../mediaType/toMediaTypeItemV3.js';
|
|
5
5
|
import { OasResponse } from './Response.js';
|
|
6
6
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
7
|
+
import invariant from 'tiny-invariant';
|
|
7
8
|
export const toResponsesV3 = ({ responses, context }) => {
|
|
8
9
|
return Object.fromEntries(Object.entries(responses)
|
|
9
10
|
.map(([key, value]) => {
|
|
@@ -11,9 +12,11 @@ export const toResponsesV3 = ({ responses, context }) => {
|
|
|
11
12
|
return [key, context.trace(key, () => toResponseV3({ response: value, context }))];
|
|
12
13
|
}
|
|
13
14
|
catch (error) {
|
|
14
|
-
|
|
15
|
+
invariant(error instanceof Error, 'Invalid error');
|
|
16
|
+
context.logIssue({
|
|
15
17
|
key,
|
|
16
|
-
|
|
18
|
+
level: 'error',
|
|
19
|
+
error,
|
|
17
20
|
parent: value,
|
|
18
21
|
type: 'INVALID_RESPONSE'
|
|
19
22
|
});
|
|
@@ -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;
|
|
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,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13
|
import { mergeIntersection } from '../_merge-all-of/merge-intersection.js';
|
|
14
14
|
import { mergeUnion } from '../_merge-all-of/merge-union.js';
|
|
15
|
+
import invariant from 'tiny-invariant';
|
|
15
16
|
export const toSchemasV3 = ({ schemas, context }) => {
|
|
16
17
|
return Object.fromEntries(Object.entries(schemas)
|
|
17
18
|
.map(([key, schema]) => {
|
|
@@ -24,9 +25,11 @@ export const toSchemasV3 = ({ schemas, context }) => {
|
|
|
24
25
|
];
|
|
25
26
|
}
|
|
26
27
|
catch (error) {
|
|
27
|
-
|
|
28
|
+
invariant(error instanceof Error, 'Invalid error');
|
|
29
|
+
context.logIssue({
|
|
28
30
|
key,
|
|
29
|
-
|
|
31
|
+
level: 'error',
|
|
32
|
+
error,
|
|
30
33
|
parent: schema,
|
|
31
34
|
type: 'INVALID_SCHEMA'
|
|
32
35
|
});
|
|
@@ -45,10 +48,6 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
45
48
|
if (isRef(schema)) {
|
|
46
49
|
return toRefV31({ ref: schema, refType: 'schema', context });
|
|
47
50
|
}
|
|
48
|
-
// Workaround for dodgy Reapit schema
|
|
49
|
-
// if (schema.type !== 'array' && 'optional' in schema && schema.optional === true) {
|
|
50
|
-
// schema.nullable = true
|
|
51
|
-
// }
|
|
52
51
|
return match(schema)
|
|
53
52
|
.with({ allOf: P.array() }, schema => {
|
|
54
53
|
return context.trace('allOf', () => {
|
|
@@ -70,6 +69,9 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
70
69
|
throw new Error('Missing "oneOf" array');
|
|
71
70
|
}
|
|
72
71
|
const { oneOf: members, ...value } = merged;
|
|
72
|
+
if (members.length === 1) {
|
|
73
|
+
return toSchemaV3({ schema: members[0], context });
|
|
74
|
+
}
|
|
73
75
|
return toUnion({ value, members, parentType: 'oneOf', context });
|
|
74
76
|
});
|
|
75
77
|
})
|
|
@@ -84,6 +86,9 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
84
86
|
throw new Error('Missing "anyOf" array');
|
|
85
87
|
}
|
|
86
88
|
const { anyOf: members, ...value } = merged;
|
|
89
|
+
if (members.length === 1) {
|
|
90
|
+
return toSchemaV3({ schema: members[0], context });
|
|
91
|
+
}
|
|
87
92
|
return toUnion({ value, members, parentType: 'anyOf', context });
|
|
88
93
|
});
|
|
89
94
|
})
|
|
@@ -95,7 +100,8 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
95
100
|
.with({ type: 'string' }, value => toString({ value, context }))
|
|
96
101
|
.otherwise(value => {
|
|
97
102
|
if (possibleObject(value)) {
|
|
98
|
-
context.
|
|
103
|
+
context.logIssueNoKey({
|
|
104
|
+
level: 'warning',
|
|
99
105
|
message: 'Object has "properties" property, but is missing type="object" property',
|
|
100
106
|
parent: value,
|
|
101
107
|
type: 'MISSING_OBJECT_TYPE'
|
|
@@ -109,7 +115,8 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
109
115
|
});
|
|
110
116
|
}
|
|
111
117
|
if (possibleArray(value)) {
|
|
112
|
-
context.
|
|
118
|
+
context.logIssueNoKey({
|
|
119
|
+
level: 'warning',
|
|
113
120
|
message: 'Object has "items" property, but is missing type="array" property',
|
|
114
121
|
parent: value,
|
|
115
122
|
type: 'MISSING_ARRAY_TYPE'
|
|
@@ -124,7 +131,8 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
124
131
|
});
|
|
125
132
|
}
|
|
126
133
|
if (possibleBoolean(value)) {
|
|
127
|
-
context.
|
|
134
|
+
context.logIssueNoKey({
|
|
135
|
+
level: 'warning',
|
|
128
136
|
message: 'Object has a boolean "default" or "example" property, but is missing type="boolean" property',
|
|
129
137
|
parent: value,
|
|
130
138
|
type: 'MISSING_BOOLEAN_TYPE'
|
|
@@ -138,7 +146,8 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
138
146
|
});
|
|
139
147
|
}
|
|
140
148
|
if (possibleString(value)) {
|
|
141
|
-
context.
|
|
149
|
+
context.logIssueNoKey({
|
|
150
|
+
level: 'warning',
|
|
142
151
|
message: 'Object has a string "default" or "example" property, but is missing type="string" property',
|
|
143
152
|
parent: value,
|
|
144
153
|
type: 'MISSING_STRING_TYPE'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.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,EAAE,MAAM,aAAa,CAAA;AAQvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,mCAmCxD,CAAA;AAED,KAAK,kBAAkB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC9D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACjF,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;IACnF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;CACrF,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,8DAOhE,kBAAkB,CAAC,QAAQ,CAAC,KAAG,SAAS,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.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,EAAE,MAAM,aAAa,CAAA;AAQvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,mCAmCxD,CAAA;AAED,KAAK,kBAAkB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC9D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACjF,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;IACnF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;CACrF,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,8DAOhE,kBAAkB,CAAC,QAAQ,CAAC,KAAG,SAAS,CAAC,QAAQ,CA0CnD,CAAA"}
|
|
@@ -47,8 +47,9 @@ export const toParsedString = ({ context, nullable, example, enums, defaultValue
|
|
|
47
47
|
parentType: 'schema:string'
|
|
48
48
|
});
|
|
49
49
|
if (format && !v.is(stringFormat, format)) {
|
|
50
|
-
context.
|
|
50
|
+
context.logIssue({
|
|
51
51
|
key: 'format',
|
|
52
|
+
level: 'warning',
|
|
52
53
|
message: `Unexpected format: ${format}`,
|
|
53
54
|
parent: value,
|
|
54
55
|
type: 'UNEXPECTED_FORMAT'
|
package/package.json
CHANGED
|
@@ -98,7 +98,7 @@ class CoreContext {
|
|
|
98
98
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, documentObject), "f");
|
|
99
99
|
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
100
100
|
});
|
|
101
|
-
const { files, previews, schemaOptions } = this.trace('
|
|
101
|
+
const { files, previews, schemaOptions } = this.trace('generate', () => {
|
|
102
102
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
103
103
|
toGeneratorConfigMap,
|
|
104
104
|
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 {
|
|
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
|
-
|
|
16
|
+
issues: ParseIssue[];
|
|
17
17
|
};
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
type: WarningType;
|
|
30
|
+
type: IssueType;
|
|
23
31
|
};
|
|
24
|
-
export type
|
|
32
|
+
export type LogIssueNoKeyArgs = ParseIssueBase & {
|
|
25
33
|
parent: unknown;
|
|
26
|
-
|
|
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:
|
|
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
|
|
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:
|
|
59
|
+
location: string;
|
|
45
60
|
parent: unknown;
|
|
46
|
-
type:
|
|
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
|
-
|
|
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
|
-
|
|
61
|
-
|
|
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,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC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SAAS;IAQvD,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;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"}
|
|
@@ -22,6 +22,18 @@ 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
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
+
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
+
};
|
|
36
|
+
var _ParseContext_refStackTrails, _ParseContext_refErrors;
|
|
25
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
38
|
exports.parseSchema = exports.ParseContext = void 0;
|
|
27
39
|
require("../_dnt.polyfills.js");
|
|
@@ -56,7 +68,7 @@ class ParseContext {
|
|
|
56
68
|
writable: true,
|
|
57
69
|
value: void 0
|
|
58
70
|
});
|
|
59
|
-
Object.defineProperty(this, "
|
|
71
|
+
Object.defineProperty(this, "issues", {
|
|
60
72
|
enumerable: true,
|
|
61
73
|
configurable: true,
|
|
62
74
|
writable: true,
|
|
@@ -68,28 +80,62 @@ class ParseContext {
|
|
|
68
80
|
writable: true,
|
|
69
81
|
value: void 0
|
|
70
82
|
});
|
|
83
|
+
_ParseContext_refStackTrails.set(this, void 0);
|
|
84
|
+
_ParseContext_refErrors.set(this, void 0);
|
|
71
85
|
this.documentObject = documentObject;
|
|
72
86
|
this.logger = logger;
|
|
73
87
|
this.stackTrail = stackTrail;
|
|
74
88
|
this.oasDocument = new Document_js_1.OasDocument();
|
|
75
89
|
this.silent = silent;
|
|
76
|
-
this.
|
|
90
|
+
this.issues = [];
|
|
91
|
+
__classPrivateFieldSet(this, _ParseContext_refStackTrails, {}, "f");
|
|
92
|
+
__classPrivateFieldSet(this, _ParseContext_refErrors, {}, "f");
|
|
77
93
|
}
|
|
78
94
|
parse() {
|
|
79
95
|
this.oasDocument.fields = (0, toDocumentFieldsV3_js_1.toDocumentFieldsV3)({
|
|
80
96
|
documentObject: this.documentObject,
|
|
81
97
|
context: this
|
|
82
98
|
});
|
|
99
|
+
this.removeErroredItems();
|
|
83
100
|
return this.oasDocument;
|
|
84
101
|
}
|
|
102
|
+
removeErroredItems() {
|
|
103
|
+
Object.entries(__classPrivateFieldGet(this, _ParseContext_refErrors, "f")).forEach(([$ref, errors]) => {
|
|
104
|
+
errors.forEach(error => {
|
|
105
|
+
__classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref]?.forEach(stackTrail => {
|
|
106
|
+
const removed = this.oasDocument.removeItem(stackTrail);
|
|
107
|
+
if (removed) {
|
|
108
|
+
this.issues.push({
|
|
109
|
+
level: 'error',
|
|
110
|
+
error,
|
|
111
|
+
location: stackTrail.toString(),
|
|
112
|
+
parent: removed,
|
|
113
|
+
type: 'INVALID_DEPENDENCY_REF'
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
registerRef(stackTrail, $ref) {
|
|
121
|
+
const refStackTrails = __classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref];
|
|
122
|
+
refStackTrails ? refStackTrails.push(stackTrail) : (__classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref] = [stackTrail]);
|
|
123
|
+
}
|
|
124
|
+
registerRefError(error, $ref) {
|
|
125
|
+
if ($ref) {
|
|
126
|
+
const refErrors = __classPrivateFieldGet(this, _ParseContext_refErrors, "f")[$ref];
|
|
127
|
+
refErrors ? refErrors.push(error) : (__classPrivateFieldGet(this, _ParseContext_refErrors, "f")[$ref] = [error]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
85
130
|
trace(token, fn) {
|
|
86
131
|
return (0, tracer_js_1.tracer)(this.stackTrail, token, fn);
|
|
87
132
|
}
|
|
88
133
|
logSkippedFields({ skipped, parent, parentType }) {
|
|
89
134
|
Object.keys(skipped).forEach(key => {
|
|
90
|
-
this.
|
|
135
|
+
this.logIssue({
|
|
91
136
|
key,
|
|
92
137
|
parent,
|
|
138
|
+
level: 'warning',
|
|
93
139
|
message: `Unexpected property '${key}' in '${parentType}'`,
|
|
94
140
|
type: 'UNEXPECTED_PROPERTY'
|
|
95
141
|
});
|
|
@@ -100,34 +146,39 @@ class ParseContext {
|
|
|
100
146
|
if (parsed.success) {
|
|
101
147
|
return parsed.output;
|
|
102
148
|
}
|
|
103
|
-
this.
|
|
149
|
+
this.logIssue({
|
|
104
150
|
key,
|
|
105
151
|
parent,
|
|
152
|
+
level: 'warning',
|
|
106
153
|
message: toMessage(value),
|
|
107
154
|
type
|
|
108
155
|
});
|
|
109
156
|
}
|
|
110
|
-
|
|
111
|
-
this.trace(key, () => this.
|
|
157
|
+
logIssue({ key, parent, type, ...issue }) {
|
|
158
|
+
this.trace(key, () => this.logIssueNoKey({ parent, type, ...issue }));
|
|
112
159
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
160
|
+
logIssueNoKey({ parent, type, ...issue }) {
|
|
161
|
+
if (issue.level === 'error') {
|
|
162
|
+
this.registerRefError(issue.error, this.stackTrail.toStackRef());
|
|
163
|
+
}
|
|
164
|
+
this.issues.push({
|
|
165
|
+
...issue,
|
|
166
|
+
location: this.stackTrail.toString(),
|
|
117
167
|
parent,
|
|
118
168
|
type
|
|
119
169
|
});
|
|
120
170
|
if (!this.silent) {
|
|
121
171
|
this.logger.warn({
|
|
172
|
+
...issue,
|
|
122
173
|
location: this.stackTrail.toString(),
|
|
123
174
|
parent: JSON.stringify(parent),
|
|
124
|
-
message,
|
|
125
175
|
type
|
|
126
176
|
});
|
|
127
177
|
}
|
|
128
178
|
}
|
|
129
179
|
}
|
|
130
180
|
exports.ParseContext = ParseContext;
|
|
181
|
+
_ParseContext_refStackTrails = new WeakMap(), _ParseContext_refErrors = new WeakMap();
|
|
131
182
|
const parseSchema = (schema) => {
|
|
132
183
|
if (schema.trimStart().startsWith('{')) {
|
|
133
184
|
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;
|
|
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"}
|
|
@@ -14,6 +14,7 @@ var _StackTrail_stack;
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.StackTrail = void 0;
|
|
16
16
|
require("../_dnt.polyfills.js");
|
|
17
|
+
const Components_js_1 = require("../oas/components/Components.js");
|
|
17
18
|
class StackTrail {
|
|
18
19
|
constructor(stack = []) {
|
|
19
20
|
_StackTrail_stack.set(this, void 0);
|
|
@@ -25,6 +26,9 @@ class StackTrail {
|
|
|
25
26
|
slice(start, end) {
|
|
26
27
|
return new StackTrail(__classPrivateFieldGet(this, _StackTrail_stack, "f").slice(start, end));
|
|
27
28
|
}
|
|
29
|
+
includes(frames) {
|
|
30
|
+
return frames.every(frame => __classPrivateFieldGet(this, _StackTrail_stack, "f").includes(frame));
|
|
31
|
+
}
|
|
28
32
|
get stackTrail() {
|
|
29
33
|
return __classPrivateFieldGet(this, _StackTrail_stack, "f");
|
|
30
34
|
}
|
|
@@ -47,6 +51,19 @@ class StackTrail {
|
|
|
47
51
|
return typeof parentName === 'string' ? parentName : undefined;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
54
|
+
toStackRef() {
|
|
55
|
+
const [first, second, third] = this.stackTrail;
|
|
56
|
+
if (first !== 'components') {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (typeof second !== 'string' || !Components_js_1.componentsKeys.includes(second)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (typeof third !== 'string') {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
return `#/${first}/${second}/${third}`;
|
|
66
|
+
}
|
|
50
67
|
remove(frame) {
|
|
51
68
|
if (typeof frame === 'string') {
|
|
52
69
|
const lastItem = __classPrivateFieldGet(this, _StackTrail_stack, "f")[__classPrivateFieldGet(this, _StackTrail_stack, "f").length - 1];
|
|
@@ -74,6 +91,9 @@ class StackTrail {
|
|
|
74
91
|
});
|
|
75
92
|
return new StackTrail(stack);
|
|
76
93
|
}
|
|
94
|
+
toJSON() {
|
|
95
|
+
return this.toString();
|
|
96
|
+
}
|
|
77
97
|
toString() {
|
|
78
98
|
return __classPrivateFieldGet(this, _StackTrail_stack, "f")
|
|
79
99
|
.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
|
|
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.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B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vD,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,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,CAAC;AACjC,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAE7E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM,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M,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,SAAS,CAE7E;IAED,qEAAqE;IACrE,IAAI,UAAU,IAAI,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,SAAS,CAEhF;IAED,mEAAmE;IACnE,IAAI,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAE1E;IAED,uEAAuE;IACvE,IAAI,aAAa,IAAI,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,SAAS,CAEvF;IAED,kEAAkE;IAClE,IAAI,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,SAAS,CAEvE;IAED,0EAA0E;IAC1E,IAAI,eAAe,IAAI,MAAM,CAAC,MAAM,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,9 +12,18 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
};
|
|
13
13
|
var _OasComponents_fields;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.OasComponents = void 0;
|
|
15
|
+
exports.OasComponents = exports.componentsKeys = void 0;
|
|
16
16
|
require("../../_dnt.polyfills.js");
|
|
17
17
|
require("../../_dnt.polyfills.js");
|
|
18
|
+
exports.componentsKeys = [
|
|
19
|
+
'schemas',
|
|
20
|
+
'responses',
|
|
21
|
+
'parameters',
|
|
22
|
+
'examples',
|
|
23
|
+
'requestBodies',
|
|
24
|
+
'headers',
|
|
25
|
+
'securitySchemes'
|
|
26
|
+
];
|
|
18
27
|
/** Container object for re-usable schema items within the API
|
|
19
28
|
*
|
|
20
29
|
* Fields not yet implemented: **securitySchemes**, **links**, **callbacks**
|
|
@@ -39,6 +48,11 @@ class OasComponents {
|
|
|
39
48
|
get schemas() {
|
|
40
49
|
return __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas;
|
|
41
50
|
}
|
|
51
|
+
removeSchema(refName) {
|
|
52
|
+
const { [refName]: removed, ...rest } = __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas;
|
|
53
|
+
__classPrivateFieldGet(this, _OasComponents_fields, "f").schemas = rest;
|
|
54
|
+
return removed;
|
|
55
|
+
}
|
|
42
56
|
/** Record holding re-usable {@link OasResponse} objects or Refs */
|
|
43
57
|
get responses() {
|
|
44
58
|
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;
|
|
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;AAC3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAG7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,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,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"}
|
|
@@ -14,6 +14,7 @@ var _OasDocument_fields;
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.OasDocument = void 0;
|
|
16
16
|
require("../../_dnt.polyfills.js");
|
|
17
|
+
const ts_pattern_1 = require("ts-pattern");
|
|
17
18
|
/** Top level document object describing the API */
|
|
18
19
|
class OasDocument {
|
|
19
20
|
constructor(fields) {
|
|
@@ -28,6 +29,27 @@ class OasDocument {
|
|
|
28
29
|
_OasDocument_fields.set(this, void 0);
|
|
29
30
|
__classPrivateFieldSet(this, _OasDocument_fields, fields, "f");
|
|
30
31
|
}
|
|
32
|
+
removeItem(stackTrail) {
|
|
33
|
+
const [first, second, third] = stackTrail.stackTrail;
|
|
34
|
+
return (0, ts_pattern_1.match)(first)
|
|
35
|
+
.with('paths', () => {
|
|
36
|
+
const index = __classPrivateFieldGet(this, _OasDocument_fields, "f").operations.findIndex(({ path, method }) => path === second && method === third);
|
|
37
|
+
if (index === -1) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const [removed] = __classPrivateFieldGet(this, _OasDocument_fields, "f").operations.splice(index, 1);
|
|
41
|
+
return removed;
|
|
42
|
+
})
|
|
43
|
+
.with('components', () => {
|
|
44
|
+
if (typeof third !== 'string') {
|
|
45
|
+
throw new Error(`RefName cannot be a number: ${third}`);
|
|
46
|
+
}
|
|
47
|
+
return __classPrivateFieldGet(this, _OasDocument_fields, "f").components.removeSchema(third);
|
|
48
|
+
})
|
|
49
|
+
.otherwise(() => {
|
|
50
|
+
throw new Error(`Unexpected stack trail: ${stackTrail}`);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
31
53
|
set fields(fields) {
|
|
32
54
|
__classPrivateFieldSet(this, _OasDocument_fields, fields, "f");
|
|
33
55
|
}
|