@skmtc/core 0.46.0 → 0.47.0
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/ParseContext.d.ts +3 -0
- package/esm/context/ParseContext.js +17 -7
- package/esm/context/generateTypes.d.ts +2 -2
- package/esm/helpers/collateExamples.js +35 -17
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/oas/intersection/Intersection.d.ts +122 -0
- package/esm/oas/intersection/Intersection.js +266 -0
- package/esm/oas/mediaType/jsonMediaType.d.ts +1 -1
- package/esm/oas/mediaType/jsonMediaType.js +3 -3
- package/esm/oas/requestBody/RequestBody.d.ts +1 -1
- package/esm/oas/requestBody/RequestBody.js +1 -1
- package/esm/oas/response/Response.d.ts +1 -1
- package/esm/oas/response/Response.js +1 -1
- package/esm/oas/schema/Schema.d.ts +4 -2
- package/esm/oas/schema/siblings.d.ts +10 -2
- package/esm/oas/schema/siblings.js +87 -22
- package/esm/oas/schemaPath/traverseSchema.d.ts +2 -0
- package/esm/oas/schemaPath/traverseSchema.js +40 -0
- package/esm/parse/allOfSystem.d.ts +3 -0
- package/esm/parse/allOfSystem.js +2 -1
- package/esm/parse/keptIntersection.d.ts +53 -0
- package/esm/parse/keptIntersection.js +155 -0
- package/esm/parse/keptRefs.d.ts +23 -0
- package/esm/parse/keptRefs.js +59 -0
- package/esm/parse/toCyclicRefs.d.ts +8 -0
- package/esm/parse/toCyclicRefs.js +126 -0
- package/esm/parse/toDeclaredTypes.d.ts +20 -0
- package/esm/parse/toDeclaredTypes.js +43 -0
- package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +8 -4
- package/esm/parse/v3-0/_merge-all-of/merge-union.js +7 -1
- package/esm/parse/v3-0/_merge-all-of/merge.js +13 -0
- package/esm/parse/v3-0/_merge-all-of/types.d.ts +3 -0
- package/esm/parse/v3-0/intersection/toIntersection.d.ts +12 -0
- package/esm/parse/v3-0/intersection/toIntersection.js +61 -0
- package/esm/parse/v3-0/schema/toSchemasV3.js +13 -1
- package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +8 -4
- package/esm/parse/v3-1/_merge-all-of/merge-union.js +7 -1
- package/esm/parse/v3-1/_merge-all-of/merge.js +13 -0
- package/esm/parse/v3-1/_merge-all-of/types.d.ts +3 -0
- package/esm/parse/v3-1/intersection/toIntersection.d.ts +12 -0
- package/esm/parse/v3-1/intersection/toIntersection.js +61 -0
- package/esm/parse/v3-1/schema/toSchemasV3.js +15 -2
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +8 -4
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +7 -1
- package/esm/parse/v3-2/_merge-all-of/merge.js +13 -0
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +3 -0
- package/esm/parse/v3-2/intersection/toIntersection.d.ts +12 -0
- package/esm/parse/v3-2/intersection/toIntersection.js +61 -0
- package/esm/parse/v3-2/schema/toSchemasV3.js +15 -2
- package/esm/types/Settings.d.ts +9 -0
- package/esm/types/Settings.js +2 -1
- package/esm/types/TypeSystem.d.ts +17 -2
- package/package.json +1 -1
- package/script/context/ParseContext.d.ts +3 -0
- package/script/context/ParseContext.js +17 -7
- package/script/context/generateTypes.d.ts +2 -2
- package/script/helpers/collateExamples.js +35 -17
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/oas/intersection/Intersection.d.ts +122 -0
- package/script/oas/intersection/Intersection.js +270 -0
- package/script/oas/mediaType/jsonMediaType.d.ts +1 -1
- package/script/oas/mediaType/jsonMediaType.js +3 -3
- package/script/oas/requestBody/RequestBody.d.ts +1 -1
- package/script/oas/requestBody/RequestBody.js +1 -1
- package/script/oas/response/Response.d.ts +1 -1
- package/script/oas/response/Response.js +1 -1
- package/script/oas/schema/Schema.d.ts +4 -2
- package/script/oas/schema/siblings.d.ts +10 -2
- package/script/oas/schema/siblings.js +89 -23
- package/script/oas/schemaPath/traverseSchema.d.ts +2 -0
- package/script/oas/schemaPath/traverseSchema.js +40 -0
- package/script/parse/allOfSystem.d.ts +3 -0
- package/script/parse/allOfSystem.js +2 -1
- package/script/parse/keptIntersection.d.ts +53 -0
- package/script/parse/keptIntersection.js +164 -0
- package/script/parse/keptRefs.d.ts +23 -0
- package/script/parse/keptRefs.js +63 -0
- package/script/parse/toCyclicRefs.d.ts +8 -0
- package/script/parse/toCyclicRefs.js +130 -0
- package/script/parse/toDeclaredTypes.d.ts +20 -0
- package/script/parse/toDeclaredTypes.js +48 -0
- package/script/parse/v3-0/_merge-all-of/merge-intersection.js +8 -4
- package/script/parse/v3-0/_merge-all-of/merge-union.js +7 -1
- package/script/parse/v3-0/_merge-all-of/merge.js +13 -0
- package/script/parse/v3-0/_merge-all-of/types.d.ts +3 -0
- package/script/parse/v3-0/intersection/toIntersection.d.ts +12 -0
- package/script/parse/v3-0/intersection/toIntersection.js +65 -0
- package/script/parse/v3-0/schema/toSchemasV3.js +13 -1
- package/script/parse/v3-1/_merge-all-of/merge-intersection.js +8 -4
- package/script/parse/v3-1/_merge-all-of/merge-union.js +7 -1
- package/script/parse/v3-1/_merge-all-of/merge.js +13 -0
- package/script/parse/v3-1/_merge-all-of/types.d.ts +3 -0
- package/script/parse/v3-1/intersection/toIntersection.d.ts +12 -0
- package/script/parse/v3-1/intersection/toIntersection.js +65 -0
- package/script/parse/v3-1/schema/toSchemasV3.js +15 -2
- package/script/parse/v3-2/_merge-all-of/merge-intersection.js +8 -4
- package/script/parse/v3-2/_merge-all-of/merge-union.js +7 -1
- package/script/parse/v3-2/_merge-all-of/merge.js +13 -0
- package/script/parse/v3-2/_merge-all-of/types.d.ts +3 -0
- package/script/parse/v3-2/intersection/toIntersection.d.ts +12 -0
- package/script/parse/v3-2/intersection/toIntersection.js +65 -0
- package/script/parse/v3-2/schema/toSchemasV3.js +15 -2
- package/script/types/Settings.d.ts +9 -0
- package/script/types/Settings.js +2 -1
- package/script/types/TypeSystem.d.ts +17 -2
|
@@ -25,6 +25,7 @@ import { GqlDocument } from '../gql/document/GqlDocument.js';
|
|
|
25
25
|
import type { Logger } from '../types/Logger.js';
|
|
26
26
|
export type { AttributionState } from '../types/AttributionState.js';
|
|
27
27
|
import { StackTrail } from './StackTrail.js';
|
|
28
|
+
import { type KeptRefs } from '../parse/keptRefs.js';
|
|
28
29
|
import type { SkmtcDocumentInput, SkmtcParsedDocument } from '../types/SkmtcDocument.js';
|
|
29
30
|
import type { GqlParseOptions, LogAtArgs, LogIssueArgs, LogIssueAtArgs, LogIssueNoKeyArgs, LogSkippedValuesArgs } from './parseTypes.js';
|
|
30
31
|
import type { ParseIssue } from './ParseIssue.js';
|
|
@@ -101,6 +102,8 @@ export declare class ParseContext {
|
|
|
101
102
|
get oasDocument(): OasDocument;
|
|
102
103
|
/** OAS-only accessor; symmetric reason to {@link oasDocument}. */
|
|
103
104
|
get documentObject(): OpenAPIV3.Document;
|
|
105
|
+
/** The refs of the document that a merge keeps as refs (`system.intersections`); `undefined` under `merge`. */
|
|
106
|
+
get keptRefs(): KeptRefs | undefined;
|
|
104
107
|
/** GQL-only accessor; throws if called on an OAS context. */
|
|
105
108
|
get schema(): GraphQLSchema;
|
|
106
109
|
/** GQL-only accessor; throws if called on an OAS context. */
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
1
6
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
7
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
8
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
9
|
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
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
11
|
};
|
|
7
|
-
var
|
|
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_instances, _ParseContext_refConsumers, _ParseContext_refErrors, _ParseContext_oasRefs, _ParseContext_refTargets, _ParseContext_refTarget, _ParseContext_issueIdentities, _ParseContext_rootFrames, _ParseContext_removeComponent, _ParseContext_parseRefTargets, _ParseContext_inRefTarget, _ParseContext_addIssue, _ParseContext_removeConsumer, _ParseContext_removePathParameterConsumer, _ParseContext_logDependencyIssue, _ParseContext_toDocumentTrail, _ParseContext_checkRefs, _ParseContext_toRefError, _ParseContext_toLoopOf, _ParseContext_removeHolder;
|
|
12
|
+
var _ParseContext_instances, _ParseContext_refConsumers, _ParseContext_refErrors, _ParseContext_oasRefs, _ParseContext_refTargets, _ParseContext_refTarget, _ParseContext_keptRefs, _ParseContext_issueIdentities, _ParseContext_rootFrames, _ParseContext_removeComponent, _ParseContext_parseRefTargets, _ParseContext_inRefTarget, _ParseContext_addIssue, _ParseContext_removeConsumer, _ParseContext_removePathParameterConsumer, _ParseContext_logDependencyIssue, _ParseContext_toDocumentTrail, _ParseContext_checkRefs, _ParseContext_toRefError, _ParseContext_toLoopOf, _ParseContext_removeHolder;
|
|
13
13
|
/**
|
|
14
14
|
* Unified parse context for both OAS and GraphQL inputs.
|
|
15
15
|
*
|
|
@@ -39,6 +39,7 @@ import { GqlDocument } from '../gql/document/GqlDocument.js';
|
|
|
39
39
|
import { parseGqlDocument } from '../gql/document/parseGqlDocument.js';
|
|
40
40
|
import { StackTrail } from './StackTrail.js';
|
|
41
41
|
import { isPlainObject } from '../parse/isPlainObject.js';
|
|
42
|
+
import { toKeptRefs } from '../parse/keptRefs.js';
|
|
42
43
|
import { toApplyingBrokenParameter, toNameAndIn } from '../parse/pathParameters.js';
|
|
43
44
|
import { toSerializedError } from '../types/SerializedError.js';
|
|
44
45
|
import { tryParseAt } from './tryParseAt.js';
|
|
@@ -171,6 +172,8 @@ export class ParseContext {
|
|
|
171
172
|
);
|
|
172
173
|
/** The key of the ref target `#inRefTarget` runs for; `undefined` in the document's own walk. */
|
|
173
174
|
_ParseContext_refTarget.set(this, void 0);
|
|
175
|
+
/** {@link keptRefs}, once a merge has asked for it. */
|
|
176
|
+
_ParseContext_keptRefs.set(this, void 0);
|
|
174
177
|
/** What identifies each issue logged so far (`toIssueIdentity`). */
|
|
175
178
|
_ParseContext_issueIdentities.set(this, new Set()
|
|
176
179
|
/**
|
|
@@ -236,6 +239,13 @@ export class ParseContext {
|
|
|
236
239
|
}
|
|
237
240
|
return this.protocol.documentObject;
|
|
238
241
|
}
|
|
242
|
+
/** The refs of the document that a merge keeps as refs (`system.intersections`); `undefined` under `merge`. */
|
|
243
|
+
get keptRefs() {
|
|
244
|
+
__classPrivateFieldSet(this, _ParseContext_keptRefs, __classPrivateFieldGet(this, _ParseContext_keptRefs, "f") ?? {
|
|
245
|
+
value: toKeptRefs({ documentObject: this.documentObject, setting: this.system.intersections })
|
|
246
|
+
}, "f");
|
|
247
|
+
return __classPrivateFieldGet(this, _ParseContext_keptRefs, "f").value;
|
|
248
|
+
}
|
|
239
249
|
/** GQL-only accessor; throws if called on an OAS context. */
|
|
240
250
|
get schema() {
|
|
241
251
|
if (this.protocol.type !== 'gql') {
|
|
@@ -619,7 +629,7 @@ export class ParseContext {
|
|
|
619
629
|
});
|
|
620
630
|
}
|
|
621
631
|
}
|
|
622
|
-
_ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMap(), _ParseContext_oasRefs = new WeakMap(), _ParseContext_refTargets = new WeakMap(), _ParseContext_refTarget = new WeakMap(), _ParseContext_issueIdentities = new WeakMap(), _ParseContext_rootFrames = new WeakMap(), _ParseContext_instances = new WeakSet(), _ParseContext_removeComponent = function _ParseContext_removeComponent(refKey) {
|
|
632
|
+
_ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMap(), _ParseContext_oasRefs = new WeakMap(), _ParseContext_refTargets = new WeakMap(), _ParseContext_refTarget = new WeakMap(), _ParseContext_keptRefs = new WeakMap(), _ParseContext_issueIdentities = new WeakMap(), _ParseContext_rootFrames = new WeakMap(), _ParseContext_instances = new WeakSet(), _ParseContext_removeComponent = function _ParseContext_removeComponent(refKey) {
|
|
623
633
|
if (this.protocol.type !== 'oas') {
|
|
624
634
|
return;
|
|
625
635
|
}
|
|
@@ -170,8 +170,8 @@ export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3
|
|
|
170
170
|
*
|
|
171
171
|
* - `WILDCARD_MEDIA_TYPE` (`warning`) — the body has no JSON media type
|
|
172
172
|
* (see `isJsonMediaType`) and is read from `*\/*` as JSON, since its schema
|
|
173
|
-
* there is an object, array, union or `$ref`. The document
|
|
174
|
-
* format; springdoc writes `*\/*` for every response.
|
|
173
|
+
* there is an object, array, union, intersection or `$ref`. The document
|
|
174
|
+
* does not say the format; springdoc writes `*\/*` for every response.
|
|
175
175
|
* - `NO_JSON_MEDIA_TYPE` (`debug`) — no lookup without a media type reads the
|
|
176
176
|
* body, and its keys include a range: `application/*`, or `*\/*` with a
|
|
177
177
|
* scalar schema (a text body or a file). A body with only specific
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
import { isEmpty } from './isEmpty.js';
|
|
3
|
+
import { isObjectValue } from '../oas/schema/siblings.js';
|
|
3
4
|
import { DanglingRefError } from '../oas/ref/DanglingRefError.js';
|
|
4
5
|
/**
|
|
5
6
|
* Recursively collates and builds example values from OpenAPI schemas.
|
|
@@ -163,23 +164,7 @@ export const collateExamples = ({ objectSchema, depth, seen }) => {
|
|
|
163
164
|
// legitimately deep one fail identically, and a caller that only wanted a
|
|
164
165
|
// sample body gets an exception instead. Cutting the cycle here is what
|
|
165
166
|
// makes the depth limit mean what it says.
|
|
166
|
-
|
|
167
|
-
return undefined;
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
return collateExamples({
|
|
171
|
-
objectSchema: objectSchema.resolve(),
|
|
172
|
-
depth: depth + 1,
|
|
173
|
-
seen: new Set(seen ?? []).add(objectSchema.$ref)
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
catch (error) {
|
|
177
|
-
// A dangling reference names no schema, so it has no example either.
|
|
178
|
-
if (DanglingRefError.is(error)) {
|
|
179
|
-
return undefined;
|
|
180
|
-
}
|
|
181
|
-
throw error;
|
|
182
|
-
}
|
|
167
|
+
return collateRef({ ref: objectSchema, depth: depth + 1, seen });
|
|
183
168
|
}
|
|
184
169
|
case 'object': {
|
|
185
170
|
if (objectSchema.example) {
|
|
@@ -235,9 +220,42 @@ export const collateExamples = ({ objectSchema, depth, seen }) => {
|
|
|
235
220
|
}
|
|
236
221
|
return undefined;
|
|
237
222
|
}
|
|
223
|
+
case 'intersection': {
|
|
224
|
+
if (objectSchema.example) {
|
|
225
|
+
return objectSchema.example;
|
|
226
|
+
}
|
|
227
|
+
// A value matches every member, so the examples of objects are one object.
|
|
228
|
+
// Its members are as deep as the intersection: they are one value.
|
|
229
|
+
const examples = objectSchema.members
|
|
230
|
+
.map(member => member.isRef()
|
|
231
|
+
? collateRef({ ref: member, depth, seen })
|
|
232
|
+
: collateExamples({ objectSchema: member, depth, seen }))
|
|
233
|
+
.filter(example => Boolean(example));
|
|
234
|
+
return examples.every(isObjectValue) ? toMergedExample(examples) : examples[0];
|
|
235
|
+
}
|
|
238
236
|
default: {
|
|
239
237
|
const _exhaustive = objectSchema;
|
|
240
238
|
throw new Error(`Unhandled schema type: ${_exhaustive.type}`);
|
|
241
239
|
}
|
|
242
240
|
}
|
|
243
241
|
};
|
|
242
|
+
/** The example of what a reference resolves to. A reference on the path to itself, or one that names nothing, has none. */
|
|
243
|
+
const collateRef = ({ ref, depth, seen }) => {
|
|
244
|
+
if (seen?.has(ref.$ref)) {
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
return collateExamples({
|
|
249
|
+
objectSchema: ref.resolve(),
|
|
250
|
+
depth,
|
|
251
|
+
seen: new Set(seen ?? []).add(ref.$ref)
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
if (DanglingRefError.is(error)) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
throw error;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
const toMergedExample = (examples) => examples.length === 0 ? undefined : Object.assign({}, ...examples);
|
package/esm/mod.d.ts
CHANGED
|
@@ -181,6 +181,7 @@ export * from './parse/v3-0/string/toString.js';
|
|
|
181
181
|
export * from './oas/tag/Tag.js';
|
|
182
182
|
export * from './oas/tag/tag-types.js';
|
|
183
183
|
export * from './oas/union/Union.js';
|
|
184
|
+
export * from './oas/intersection/Intersection.js';
|
|
184
185
|
export * from './parse/v3-0/union/toUnion.js';
|
|
185
186
|
export * from './oas/unknown/Unknown.js';
|
|
186
187
|
export * from './oas/unknown/unknown-types.js';
|
package/esm/mod.js
CHANGED
|
@@ -181,6 +181,7 @@ export * from './parse/v3-0/string/toString.js';
|
|
|
181
181
|
export * from './oas/tag/Tag.js';
|
|
182
182
|
export * from './oas/tag/tag-types.js';
|
|
183
183
|
export * from './oas/union/Union.js';
|
|
184
|
+
export * from './oas/intersection/Intersection.js';
|
|
184
185
|
export * from './parse/v3-0/union/toUnion.js';
|
|
185
186
|
export * from './oas/unknown/Unknown.js';
|
|
186
187
|
export * from './oas/unknown/unknown-types.js';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { OasUnknown } from '../unknown/Unknown.js';
|
|
2
|
+
import type { SchemaPath } from '../../types/SchemaPath.js';
|
|
3
|
+
import type { OasExternalDocs } from '../externalDocs/ExternalDocs.js';
|
|
4
|
+
import type { OasSchema, ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
5
|
+
import type { OasRef } from '../ref/Ref.js';
|
|
6
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
import { OasBase } from '../../types/OasBase.js';
|
|
8
|
+
import type { ParseContextType } from '../../context/parseTypes.js';
|
|
9
|
+
/**
|
|
10
|
+
* Constructor fields for {@link OasIntersection}.
|
|
11
|
+
*/
|
|
12
|
+
export type IntersectionFields = {
|
|
13
|
+
/** A short summary of the intersection */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** A description of the intersection */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** External documentation for the intersection */
|
|
18
|
+
externalDocs?: OasExternalDocs | undefined;
|
|
19
|
+
/** Whether the value can be null */
|
|
20
|
+
nullable?: boolean;
|
|
21
|
+
/** Whether the value is sent by the API only */
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
/** Whether the value is sent in a request only */
|
|
24
|
+
writeOnly?: boolean;
|
|
25
|
+
/** Whether the value is deprecated */
|
|
26
|
+
deprecated?: boolean;
|
|
27
|
+
/** Example value */
|
|
28
|
+
example?: unknown;
|
|
29
|
+
/** Default value */
|
|
30
|
+
default?: unknown;
|
|
31
|
+
/** The schemas a value matches all of */
|
|
32
|
+
members: (OasSchema | OasRef<'schema'>)[];
|
|
33
|
+
/** Custom extension fields (x-* properties) */
|
|
34
|
+
extensionFields?: Record<string, unknown>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* An `allOf` that keeps at least one reference: a value matches every member.
|
|
38
|
+
*
|
|
39
|
+
* Core merges the members of an `allOf` into one schema. A reference that
|
|
40
|
+
* `client.json` `system.intersections` keeps is not merged: the schema is an
|
|
41
|
+
* `OasIntersection` of the kept references, and at most one other member, which
|
|
42
|
+
* the other members of the `allOf` merge into. By default those are the
|
|
43
|
+
* references that close a cycle.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* // LineString: { allOf: [{ $ref: Geometry }, { properties: { coordinates } }] },
|
|
48
|
+
* // where a property of Geometry leads back to LineString
|
|
49
|
+
* lineString.members // [OasRef Geometry, OasObject { coordinates }]
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare class OasIntersection extends OasBase {
|
|
53
|
+
#private;
|
|
54
|
+
/**
|
|
55
|
+
* Object is part the 'schema' set which is used
|
|
56
|
+
* to define data types in an OpenAPI document.
|
|
57
|
+
*/
|
|
58
|
+
oasType: "schema";
|
|
59
|
+
/**
|
|
60
|
+
* Constant value 'intersection' useful for type narrowing and tagged unions.
|
|
61
|
+
*/
|
|
62
|
+
type: "intersection";
|
|
63
|
+
/** A short summary of the intersection. */
|
|
64
|
+
title: string | undefined;
|
|
65
|
+
/** A description of the intersection. */
|
|
66
|
+
description: string | undefined;
|
|
67
|
+
/** External documentation for the intersection. */
|
|
68
|
+
externalDocs: OasExternalDocs | undefined;
|
|
69
|
+
/** Indicates whether the value can be null. */
|
|
70
|
+
nullable: boolean | undefined;
|
|
71
|
+
/** Whether the value is sent by the API only. */
|
|
72
|
+
readOnly: boolean | undefined;
|
|
73
|
+
/** Whether the value is sent in a request only. */
|
|
74
|
+
writeOnly: boolean | undefined;
|
|
75
|
+
/** Whether the value is deprecated. */
|
|
76
|
+
deprecated: boolean | undefined;
|
|
77
|
+
/** The schemas, or references to schemas, that a value matches all of. */
|
|
78
|
+
members: (OasSchema | OasRef<'schema'>)[];
|
|
79
|
+
/** Specification Extension fields */
|
|
80
|
+
extensionFields: Record<string, unknown> | undefined;
|
|
81
|
+
/** An example of the value. */
|
|
82
|
+
example?: unknown;
|
|
83
|
+
/** The default value. */
|
|
84
|
+
default?: unknown;
|
|
85
|
+
/**
|
|
86
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
87
|
+
* `system.not: unknown`. `undefined` otherwise.
|
|
88
|
+
*/
|
|
89
|
+
not: OasUnknown | undefined;
|
|
90
|
+
constructor(fields: IntersectionFields, context?: ParseContextType);
|
|
91
|
+
isRef(): this is OasRef<'schema'>;
|
|
92
|
+
/** Whether the value is `readOnly`: the intersection or one of its members is. */
|
|
93
|
+
isReadOnly(): boolean;
|
|
94
|
+
/** Whether the value is `writeOnly`: the intersection or one of its members is. */
|
|
95
|
+
isWriteOnly(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* The schemas a value matches all of, with each reference resolved and each
|
|
98
|
+
* intersection inside replaced by its own members. Each is given once, so a
|
|
99
|
+
* member that leads back to an intersection ends. A reference that names
|
|
100
|
+
* nothing is left out.
|
|
101
|
+
*/
|
|
102
|
+
toParts(): Exclude<OasSchema, OasIntersection>[];
|
|
103
|
+
/**
|
|
104
|
+
* {@link toParts} without the keywords next to the references. `clone` reads
|
|
105
|
+
* these while a reference to this intersection resolves, so no reference may
|
|
106
|
+
* be resolved with its keywords here.
|
|
107
|
+
*/
|
|
108
|
+
toTargetParts(): Exclude<OasSchema, OasIntersection>[];
|
|
109
|
+
/**
|
|
110
|
+
* A copy of this schema with what `ref` adds at its site applied, as
|
|
111
|
+
* {@link OasUnion.clone} does: the keywords that this type takes, a
|
|
112
|
+
* sibling's value winning. The keywords of an object next to `ref`
|
|
113
|
+
* (`properties`, `required`) are one more member, unless the members say
|
|
114
|
+
* the same. This schema does not
|
|
115
|
+
* change, and the copy shares its members.
|
|
116
|
+
*/
|
|
117
|
+
clone(ref?: OasRef<'schema'>): OasIntersection;
|
|
118
|
+
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
|
|
119
|
+
resolve(): OasIntersection;
|
|
120
|
+
resolveOnce(): OasIntersection;
|
|
121
|
+
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject;
|
|
122
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _OasIntersection_instances, _OasIntersection_toMembersInside;
|
|
7
|
+
import { traverseSchema } from '../schemaPath/traverseSchema.js';
|
|
8
|
+
import { OasObject } from '../object/Object.js';
|
|
9
|
+
import { toChangedObjectKeywords, toSiblingAnnotations } from '../schema/siblings.js';
|
|
10
|
+
import { OasBase } from '../../types/OasBase.js';
|
|
11
|
+
import { DanglingRefError } from '../ref/DanglingRefError.js';
|
|
12
|
+
/**
|
|
13
|
+
* An `allOf` that keeps at least one reference: a value matches every member.
|
|
14
|
+
*
|
|
15
|
+
* Core merges the members of an `allOf` into one schema. A reference that
|
|
16
|
+
* `client.json` `system.intersections` keeps is not merged: the schema is an
|
|
17
|
+
* `OasIntersection` of the kept references, and at most one other member, which
|
|
18
|
+
* the other members of the `allOf` merge into. By default those are the
|
|
19
|
+
* references that close a cycle.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // LineString: { allOf: [{ $ref: Geometry }, { properties: { coordinates } }] },
|
|
24
|
+
* // where a property of Geometry leads back to LineString
|
|
25
|
+
* lineString.members // [OasRef Geometry, OasObject { coordinates }]
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export class OasIntersection extends OasBase {
|
|
29
|
+
constructor(fields, context) {
|
|
30
|
+
super(context);
|
|
31
|
+
_OasIntersection_instances.add(this);
|
|
32
|
+
/**
|
|
33
|
+
* Object is part the 'schema' set which is used
|
|
34
|
+
* to define data types in an OpenAPI document.
|
|
35
|
+
*/
|
|
36
|
+
Object.defineProperty(this, "oasType", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: 'schema'
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Constant value 'intersection' useful for type narrowing and tagged unions.
|
|
44
|
+
*/
|
|
45
|
+
Object.defineProperty(this, "type", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true,
|
|
49
|
+
value: 'intersection'
|
|
50
|
+
});
|
|
51
|
+
/** A short summary of the intersection. */
|
|
52
|
+
Object.defineProperty(this, "title", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: void 0
|
|
57
|
+
});
|
|
58
|
+
/** A description of the intersection. */
|
|
59
|
+
Object.defineProperty(this, "description", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: void 0
|
|
64
|
+
});
|
|
65
|
+
/** External documentation for the intersection. */
|
|
66
|
+
Object.defineProperty(this, "externalDocs", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true,
|
|
70
|
+
value: void 0
|
|
71
|
+
});
|
|
72
|
+
/** Indicates whether the value can be null. */
|
|
73
|
+
Object.defineProperty(this, "nullable", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
value: void 0
|
|
78
|
+
});
|
|
79
|
+
/** Whether the value is sent by the API only. */
|
|
80
|
+
Object.defineProperty(this, "readOnly", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
configurable: true,
|
|
83
|
+
writable: true,
|
|
84
|
+
value: void 0
|
|
85
|
+
});
|
|
86
|
+
/** Whether the value is sent in a request only. */
|
|
87
|
+
Object.defineProperty(this, "writeOnly", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
configurable: true,
|
|
90
|
+
writable: true,
|
|
91
|
+
value: void 0
|
|
92
|
+
});
|
|
93
|
+
/** Whether the value is deprecated. */
|
|
94
|
+
Object.defineProperty(this, "deprecated", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
configurable: true,
|
|
97
|
+
writable: true,
|
|
98
|
+
value: void 0
|
|
99
|
+
});
|
|
100
|
+
/** The schemas, or references to schemas, that a value matches all of. */
|
|
101
|
+
Object.defineProperty(this, "members", {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
configurable: true,
|
|
104
|
+
writable: true,
|
|
105
|
+
value: void 0
|
|
106
|
+
});
|
|
107
|
+
/** Specification Extension fields */
|
|
108
|
+
Object.defineProperty(this, "extensionFields", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
configurable: true,
|
|
111
|
+
writable: true,
|
|
112
|
+
value: void 0
|
|
113
|
+
});
|
|
114
|
+
/** An example of the value. */
|
|
115
|
+
Object.defineProperty(this, "example", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
configurable: true,
|
|
118
|
+
writable: true,
|
|
119
|
+
value: void 0
|
|
120
|
+
});
|
|
121
|
+
/** The default value. */
|
|
122
|
+
Object.defineProperty(this, "default", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
configurable: true,
|
|
125
|
+
writable: true,
|
|
126
|
+
value: void 0
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
130
|
+
* `system.not: unknown`. `undefined` otherwise.
|
|
131
|
+
*/
|
|
132
|
+
Object.defineProperty(this, "not", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
configurable: true,
|
|
135
|
+
writable: true,
|
|
136
|
+
value: undefined
|
|
137
|
+
});
|
|
138
|
+
this.title = fields.title;
|
|
139
|
+
this.description = fields.description;
|
|
140
|
+
this.externalDocs = fields.externalDocs;
|
|
141
|
+
this.nullable = fields.nullable;
|
|
142
|
+
this.readOnly = fields.readOnly;
|
|
143
|
+
this.writeOnly = fields.writeOnly;
|
|
144
|
+
this.deprecated = fields.deprecated;
|
|
145
|
+
this.members = fields.members;
|
|
146
|
+
this.extensionFields = fields.extensionFields;
|
|
147
|
+
this.example = fields.example;
|
|
148
|
+
this.default = fields.default;
|
|
149
|
+
}
|
|
150
|
+
isRef() {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
/** Whether the value is `readOnly`: the intersection or one of its members is. */
|
|
154
|
+
isReadOnly() {
|
|
155
|
+
return __classPrivateFieldGet(this, _OasIntersection_instances, "m", _OasIntersection_toMembersInside).call(this).some(member => member.isRef() || member.type === 'intersection' ? member.readOnly === true : member.isReadOnly());
|
|
156
|
+
}
|
|
157
|
+
/** Whether the value is `writeOnly`: the intersection or one of its members is. */
|
|
158
|
+
isWriteOnly() {
|
|
159
|
+
return __classPrivateFieldGet(this, _OasIntersection_instances, "m", _OasIntersection_toMembersInside).call(this).some(member => member.isRef() || member.type === 'intersection' ? member.writeOnly === true : member.isWriteOnly());
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The schemas a value matches all of, with each reference resolved and each
|
|
163
|
+
* intersection inside replaced by its own members. Each is given once, so a
|
|
164
|
+
* member that leads back to an intersection ends. A reference that names
|
|
165
|
+
* nothing is left out.
|
|
166
|
+
*/
|
|
167
|
+
toParts() {
|
|
168
|
+
return __classPrivateFieldGet(this, _OasIntersection_instances, "m", _OasIntersection_toMembersInside).call(this).filter(isPart);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* {@link toParts} without the keywords next to the references. `clone` reads
|
|
172
|
+
* these while a reference to this intersection resolves, so no reference may
|
|
173
|
+
* be resolved with its keywords here.
|
|
174
|
+
*/
|
|
175
|
+
toTargetParts() {
|
|
176
|
+
return __classPrivateFieldGet(this, _OasIntersection_instances, "m", _OasIntersection_toMembersInside).call(this, ref => ref.resolveOnce()).filter(isPart);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A copy of this schema with what `ref` adds at its site applied, as
|
|
180
|
+
* {@link OasUnion.clone} does: the keywords that this type takes, a
|
|
181
|
+
* sibling's value winning. The keywords of an object next to `ref`
|
|
182
|
+
* (`properties`, `required`) are one more member, unless the members say
|
|
183
|
+
* the same. This schema does not
|
|
184
|
+
* change, and the copy shares its members.
|
|
185
|
+
*/
|
|
186
|
+
clone(ref) {
|
|
187
|
+
const copy = new OasIntersection({
|
|
188
|
+
...toSiblingAnnotations(this, ref),
|
|
189
|
+
example: ref?.example ?? this.example,
|
|
190
|
+
externalDocs: this.externalDocs,
|
|
191
|
+
nullable: this.nullable || ref?.nullable || undefined,
|
|
192
|
+
readOnly: this.readOnly || ref?.readOnly || undefined,
|
|
193
|
+
writeOnly: this.writeOnly || ref?.writeOnly || undefined,
|
|
194
|
+
deprecated: ref?.deprecated ?? this.deprecated,
|
|
195
|
+
members: ref !== undefined && toChangedObjectKeywords(this, ref).length > 0 ? [...this.members, toSiblingMember(ref)] : this.members,
|
|
196
|
+
default: ref?.default ?? this.default
|
|
197
|
+
});
|
|
198
|
+
copy.stackTrail = this.stackTrail;
|
|
199
|
+
copy.not = this.not;
|
|
200
|
+
return copy;
|
|
201
|
+
}
|
|
202
|
+
traverse(path) {
|
|
203
|
+
return traverseSchema(this, path);
|
|
204
|
+
}
|
|
205
|
+
resolve() {
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
208
|
+
resolveOnce() {
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
toJsonSchema(options) {
|
|
212
|
+
return {
|
|
213
|
+
title: this.title,
|
|
214
|
+
description: this.description,
|
|
215
|
+
nullable: this.nullable,
|
|
216
|
+
readOnly: this.readOnly,
|
|
217
|
+
writeOnly: this.writeOnly,
|
|
218
|
+
deprecated: this.deprecated,
|
|
219
|
+
example: this.example,
|
|
220
|
+
default: this.default,
|
|
221
|
+
allOf: this.members.map(member => member.toJsonSchema(options))
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
_OasIntersection_instances = new WeakSet(), _OasIntersection_toMembersInside = function _OasIntersection_toMembersInside(follow = ref => ref.resolve()) {
|
|
226
|
+
const found = new Set();
|
|
227
|
+
const visit = (item) => {
|
|
228
|
+
if (item === undefined || found.has(item)) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
found.add(item);
|
|
232
|
+
if (item.isRef()) {
|
|
233
|
+
visit(toTarget(() => follow(item)));
|
|
234
|
+
}
|
|
235
|
+
else if (item.type === 'intersection') {
|
|
236
|
+
item.members.forEach(visit);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
visit(this);
|
|
240
|
+
return [...found];
|
|
241
|
+
};
|
|
242
|
+
/** The keywords of an object next to a reference, as an object. */
|
|
243
|
+
const toSiblingMember = (ref) => {
|
|
244
|
+
const member = new OasObject({
|
|
245
|
+
properties: ref.properties,
|
|
246
|
+
required: ref.required,
|
|
247
|
+
additionalProperties: ref.additionalProperties,
|
|
248
|
+
minProperties: ref.minProperties,
|
|
249
|
+
maxProperties: ref.maxProperties
|
|
250
|
+
});
|
|
251
|
+
member.stackTrail = ref.stackTrail;
|
|
252
|
+
return member;
|
|
253
|
+
};
|
|
254
|
+
const isPart = (member) => !member.isRef() && member.type !== 'intersection';
|
|
255
|
+
/** What following a reference gives, or `undefined` when it names nothing. */
|
|
256
|
+
const toTarget = (follow) => {
|
|
257
|
+
try {
|
|
258
|
+
return follow();
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
if (DanglingRefError.is(error)) {
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
@@ -40,7 +40,7 @@ export type JsonContent = {
|
|
|
40
40
|
* Choose the media type a body is read from: `application/json` exactly when
|
|
41
41
|
* it is a key, else the first JSON-like key in document order (see
|
|
42
42
|
* {@link isJsonMediaType}), else the `*\/*` key when its schema is an object,
|
|
43
|
-
* array, union or `$ref`. `*\/*` admits JSON, and documents use it for JSON
|
|
43
|
+
* array, union, intersection or `$ref`. `*\/*` admits JSON, and documents use it for JSON
|
|
44
44
|
* bodies (springdoc writes it for every response); the parser logs
|
|
45
45
|
* `WILDCARD_MEDIA_TYPE` for every body read this way. `undefined` otherwise:
|
|
46
46
|
* there is no fall back to a specific non-JSON type, to a narrower range such
|
|
@@ -27,16 +27,16 @@ export const isJsonMediaType = (mediaType) => {
|
|
|
27
27
|
export const isAnyMediaType = (mediaType) => toMediaTypeEssence(mediaType) === '*/*';
|
|
28
28
|
/**
|
|
29
29
|
* True when a schema under `*\/*` can be read as one JSON value: an object,
|
|
30
|
-
* array, union or `$ref`. A scalar is not: under `*\/*` a `string` is usually
|
|
30
|
+
* array, union, intersection or `$ref`. A scalar is not: under `*\/*` a `string` is usually
|
|
31
31
|
* a text body, and `string` with `format: binary` a file.
|
|
32
32
|
*/
|
|
33
33
|
const isJsonShaped = (schema) => schema !== undefined &&
|
|
34
|
-
(schema.isRef() ||
|
|
34
|
+
(schema.isRef() || ['object', 'array', 'union', 'intersection'].includes(schema.type));
|
|
35
35
|
/**
|
|
36
36
|
* Choose the media type a body is read from: `application/json` exactly when
|
|
37
37
|
* it is a key, else the first JSON-like key in document order (see
|
|
38
38
|
* {@link isJsonMediaType}), else the `*\/*` key when its schema is an object,
|
|
39
|
-
* array, union or `$ref`. `*\/*` admits JSON, and documents use it for JSON
|
|
39
|
+
* array, union, intersection or `$ref`. `*\/*` admits JSON, and documents use it for JSON
|
|
40
40
|
* bodies (springdoc writes it for every response); the parser logs
|
|
41
41
|
* `WILDCARD_MEDIA_TYPE` for every body read this way. `undefined` otherwise:
|
|
42
42
|
* there is no fall back to a specific non-JSON type, to a narrower range such
|
|
@@ -296,7 +296,7 @@ export declare class OasRequestBody extends OasBase {
|
|
|
296
296
|
* `mediaType`, the schema of the JSON media type that {@link toJsonContent}
|
|
297
297
|
* picks: `application/json`, else the first JSON-like type such as
|
|
298
298
|
* `application/json;v=1.0` or `application/vnd.api+json`, else `*\/*`
|
|
299
|
-
* when its schema is an object, array, union or `$ref`.
|
|
299
|
+
* when its schema is an object, array, union, intersection or `$ref`.
|
|
300
300
|
* `undefined` when there is no such media type or it has no schema.
|
|
301
301
|
*/
|
|
302
302
|
toSchema(mediaType?: string): OasSchema | OasRef<'schema'> | undefined;
|
|
@@ -319,7 +319,7 @@ export class OasRequestBody extends OasBase {
|
|
|
319
319
|
* `mediaType`, the schema of the JSON media type that {@link toJsonContent}
|
|
320
320
|
* picks: `application/json`, else the first JSON-like type such as
|
|
321
321
|
* `application/json;v=1.0` or `application/vnd.api+json`, else `*\/*`
|
|
322
|
-
* when its schema is an object, array, union or `$ref`.
|
|
322
|
+
* when its schema is an object, array, union, intersection or `$ref`.
|
|
323
323
|
* `undefined` when there is no such media type or it has no schema.
|
|
324
324
|
*/
|
|
325
325
|
toSchema(mediaType) {
|
|
@@ -230,7 +230,7 @@ export declare class OasResponse extends OasBase {
|
|
|
230
230
|
* `mediaType`, the schema of the JSON media type that {@link toJsonContent}
|
|
231
231
|
* picks: `application/json`, else the first JSON-like type such as
|
|
232
232
|
* `application/json;v=1.0` or `application/vnd.api+json`, else `*\/*`
|
|
233
|
-
* when its schema is an object, array, union or `$ref`.
|
|
233
|
+
* when its schema is an object, array, union, intersection or `$ref`.
|
|
234
234
|
* `undefined` when there is no such media type or it has no schema.
|
|
235
235
|
*/
|
|
236
236
|
toSchema(mediaType?: string): OasSchema | OasRef<'schema'> | undefined;
|
|
@@ -259,7 +259,7 @@ export class OasResponse extends OasBase {
|
|
|
259
259
|
* `mediaType`, the schema of the JSON media type that {@link toJsonContent}
|
|
260
260
|
* picks: `application/json`, else the first JSON-like type such as
|
|
261
261
|
* `application/json;v=1.0` or `application/vnd.api+json`, else `*\/*`
|
|
262
|
-
* when its schema is an object, array, union or `$ref`.
|
|
262
|
+
* when its schema is an object, array, union, intersection or `$ref`.
|
|
263
263
|
* `undefined` when there is no such media type or it has no schema.
|
|
264
264
|
*/
|
|
265
265
|
toSchema(mediaType) {
|