@skmtc/core 0.34.0 → 0.35.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/generateTypes.d.ts +2 -2
- package/esm/context/generateTypes.js +5 -0
- package/esm/parse/descriptiveFields.d.ts +36 -0
- package/esm/parse/descriptiveFields.js +56 -0
- package/esm/parse/isPlainObject.d.ts +2 -0
- package/esm/parse/isPlainObject.js +2 -0
- package/esm/parse/toComponentEntries.d.ts +29 -0
- package/esm/parse/toComponentEntries.js +31 -0
- package/esm/parse/toPresentInfo.d.ts +30 -0
- package/esm/parse/toPresentInfo.js +40 -0
- package/esm/parse/v3-0/components/toComponentsV3.js +2 -2
- package/esm/parse/v3-0/externalDocs/toExternalDocs.d.ts +3 -1
- package/esm/parse/v3-0/externalDocs/toExternalDocs.js +9 -8
- package/esm/parse/v3-0/header/toHeadersV3.d.ts +12 -0
- package/esm/parse/v3-0/header/toHeadersV3.js +20 -0
- package/esm/parse/v3-0/info/toInfoV3.d.ts +2 -1
- package/esm/parse/v3-0/info/toInfoV3.js +15 -4
- package/esm/parse/v3-0/requestBody/toRequestBodiesV3.js +9 -9
- package/esm/parse/v3-0/tag/toTagsV3.js +7 -2
- package/esm/parse/v3-1/components/toComponentsV3.js +2 -2
- package/esm/parse/v3-1/externalDocs/toExternalDocs.d.ts +3 -1
- package/esm/parse/v3-1/externalDocs/toExternalDocs.js +9 -8
- package/esm/parse/v3-1/header/toHeadersV3.d.ts +12 -0
- package/esm/parse/v3-1/header/toHeadersV3.js +20 -0
- package/esm/parse/v3-1/info/toInfoV3.d.ts +2 -1
- package/esm/parse/v3-1/info/toInfoV3.js +15 -4
- package/esm/parse/v3-1/requestBody/toRequestBodiesV3.js +9 -9
- package/esm/parse/v3-1/tag/toTagsV3.js +7 -2
- package/esm/parse/v3-2/components/toComponentsV3.js +2 -2
- package/esm/parse/v3-2/externalDocs/toExternalDocs.d.ts +3 -1
- package/esm/parse/v3-2/externalDocs/toExternalDocs.js +9 -8
- package/esm/parse/v3-2/header/toHeadersV3.d.ts +12 -0
- package/esm/parse/v3-2/header/toHeadersV3.js +20 -0
- package/esm/parse/v3-2/info/toInfoV3.d.ts +2 -1
- package/esm/parse/v3-2/info/toInfoV3.js +15 -4
- package/esm/parse/v3-2/requestBody/toRequestBodiesV3.js +9 -9
- package/esm/parse/v3-2/tag/toTagsV3.js +14 -7
- package/package.json +1 -1
- package/script/context/generateTypes.d.ts +2 -2
- package/script/context/generateTypes.js +5 -0
- package/script/parse/descriptiveFields.d.ts +36 -0
- package/script/parse/descriptiveFields.js +95 -0
- package/script/parse/isPlainObject.d.ts +2 -0
- package/script/parse/isPlainObject.js +6 -0
- package/script/parse/toComponentEntries.d.ts +29 -0
- package/script/parse/toComponentEntries.js +35 -0
- package/script/parse/toPresentInfo.d.ts +30 -0
- package/script/parse/toPresentInfo.js +45 -0
- package/script/parse/v3-0/components/toComponentsV3.js +1 -1
- package/script/parse/v3-0/externalDocs/toExternalDocs.d.ts +3 -1
- package/script/parse/v3-0/externalDocs/toExternalDocs.js +9 -41
- package/script/parse/v3-0/header/toHeadersV3.d.ts +12 -0
- package/script/parse/v3-0/header/toHeadersV3.js +22 -1
- package/script/parse/v3-0/info/toInfoV3.d.ts +2 -1
- package/script/parse/v3-0/info/toInfoV3.js +15 -4
- package/script/parse/v3-0/requestBody/toRequestBodiesV3.js +9 -9
- package/script/parse/v3-0/tag/toTagsV3.js +7 -2
- package/script/parse/v3-1/components/toComponentsV3.js +1 -1
- package/script/parse/v3-1/externalDocs/toExternalDocs.d.ts +3 -1
- package/script/parse/v3-1/externalDocs/toExternalDocs.js +9 -41
- package/script/parse/v3-1/header/toHeadersV3.d.ts +12 -0
- package/script/parse/v3-1/header/toHeadersV3.js +22 -1
- package/script/parse/v3-1/info/toInfoV3.d.ts +2 -1
- package/script/parse/v3-1/info/toInfoV3.js +15 -4
- package/script/parse/v3-1/requestBody/toRequestBodiesV3.js +9 -9
- package/script/parse/v3-1/tag/toTagsV3.js +7 -2
- package/script/parse/v3-2/components/toComponentsV3.js +1 -1
- package/script/parse/v3-2/externalDocs/toExternalDocs.d.ts +3 -1
- package/script/parse/v3-2/externalDocs/toExternalDocs.js +9 -41
- package/script/parse/v3-2/header/toHeadersV3.d.ts +12 -0
- package/script/parse/v3-2/header/toHeadersV3.js +22 -1
- package/script/parse/v3-2/info/toInfoV3.d.ts +2 -1
- package/script/parse/v3-2/info/toInfoV3.js +15 -4
- package/script/parse/v3-2/requestBody/toRequestBodiesV3.js +9 -9
- package/script/parse/v3-2/tag/toTagsV3.js +14 -7
|
@@ -167,7 +167,7 @@ export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3
|
|
|
167
167
|
* scalar schema (a text body or a file). A body with only specific
|
|
168
168
|
* non-JSON types (`multipart/form-data`, `text/plain`) logs nothing.
|
|
169
169
|
*/
|
|
170
|
-
export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE';
|
|
170
|
+
export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'MISSING_INFO' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_REQUEST_BODY' | 'INVALID_HEADER' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'INVALID_TAG' | 'INVALID_EXTERNAL_DOCS' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE';
|
|
171
171
|
/**
|
|
172
172
|
* Valibot schema for {@link OasIssueType}. Annotation deliberately omitted
|
|
173
173
|
* so the precise literal-union output type flows through to consumers
|
|
@@ -175,7 +175,7 @@ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISS
|
|
|
175
175
|
* this list and {@link OasIssueType} is caught by `assertSchemaMatchesType`
|
|
176
176
|
* below.
|
|
177
177
|
*/
|
|
178
|
-
export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>], undefined>;
|
|
178
|
+
export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"MISSING_INFO", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_REQUEST_BODY", undefined>, v.LiteralSchema<"INVALID_HEADER", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"INVALID_TAG", undefined>, v.LiteralSchema<"INVALID_EXTERNAL_DOCS", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>], undefined>;
|
|
179
179
|
export type GenerateResult = {
|
|
180
180
|
files: Map<string, FileBase>;
|
|
181
181
|
previews: Record<string, Preview>;
|
|
@@ -13,6 +13,7 @@ export const oasIssueType = v.union([
|
|
|
13
13
|
v.literal('MISSING_ARRAY_TYPE'),
|
|
14
14
|
v.literal('MISSING_BOOLEAN_TYPE'),
|
|
15
15
|
v.literal('MISSING_RESPONSES'),
|
|
16
|
+
v.literal('MISSING_INFO'),
|
|
16
17
|
v.literal('EMPTY_PARAMETER'),
|
|
17
18
|
v.literal('INVALID_EXAMPLE'),
|
|
18
19
|
v.literal('INVALID_ENUM'),
|
|
@@ -20,6 +21,8 @@ export const oasIssueType = v.union([
|
|
|
20
21
|
v.literal('INVALID_NULLABLE'),
|
|
21
22
|
v.literal('UNEXPECTED_FORMAT'),
|
|
22
23
|
v.literal('INVALID_RESPONSE'),
|
|
24
|
+
v.literal('INVALID_REQUEST_BODY'),
|
|
25
|
+
v.literal('INVALID_HEADER'),
|
|
23
26
|
v.literal('INVALID_FORMAT'),
|
|
24
27
|
v.literal('INVALID_OPERATION'),
|
|
25
28
|
v.literal('INVALID_SCHEMA'),
|
|
@@ -28,6 +31,8 @@ export const oasIssueType = v.union([
|
|
|
28
31
|
v.literal('INVALID_DEPENDENCY_REF'),
|
|
29
32
|
v.literal('EXAMPLE_AND_EXAMPLES_DEFINED'),
|
|
30
33
|
v.literal('INVALID_TAG_PARENT'),
|
|
34
|
+
v.literal('INVALID_TAG'),
|
|
35
|
+
v.literal('INVALID_EXTERNAL_DOCS'),
|
|
31
36
|
v.literal('UNSUPPORTED_OPERATION_METHOD'),
|
|
32
37
|
v.literal('WILDCARD_MEDIA_TYPE'),
|
|
33
38
|
v.literal('NO_JSON_MEDIA_TYPE')
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ParseContextType } from '../context/parseTypes.js';
|
|
2
|
+
import type { StackTrail } from '../context/StackTrail.js';
|
|
3
|
+
import { type OasExternalDocsData } from '../oas/externalDocs/externalDocsTypes.js';
|
|
4
|
+
export type ToTagListArgs<Tag> = {
|
|
5
|
+
tags: Tag[];
|
|
6
|
+
/** Trail that ends in the `tags` key. */
|
|
7
|
+
stackTrail: StackTrail;
|
|
8
|
+
context: ParseContextType;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Check the root `tags` field before its entries are parsed. Not an array:
|
|
12
|
+
* logs one `INVALID_TAG` warning and returns `undefined`, read as no tags.
|
|
13
|
+
*/
|
|
14
|
+
export declare const toTagList: <Tag>({ tags, stackTrail, context }: ToTagListArgs<Tag>) => Tag[] | undefined;
|
|
15
|
+
export type IsValidTagArgs = {
|
|
16
|
+
tag: unknown;
|
|
17
|
+
/** Trail that ends in the entry's index. */
|
|
18
|
+
stackTrail: StackTrail;
|
|
19
|
+
context: ParseContextType;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A tag entry must be a plain object with a string `name`. Any other entry
|
|
23
|
+
* logs one `INVALID_TAG` warning, and the caller leaves it out.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isValidTag: ({ tag, stackTrail, context }: IsValidTagArgs) => boolean;
|
|
26
|
+
export type ToValidExternalDocsArgs = {
|
|
27
|
+
externalDocs: unknown;
|
|
28
|
+
/** Trail that ends in the `externalDocs` key. */
|
|
29
|
+
stackTrail: StackTrail;
|
|
30
|
+
context: ParseContextType;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Validate an `externalDocs` object. One that fails `oasExternalDocsData`
|
|
34
|
+
* logs one `INVALID_EXTERNAL_DOCS` warning and returns `undefined`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const toValidExternalDocs: ({ externalDocs, stackTrail, context }: ToValidExternalDocsArgs) => OasExternalDocsData | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { isPlainObject } from './isPlainObject.js';
|
|
3
|
+
import { oasExternalDocsData } from '../oas/externalDocs/externalDocsTypes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Check the root `tags` field before its entries are parsed. Not an array:
|
|
6
|
+
* logs one `INVALID_TAG` warning and returns `undefined`, read as no tags.
|
|
7
|
+
*/
|
|
8
|
+
export const toTagList = ({ tags, stackTrail, context }) => {
|
|
9
|
+
if (Array.isArray(tags)) {
|
|
10
|
+
return tags;
|
|
11
|
+
}
|
|
12
|
+
context.logIssueNoKey({
|
|
13
|
+
stackTrail,
|
|
14
|
+
parent: tags,
|
|
15
|
+
level: 'warning',
|
|
16
|
+
type: 'INVALID_TAG',
|
|
17
|
+
message: '"tags" must be an array; left out'
|
|
18
|
+
});
|
|
19
|
+
return undefined;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A tag entry must be a plain object with a string `name`. Any other entry
|
|
23
|
+
* logs one `INVALID_TAG` warning, and the caller leaves it out.
|
|
24
|
+
*/
|
|
25
|
+
export const isValidTag = ({ tag, stackTrail, context }) => {
|
|
26
|
+
if (isPlainObject(tag) && typeof tag.name === 'string') {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
context.logIssueNoKey({
|
|
30
|
+
stackTrail,
|
|
31
|
+
parent: tag,
|
|
32
|
+
level: 'warning',
|
|
33
|
+
type: 'INVALID_TAG',
|
|
34
|
+
message: 'Tag is not an object with a string name; left out'
|
|
35
|
+
});
|
|
36
|
+
return false;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Validate an `externalDocs` object. One that fails `oasExternalDocsData`
|
|
40
|
+
* logs one `INVALID_EXTERNAL_DOCS` warning and returns `undefined`.
|
|
41
|
+
*/
|
|
42
|
+
export const toValidExternalDocs = ({ externalDocs, stackTrail, context }) => {
|
|
43
|
+
const result = v.safeParse(oasExternalDocsData, externalDocs);
|
|
44
|
+
if (result.success) {
|
|
45
|
+
return result.output;
|
|
46
|
+
}
|
|
47
|
+
const reason = result.issues.map(({ message }) => message).join(', ');
|
|
48
|
+
context.logIssueNoKey({
|
|
49
|
+
stackTrail,
|
|
50
|
+
parent: externalDocs,
|
|
51
|
+
level: 'warning',
|
|
52
|
+
type: 'INVALID_EXTERNAL_DOCS',
|
|
53
|
+
message: `External docs object is invalid (${reason}); left out`
|
|
54
|
+
});
|
|
55
|
+
return undefined;
|
|
56
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ParseContextType } from '../context/parseTypes.js';
|
|
2
|
+
import type { StackTrail } from '../context/StackTrail.js';
|
|
3
|
+
import type { OasIssueType } from '../context/generateTypes.js';
|
|
4
|
+
export type ToComponentEntriesArgs<Entry, Parsed> = {
|
|
5
|
+
entries: Record<string, Entry>;
|
|
6
|
+
/** Trail that ends in the bucket key, e.g. `components:headers`. */
|
|
7
|
+
stackTrail: StackTrail;
|
|
8
|
+
context: ParseContextType;
|
|
9
|
+
/** Issue type logged for an entry that fails to parse. */
|
|
10
|
+
type: OasIssueType;
|
|
11
|
+
/** Names the entry in the message, e.g. `Request body`. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Parses one entry. An `undefined` result leaves the entry out. */
|
|
14
|
+
parse: (args: {
|
|
15
|
+
key: string;
|
|
16
|
+
entry: Entry;
|
|
17
|
+
stackTrail: StackTrail;
|
|
18
|
+
}) => Parsed | undefined;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Parse each entry of a `components` bucket inside its own `tryParseAt`
|
|
22
|
+
* boundary. Shared by the 3.0, 3.1 and 3.2 parsers.
|
|
23
|
+
*
|
|
24
|
+
* An entry that is not a plain object (`null`, an array, a string), or that
|
|
25
|
+
* throws while it parses, is dropped with one error of `type` at its
|
|
26
|
+
* location. Consumers reference it by name, so leaving it out silently would
|
|
27
|
+
* change what they render. The other entries are kept.
|
|
28
|
+
*/
|
|
29
|
+
export declare const toComponentEntries: <Entry, Parsed>({ entries, stackTrail, context, type, label, parse }: ToComponentEntriesArgs<Entry, Parsed>) => Record<string, Parsed>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { tryParseAt } from '../context/tryParseAt.js';
|
|
2
|
+
import { isPlainObject } from './isPlainObject.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse each entry of a `components` bucket inside its own `tryParseAt`
|
|
5
|
+
* boundary. Shared by the 3.0, 3.1 and 3.2 parsers.
|
|
6
|
+
*
|
|
7
|
+
* An entry that is not a plain object (`null`, an array, a string), or that
|
|
8
|
+
* throws while it parses, is dropped with one error of `type` at its
|
|
9
|
+
* location. Consumers reference it by name, so leaving it out silently would
|
|
10
|
+
* change what they render. The other entries are kept.
|
|
11
|
+
*/
|
|
12
|
+
export const toComponentEntries = ({ entries, stackTrail, context, type, label, parse }) => {
|
|
13
|
+
const parsedEntries = Object.entries(entries).flatMap(([key, entry]) => {
|
|
14
|
+
const parsed = tryParseAt({
|
|
15
|
+
stackTrail,
|
|
16
|
+
key,
|
|
17
|
+
context,
|
|
18
|
+
type,
|
|
19
|
+
parent: entry,
|
|
20
|
+
fn: st => {
|
|
21
|
+
if (!isPlainObject(entry)) {
|
|
22
|
+
throw new Error(`${label} must be an object, got ${toKind(entry)}`);
|
|
23
|
+
}
|
|
24
|
+
return parse({ key, entry, stackTrail: st });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return parsed === undefined ? [] : [[key, parsed]];
|
|
28
|
+
});
|
|
29
|
+
return Object.fromEntries(parsedEntries);
|
|
30
|
+
};
|
|
31
|
+
const toKind = (value) => value === null ? 'null' : Array.isArray(value) ? 'an array' : typeof value;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ParseContextType } from '../context/parseTypes.js';
|
|
2
|
+
import type { StackTrail } from '../context/StackTrail.js';
|
|
3
|
+
export type ToPresentInfoArgs<Info extends object> = {
|
|
4
|
+
info: Info | null | undefined;
|
|
5
|
+
/** Trail that ends in the `info` key. */
|
|
6
|
+
stackTrail: StackTrail;
|
|
7
|
+
context: ParseContextType;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Check the document's `info` field before its fields are parsed. Shared by
|
|
11
|
+
* the 3.0, 3.1 and 3.2 parsers.
|
|
12
|
+
*
|
|
13
|
+
* Missing, `null` or not a plain object: logs one `MISSING_INFO` warning and
|
|
14
|
+
* returns `undefined`. The caller reads it as an empty title and version.
|
|
15
|
+
*/
|
|
16
|
+
export declare const toPresentInfo: <Info extends object>({ info, stackTrail, context }: ToPresentInfoArgs<Info>) => Info | undefined;
|
|
17
|
+
export type ToInfoStringArgs = {
|
|
18
|
+
value: unknown;
|
|
19
|
+
key: 'title' | 'version';
|
|
20
|
+
parent: unknown;
|
|
21
|
+
/** Trail that ends in the `info` key. */
|
|
22
|
+
stackTrail: StackTrail;
|
|
23
|
+
context: ParseContextType;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Read `info.title` or `info.version`. A value that is not a string (missing,
|
|
27
|
+
* or a YAML number such as `version: 1.0`) logs one `MISSING_INFO` warning
|
|
28
|
+
* and reads as `''`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const toInfoString: ({ value, key, parent, stackTrail, context }: ToInfoStringArgs) => string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isPlainObject } from './isPlainObject.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check the document's `info` field before its fields are parsed. Shared by
|
|
4
|
+
* the 3.0, 3.1 and 3.2 parsers.
|
|
5
|
+
*
|
|
6
|
+
* Missing, `null` or not a plain object: logs one `MISSING_INFO` warning and
|
|
7
|
+
* returns `undefined`. The caller reads it as an empty title and version.
|
|
8
|
+
*/
|
|
9
|
+
export const toPresentInfo = ({ info, stackTrail, context }) => {
|
|
10
|
+
if (!isPlainObject(info)) {
|
|
11
|
+
context.logIssueNoKey({
|
|
12
|
+
stackTrail,
|
|
13
|
+
parent: info,
|
|
14
|
+
level: 'warning',
|
|
15
|
+
type: 'MISSING_INFO',
|
|
16
|
+
message: 'Document has no info object; read as empty title and version'
|
|
17
|
+
});
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return info;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Read `info.title` or `info.version`. A value that is not a string (missing,
|
|
24
|
+
* or a YAML number such as `version: 1.0`) logs one `MISSING_INFO` warning
|
|
25
|
+
* and reads as `''`.
|
|
26
|
+
*/
|
|
27
|
+
export const toInfoString = ({ value, key, parent, stackTrail, context }) => {
|
|
28
|
+
if (typeof value === 'string') {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
context.logIssue({
|
|
32
|
+
key,
|
|
33
|
+
stackTrail,
|
|
34
|
+
parent,
|
|
35
|
+
level: 'warning',
|
|
36
|
+
type: 'MISSING_INFO',
|
|
37
|
+
message: `Info has no string ${key}; read as ''`
|
|
38
|
+
});
|
|
39
|
+
return '';
|
|
40
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toOptionalResponsesV3 } from '../response/toResponseV3.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toComponentHeadersV3 } from '../header/toHeadersV3.js';
|
|
3
3
|
import { toLinksV3 } from '../link/toLinksV3.js';
|
|
4
4
|
import { toOptionalSchemasV3 } from '../schema/toSchemasV3.js';
|
|
5
5
|
import { toOptionalParametersV3 } from '../parameter/toParameterV3.js';
|
|
@@ -32,7 +32,7 @@ export const toComponentsV3 = ({ components, stackTrail, context }) => {
|
|
|
32
32
|
context
|
|
33
33
|
}),
|
|
34
34
|
requestBodies: stackTrail.trace('requestBodies', st => toRequestBodiesV3({ requestBodies, stackTrail: st, context })),
|
|
35
|
-
headers: stackTrail.trace('headers', st =>
|
|
35
|
+
headers: stackTrail.trace('headers', st => toComponentHeadersV3({ headers, stackTrail: st, context })),
|
|
36
36
|
securitySchemes: stackTrail.trace('securitySchemes', st => toSecuritySchemesV3({ securitySchemes, stackTrail: st, context })),
|
|
37
37
|
links: stackTrail.trace('links', st => toLinksV3({ links, stackTrail: st, context })),
|
|
38
38
|
extensionFields
|
|
@@ -4,7 +4,9 @@ import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
|
4
4
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
5
|
export type ToExternalDocsArgs = {
|
|
6
6
|
externalDocs: OpenAPIV3.ExternalDocumentationObject | undefined;
|
|
7
|
+
/** Trail that ends in the `externalDocs` key. */
|
|
7
8
|
stackTrail: StackTrail;
|
|
8
9
|
context: ParseContextType;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
/** An invalid `externalDocs` is left out with a warning; its parent is kept. */
|
|
12
|
+
export declare const toExternalDocs: ({ externalDocs, stackTrail, context }: ToExternalDocsArgs) => OasExternalDocs | undefined;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { OasExternalDocs } from '../../../oas/externalDocs/ExternalDocs.js';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export const toExternalDocs = ({ externalDocs, stackTrail }) => {
|
|
5
|
-
if (
|
|
2
|
+
import { toValidExternalDocs } from '../../descriptiveFields.js';
|
|
3
|
+
/** An invalid `externalDocs` is left out with a warning; its parent is kept. */
|
|
4
|
+
export const toExternalDocs = ({ externalDocs, stackTrail, context }) => {
|
|
5
|
+
if (externalDocs === undefined) {
|
|
6
6
|
return undefined;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const valid = toValidExternalDocs({ externalDocs, stackTrail, context });
|
|
9
|
+
if (!valid) {
|
|
10
|
+
return undefined;
|
|
10
11
|
}
|
|
11
12
|
return new OasExternalDocs({
|
|
12
|
-
url:
|
|
13
|
-
description:
|
|
13
|
+
url: valid.url,
|
|
14
|
+
description: valid.description
|
|
14
15
|
});
|
|
15
16
|
};
|
|
@@ -9,6 +9,18 @@ export type ToHeadersV3Args = {
|
|
|
9
9
|
context: ParseContextType;
|
|
10
10
|
};
|
|
11
11
|
export declare const toHeadersV3: ({ headers, stackTrail, context }: ToHeadersV3Args) => Record<string, OasHeader | OasRef<"header">> | undefined;
|
|
12
|
+
export type ToComponentHeadersV3Args = {
|
|
13
|
+
headers: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.HeaderObject> | undefined;
|
|
14
|
+
stackTrail: StackTrail;
|
|
15
|
+
context: ParseContextType;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Parse `components.headers`. Each entry parses inside its own boundary: a
|
|
19
|
+
* broken one is dropped with an INVALID_HEADER error, and the others are
|
|
20
|
+
* kept. Headers inside a response stay with {@link toHeadersV3}, where a
|
|
21
|
+
* broken header drops the response.
|
|
22
|
+
*/
|
|
23
|
+
export declare const toComponentHeadersV3: ({ headers, stackTrail, context }: ToComponentHeadersV3Args) => Record<string, OasHeader | OasRef<"header">> | undefined;
|
|
12
24
|
export type ToHeaderV3Args = {
|
|
13
25
|
header: OpenAPIV3.ReferenceObject | OpenAPIV3.HeaderObject;
|
|
14
26
|
/** The header's name, used to key a singular `example` */
|
|
@@ -5,6 +5,7 @@ import { isRef } from '../../../helpers/refFns.js';
|
|
|
5
5
|
import { toOptionalMediaTypeItemsV3 } from '../mediaType/toMediaTypeItemV3.js';
|
|
6
6
|
import { OasHeader } from '../../../oas/header/Header.js';
|
|
7
7
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
8
|
+
import { toComponentEntries } from '../../toComponentEntries.js';
|
|
8
9
|
export const toHeadersV3 = ({ headers, stackTrail, context }) => {
|
|
9
10
|
if (!headers) {
|
|
10
11
|
return undefined;
|
|
@@ -16,6 +17,25 @@ export const toHeadersV3 = ({ headers, stackTrail, context }) => {
|
|
|
16
17
|
}
|
|
17
18
|
return output;
|
|
18
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Parse `components.headers`. Each entry parses inside its own boundary: a
|
|
22
|
+
* broken one is dropped with an INVALID_HEADER error, and the others are
|
|
23
|
+
* kept. Headers inside a response stay with {@link toHeadersV3}, where a
|
|
24
|
+
* broken header drops the response.
|
|
25
|
+
*/
|
|
26
|
+
export const toComponentHeadersV3 = ({ headers, stackTrail, context }) => {
|
|
27
|
+
if (!headers) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return toComponentEntries({
|
|
31
|
+
entries: headers,
|
|
32
|
+
stackTrail,
|
|
33
|
+
context,
|
|
34
|
+
type: 'INVALID_HEADER',
|
|
35
|
+
label: 'Header',
|
|
36
|
+
parse: ({ key, entry, stackTrail: st }) => toHeaderV3({ header: entry, name: key, stackTrail: st, context })
|
|
37
|
+
});
|
|
38
|
+
};
|
|
19
39
|
const toHeaderV3 = ({ header, name, stackTrail, context }) => {
|
|
20
40
|
if (isRef(header)) {
|
|
21
41
|
return toRefV31({ ref: header, refType: 'header', stackTrail, context });
|
|
@@ -3,7 +3,8 @@ import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
|
3
3
|
import { OasInfo } from '../../../oas/info/Info.js';
|
|
4
4
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
5
|
export type ToInfoV3Args = {
|
|
6
|
-
|
|
6
|
+
/** Required by the spec; a document without it still parses (see {@link toPresentInfo}). */
|
|
7
|
+
info: OpenAPIV3.InfoObject | null | undefined;
|
|
7
8
|
stackTrail: StackTrail;
|
|
8
9
|
context: ParseContextType;
|
|
9
10
|
};
|
|
@@ -2,22 +2,33 @@ import { OasInfo } from '../../../oas/info/Info.js';
|
|
|
2
2
|
import { toContactV3 } from '../contact/toContactV3.js';
|
|
3
3
|
import { toLicenseV3 } from '../license/toLicenseV3.js';
|
|
4
4
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
5
|
+
import { toInfoString, toPresentInfo } from '../../toPresentInfo.js';
|
|
5
6
|
export const toInfoV3 = ({ info, stackTrail, context }) => {
|
|
6
|
-
const
|
|
7
|
+
const presentInfo = toPresentInfo({ info, stackTrail, context });
|
|
8
|
+
if (presentInfo === undefined) {
|
|
9
|
+
return new OasInfo({ title: '', version: '' });
|
|
10
|
+
}
|
|
11
|
+
const { title, description, termsOfService, contact, license, version, ...skipped } = presentInfo;
|
|
7
12
|
const extensionFields = toSpecificationExtensionsV3({
|
|
8
13
|
skipped,
|
|
9
|
-
parent:
|
|
14
|
+
parent: presentInfo,
|
|
10
15
|
context,
|
|
11
16
|
stackTrail,
|
|
12
17
|
parentType: 'info'
|
|
13
18
|
});
|
|
14
19
|
return new OasInfo({
|
|
15
|
-
title,
|
|
20
|
+
title: toInfoString({ value: title, key: 'title', parent: presentInfo, stackTrail, context }),
|
|
16
21
|
description,
|
|
17
22
|
termsOfService,
|
|
18
23
|
contact: contact ? toContactV3(contact, stackTrail, context) : undefined,
|
|
19
24
|
license: license ? toLicenseV3(license, stackTrail, context) : undefined,
|
|
20
|
-
version
|
|
25
|
+
version: toInfoString({
|
|
26
|
+
value: version,
|
|
27
|
+
key: 'version',
|
|
28
|
+
parent: presentInfo,
|
|
29
|
+
stackTrail,
|
|
30
|
+
context
|
|
31
|
+
}),
|
|
21
32
|
extensionFields
|
|
22
33
|
});
|
|
23
34
|
};
|
|
@@ -4,6 +4,7 @@ import { toMediaTypeItemsV3 } from '../mediaType/toMediaTypeItemV3.js';
|
|
|
4
4
|
import { OasRequestBody } from '../../../oas/requestBody/RequestBody.js';
|
|
5
5
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
6
6
|
import { logBodyMediaTypes } from '../../logBodyMediaTypes.js';
|
|
7
|
+
import { toComponentEntries } from '../../toComponentEntries.js';
|
|
7
8
|
export const toRequestBodyV3 = ({ requestBody, stackTrail, context }) => {
|
|
8
9
|
if (!requestBody) {
|
|
9
10
|
return undefined;
|
|
@@ -35,13 +36,12 @@ export const toRequestBodiesV3 = ({ requestBodies, stackTrail, context }) => {
|
|
|
35
36
|
if (!requestBodies) {
|
|
36
37
|
return undefined;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return Object.fromEntries(entries);
|
|
39
|
+
return toComponentEntries({
|
|
40
|
+
entries: requestBodies,
|
|
41
|
+
stackTrail,
|
|
42
|
+
context,
|
|
43
|
+
type: 'INVALID_REQUEST_BODY',
|
|
44
|
+
label: 'Request body',
|
|
45
|
+
parse: ({ entry, stackTrail: st }) => toRequestBodyV3({ requestBody: entry, stackTrail: st, context })
|
|
46
|
+
});
|
|
47
47
|
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { OasTag } from '../../../oas/tag/Tag.js';
|
|
2
2
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
3
|
import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
|
|
4
|
+
import { isValidTag, toTagList } from '../../descriptiveFields.js';
|
|
4
5
|
export const toTagsV3 = ({ tags, stackTrail, context }) => {
|
|
5
|
-
if (
|
|
6
|
+
if (tags === undefined) {
|
|
6
7
|
return undefined;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
// A malformed entry, or a `tags` that is not an array, is left out with a
|
|
10
|
+
// warning: tags do not change how an operation renders.
|
|
11
|
+
return toTagList({ tags, stackTrail, context })?.flatMap((tag, index) => stackTrail.trace(`${index}`, st => isValidTag({ tag, stackTrail: st, context })
|
|
12
|
+
? [toTagV3({ tag, stackTrail: st, context })]
|
|
13
|
+
: []));
|
|
9
14
|
};
|
|
10
15
|
export const toTagV3 = ({ tag, stackTrail, context }) => {
|
|
11
16
|
const { name, description, externalDocs, ...skipped } = tag;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toOptionalResponsesV3 } from '../response/toResponseV3.js';
|
|
2
|
-
import {
|
|
2
|
+
import { toComponentHeadersV3 } from '../header/toHeadersV3.js';
|
|
3
3
|
import { toLinksV3 } from '../link/toLinksV3.js';
|
|
4
4
|
import { toOptionalSchemasV3 } from '../schema/toSchemasV3.js';
|
|
5
5
|
import { toOptionalParametersV3 } from '../parameter/toParameterV3.js';
|
|
@@ -32,7 +32,7 @@ export const toComponentsV3 = ({ components, stackTrail, context }) => {
|
|
|
32
32
|
context
|
|
33
33
|
}),
|
|
34
34
|
requestBodies: stackTrail.trace('requestBodies', st => toRequestBodiesV3({ requestBodies, stackTrail: st, context })),
|
|
35
|
-
headers: stackTrail.trace('headers', st =>
|
|
35
|
+
headers: stackTrail.trace('headers', st => toComponentHeadersV3({ headers, stackTrail: st, context })),
|
|
36
36
|
securitySchemes: stackTrail.trace('securitySchemes', st => toSecuritySchemesV3({ securitySchemes, stackTrail: st, context })),
|
|
37
37
|
links: stackTrail.trace('links', st => toLinksV3({ links, stackTrail: st, context })),
|
|
38
38
|
extensionFields
|
|
@@ -4,7 +4,9 @@ import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
|
4
4
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
5
|
export type ToExternalDocsArgs = {
|
|
6
6
|
externalDocs: OpenAPIV3.ExternalDocumentationObject | undefined;
|
|
7
|
+
/** Trail that ends in the `externalDocs` key. */
|
|
7
8
|
stackTrail: StackTrail;
|
|
8
9
|
context: ParseContextType;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
/** An invalid `externalDocs` is left out with a warning; its parent is kept. */
|
|
12
|
+
export declare const toExternalDocs: ({ externalDocs, stackTrail, context }: ToExternalDocsArgs) => OasExternalDocs | undefined;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { OasExternalDocs } from '../../../oas/externalDocs/ExternalDocs.js';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export const toExternalDocs = ({ externalDocs, stackTrail }) => {
|
|
5
|
-
if (
|
|
2
|
+
import { toValidExternalDocs } from '../../descriptiveFields.js';
|
|
3
|
+
/** An invalid `externalDocs` is left out with a warning; its parent is kept. */
|
|
4
|
+
export const toExternalDocs = ({ externalDocs, stackTrail, context }) => {
|
|
5
|
+
if (externalDocs === undefined) {
|
|
6
6
|
return undefined;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const valid = toValidExternalDocs({ externalDocs, stackTrail, context });
|
|
9
|
+
if (!valid) {
|
|
10
|
+
return undefined;
|
|
10
11
|
}
|
|
11
12
|
return new OasExternalDocs({
|
|
12
|
-
url:
|
|
13
|
-
description:
|
|
13
|
+
url: valid.url,
|
|
14
|
+
description: valid.description
|
|
14
15
|
});
|
|
15
16
|
};
|
|
@@ -9,6 +9,18 @@ export type ToHeadersV3Args = {
|
|
|
9
9
|
context: ParseContextType;
|
|
10
10
|
};
|
|
11
11
|
export declare const toHeadersV3: ({ headers, stackTrail, context }: ToHeadersV3Args) => Record<string, OasHeader | OasRef<"header">> | undefined;
|
|
12
|
+
export type ToComponentHeadersV3Args = {
|
|
13
|
+
headers: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.HeaderObject> | undefined;
|
|
14
|
+
stackTrail: StackTrail;
|
|
15
|
+
context: ParseContextType;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Parse `components.headers`. Each entry parses inside its own boundary: a
|
|
19
|
+
* broken one is dropped with an INVALID_HEADER error, and the others are
|
|
20
|
+
* kept. Headers inside a response stay with {@link toHeadersV3}, where a
|
|
21
|
+
* broken header drops the response.
|
|
22
|
+
*/
|
|
23
|
+
export declare const toComponentHeadersV3: ({ headers, stackTrail, context }: ToComponentHeadersV3Args) => Record<string, OasHeader | OasRef<"header">> | undefined;
|
|
12
24
|
export type ToHeaderV3Args = {
|
|
13
25
|
header: OpenAPIV3.ReferenceObject | OpenAPIV3.HeaderObject;
|
|
14
26
|
/** The header's name, used to key a singular `example` */
|
|
@@ -5,6 +5,7 @@ import { isRef } from '../../../helpers/refFns.js';
|
|
|
5
5
|
import { toOptionalMediaTypeItemsV3 } from '../mediaType/toMediaTypeItemV3.js';
|
|
6
6
|
import { OasHeader } from '../../../oas/header/Header.js';
|
|
7
7
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
8
|
+
import { toComponentEntries } from '../../toComponentEntries.js';
|
|
8
9
|
export const toHeadersV3 = ({ headers, stackTrail, context }) => {
|
|
9
10
|
if (!headers) {
|
|
10
11
|
return undefined;
|
|
@@ -16,6 +17,25 @@ export const toHeadersV3 = ({ headers, stackTrail, context }) => {
|
|
|
16
17
|
}
|
|
17
18
|
return output;
|
|
18
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Parse `components.headers`. Each entry parses inside its own boundary: a
|
|
22
|
+
* broken one is dropped with an INVALID_HEADER error, and the others are
|
|
23
|
+
* kept. Headers inside a response stay with {@link toHeadersV3}, where a
|
|
24
|
+
* broken header drops the response.
|
|
25
|
+
*/
|
|
26
|
+
export const toComponentHeadersV3 = ({ headers, stackTrail, context }) => {
|
|
27
|
+
if (!headers) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return toComponentEntries({
|
|
31
|
+
entries: headers,
|
|
32
|
+
stackTrail,
|
|
33
|
+
context,
|
|
34
|
+
type: 'INVALID_HEADER',
|
|
35
|
+
label: 'Header',
|
|
36
|
+
parse: ({ key, entry, stackTrail: st }) => toHeaderV3({ header: entry, name: key, stackTrail: st, context })
|
|
37
|
+
});
|
|
38
|
+
};
|
|
19
39
|
const toHeaderV3 = ({ header, name, stackTrail, context }) => {
|
|
20
40
|
if (isRef(header)) {
|
|
21
41
|
return toRefV31({ ref: header, refType: 'header', stackTrail, context });
|
|
@@ -3,7 +3,8 @@ import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
|
3
3
|
import { OasInfo } from '../../../oas/info/Info.js';
|
|
4
4
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
5
|
export type ToInfoV3Args = {
|
|
6
|
-
|
|
6
|
+
/** Required by the spec; a document without it still parses (see {@link toPresentInfo}). */
|
|
7
|
+
info: OpenAPIV3.InfoObject | null | undefined;
|
|
7
8
|
stackTrail: StackTrail;
|
|
8
9
|
context: ParseContextType;
|
|
9
10
|
};
|