@goast/core 0.7.0-beta.2 → 0.7.1
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/dist/src/ast/node.d.ts +43 -0
- package/dist/src/ast/node.js +29 -0
- package/dist/src/codegen/config.d.ts +9 -0
- package/dist/src/codegen/config.js +4 -0
- package/dist/src/codegen/endpoints-generator.d.ts +32 -0
- package/dist/src/codegen/endpoints-generator.js +19 -0
- package/dist/src/codegen/generator.d.ts +108 -0
- package/dist/src/codegen/generator.js +103 -0
- package/dist/src/codegen/internal-utils.d.ts +8 -0
- package/dist/src/codegen/internal-utils.js +8 -0
- package/dist/src/codegen/schemas-generator.d.ts +33 -0
- package/dist/src/codegen/schemas-generator.js +20 -0
- package/dist/src/codegen/services-generator.d.ts +24 -0
- package/dist/src/codegen/services-generator.js +11 -0
- package/dist/src/codegen/types.d.ts +56 -0
- package/dist/src/collect/collector.d.ts +8 -0
- package/dist/src/collect/collector.js +8 -0
- package/dist/src/collect/helpers.d.ts +16 -0
- package/dist/src/collect/helpers.js +16 -0
- package/dist/src/collect/types.d.ts +28 -0
- package/dist/src/internal-utils.d.ts +7 -0
- package/dist/src/internal-utils.js +7 -0
- package/dist/src/parse/deref-proxy.d.ts +19 -0
- package/dist/src/parse/deref-proxy.js +19 -0
- package/dist/src/parse/openapi-types.d.ts +168 -0
- package/dist/src/parse/parser.d.ts +38 -0
- package/dist/src/parse/parser.js +38 -0
- package/dist/src/parse/types.d.ts +37 -0
- package/dist/src/parse/types.js +4 -0
- package/dist/src/transform/api-types.d.ts +408 -0
- package/dist/src/transform/helpers.d.ts +73 -0
- package/dist/src/transform/helpers.js +73 -0
- package/dist/src/transform/transform-document.d.ts +7 -0
- package/dist/src/transform/transform-document.js +7 -0
- package/dist/src/transform/transform-endpoint.d.ts +8 -0
- package/dist/src/transform/transform-endpoint.js +8 -0
- package/dist/src/transform/transform-schema.d.ts +10 -0
- package/dist/src/transform/transform-schema.js +10 -0
- package/dist/src/transform/transformer.d.ts +7 -0
- package/dist/src/transform/transformer.js +7 -0
- package/dist/src/transform/types.d.ts +61 -0
- package/dist/src/transform/types.js +4 -0
- package/dist/src/utils/action-provider.d.ts +38 -0
- package/dist/src/utils/action-provider.js +38 -0
- package/dist/src/utils/api-data.utils.d.ts +9 -0
- package/dist/src/utils/api-data.utils.js +9 -0
- package/dist/src/utils/array.utils.d.ts +7 -0
- package/dist/src/utils/array.utils.js +7 -0
- package/dist/src/utils/asset-manager.d.ts +22 -0
- package/dist/src/utils/asset-manager.js +22 -0
- package/dist/src/utils/class.utils.d.ts +22 -0
- package/dist/src/utils/class.utils.js +22 -0
- package/dist/src/utils/common.utils.d.ts +81 -0
- package/dist/src/utils/common.utils.js +81 -0
- package/dist/src/utils/condition.d.ts +22 -0
- package/dist/src/utils/endpoint.utils.d.ts +12 -0
- package/dist/src/utils/endpoint.utils.js +12 -0
- package/dist/src/utils/error.utils.d.ts +6 -0
- package/dist/src/utils/error.utils.js +6 -0
- package/dist/src/utils/factory.d.ts +45 -0
- package/dist/src/utils/factory.js +45 -0
- package/dist/src/utils/file-system.utils.d.ts +37 -0
- package/dist/src/utils/file-system.utils.js +20 -0
- package/dist/src/utils/generator.utils.d.ts +7 -0
- package/dist/src/utils/generator.utils.js +7 -0
- package/dist/src/utils/object.utils.d.ts +16 -0
- package/dist/src/utils/object.utils.js +16 -0
- package/dist/src/utils/schema-factory.d.ts +197 -0
- package/dist/src/utils/schema-factory.js +146 -0
- package/dist/src/utils/schema.utils.d.ts +15 -0
- package/dist/src/utils/schema.utils.js +15 -0
- package/dist/src/utils/source-builder.d.ts +103 -0
- package/dist/src/utils/source-builder.js +58 -0
- package/dist/src/utils/string-builder/string-builder.d.ts +24 -0
- package/dist/src/utils/string-builder/string-builder.js +11 -0
- package/dist/src/utils/string-builder/utils.d.ts +68 -0
- package/dist/src/utils/string-builder/utils.js +33 -0
- package/dist/src/utils/string.utils.d.ts +78 -0
- package/dist/src/utils/string.utils.js +64 -0
- package/dist/src/utils/string.utils.types.d.ts +34 -0
- package/dist/src/utils/type.utils.d.ts +132 -0
- package/dist/src/utils/type.utils.js +19 -0
- package/dist/src/utils/yaml-info.d.ts +35 -0
- package/dist/src/utils/yaml-info.js +25 -0
- package/package.json +1 -1
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { OpenApiGenerationProviderBase } from './generator.js';
|
|
2
2
|
import { addSourceIfTest } from './internal-utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Base class for generation providers that produce one result per API service.
|
|
5
|
+
* Results are cached per service. Subclasses implement `initResult`, `generateService` and `addServiceResult`, and can
|
|
6
|
+
* override `generateAdditionalFiles` to produce output after all services have been processed.
|
|
7
|
+
* @template TInput The type of the merged output of the providers that ran before.
|
|
8
|
+
* @template TOutput The type of the output produced by the provider.
|
|
9
|
+
* @template TConfig The type of the provider-specific configuration.
|
|
10
|
+
* @template TServiceOutput The type of the result produced for each service.
|
|
11
|
+
* @template TContext The type of the context that is passed to the provider methods.
|
|
12
|
+
* @see OpenApiGenerationProviderBase
|
|
13
|
+
*/
|
|
3
14
|
export class OpenApiServicesGenerationProviderBase extends OpenApiGenerationProviderBase {
|
|
4
15
|
getProviderContext(context, config, defaultConfig) {
|
|
5
16
|
const ctx = super.getProviderContext(context, config, defaultConfig);
|
|
@@ -1,18 +1,74 @@
|
|
|
1
1
|
import type { ApiData } from '../transform/api-types.ts';
|
|
2
2
|
import type { MaybePromise } from '../utils/type.utils.ts';
|
|
3
3
|
import type { OpenApiGeneratorConfig } from './config.ts';
|
|
4
|
+
/**
|
|
5
|
+
* A loosely typed configuration object passed to generation providers, which narrow it to their own options.
|
|
6
|
+
*/
|
|
4
7
|
export type AnyConfig = Readonly<Record<string, unknown>>;
|
|
8
|
+
/**
|
|
9
|
+
* The merged output of the generation providers that ran before, keyed by the properties they returned.
|
|
10
|
+
*/
|
|
5
11
|
export type OpenApiGeneratorInput = Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* The result of a generation provider. Its properties are deep-merged into the input of the following providers.
|
|
14
|
+
* A falsy result (`undefined`) is ignored.
|
|
15
|
+
*/
|
|
6
16
|
export type OpenApiGeneratorOutput = Record<string, unknown> | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The context that is passed to every generation provider.
|
|
19
|
+
* @template TInput The type of the merged output of the providers that ran before.
|
|
20
|
+
*/
|
|
7
21
|
export type OpenApiGeneratorContext<TInput extends OpenApiGeneratorInput = OpenApiGeneratorInput> = {
|
|
22
|
+
/**
|
|
23
|
+
* The parsed and transformed data of all OpenAPI specifications.
|
|
24
|
+
*/
|
|
8
25
|
data: ApiData;
|
|
26
|
+
/**
|
|
27
|
+
* The merged output of the providers that ran before the current one. It is empty for the first provider.
|
|
28
|
+
*/
|
|
9
29
|
input: TInput;
|
|
30
|
+
/**
|
|
31
|
+
* The configuration of the generator.
|
|
32
|
+
*/
|
|
10
33
|
config: OpenApiGeneratorConfig;
|
|
11
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* The context that is passed to a provider built on `OpenApiGenerationProviderBase`.
|
|
37
|
+
* It is the same as `OpenApiGeneratorContext`, except that its `config` also contains the provider-specific options.
|
|
38
|
+
* @template TInput The type of the merged output of the providers that ran before.
|
|
39
|
+
* @template TConfig The type of the provider-specific configuration.
|
|
40
|
+
* @see OpenApiGeneratorContext
|
|
41
|
+
*/
|
|
12
42
|
export type OpenApiGenerationProviderContext<TInput extends OpenApiGeneratorInput, TConfig extends AnyConfig> = Omit<OpenApiGeneratorContext<TInput>, 'config'> & {
|
|
43
|
+
/**
|
|
44
|
+
* The generator configuration merged with the provider-specific configuration.
|
|
45
|
+
*/
|
|
13
46
|
config: OpenApiGeneratorConfig & TConfig;
|
|
14
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* A generation provider implemented as an object with a `generate` method.
|
|
50
|
+
* @template TInput The type of the merged output of the providers that ran before.
|
|
51
|
+
* @template TOutput The type of the output produced by this provider.
|
|
52
|
+
* @template TConfig The type of the provider-specific configuration.
|
|
53
|
+
* @see OpenApiGenerationProviderFn
|
|
54
|
+
*/
|
|
15
55
|
export interface OpenApiGenerationProvider<TInput extends OpenApiGeneratorInput = OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput = OpenApiGeneratorOutput, TConfig extends AnyConfig = AnyConfig> {
|
|
56
|
+
/**
|
|
57
|
+
* Generates the output of this provider.
|
|
58
|
+
* @param context The context of the generator, including the output of the providers that ran before.
|
|
59
|
+
* @param config The provider-specific configuration, if any.
|
|
60
|
+
* @returns The output of this provider, or a promise that resolves to it.
|
|
61
|
+
*/
|
|
16
62
|
generate(...args: Parameters<OpenApiGenerationProviderFn<TInput, TOutput, TConfig>>): ReturnType<OpenApiGenerationProviderFn<TInput, TOutput, TConfig>>;
|
|
17
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* A generation provider implemented as a function. Its return value is merged into the input of the following
|
|
66
|
+
* providers.
|
|
67
|
+
* @template TInput The type of the merged output of the providers that ran before.
|
|
68
|
+
* @template TOutput The type of the output produced by this provider.
|
|
69
|
+
* @template TConfig The type of the provider-specific configuration.
|
|
70
|
+
* @param context The context of the generator, including the output of the providers that ran before.
|
|
71
|
+
* @param config The provider-specific configuration, if any.
|
|
72
|
+
* @returns The output of this provider, or a promise that resolves to it.
|
|
73
|
+
*/
|
|
18
74
|
export type OpenApiGenerationProviderFn<TInput extends OpenApiGeneratorInput = OpenApiGeneratorInput, TOutput extends OpenApiGeneratorOutput = OpenApiGeneratorOutput, TConfig extends AnyConfig = AnyConfig> = (context: OpenApiGeneratorContext<TInput>, config?: Partial<TConfig>) => MaybePromise<TOutput>;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { OpenApiDocument } from '../parse/openapi-types.ts';
|
|
2
2
|
import type { Deref } from '../parse/types.ts';
|
|
3
3
|
import type { OpenApiCollectorData } from './types.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Collects the documents, schemas and endpoints of the given OpenAPI documents into one data object.
|
|
6
|
+
* Schemas are collected from the components, definitions, parameters, request bodies, responses and headers, including
|
|
7
|
+
* all nested schemas. Schemas and endpoints are keyed by their source location, so each one is collected only once.
|
|
8
|
+
* Objects marked with `x-ignore` are skipped.
|
|
9
|
+
* @param apis The parsed OpenAPI documents to collect from.
|
|
10
|
+
* @returns The collected documents, schemas and endpoints.
|
|
11
|
+
*/
|
|
4
12
|
export declare function collectOpenApi(apis: Deref<OpenApiDocument>[]): OpenApiCollectorData;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { collect, collectRecord } from './helpers.js';
|
|
2
|
+
/**
|
|
3
|
+
* Collects the documents, schemas and endpoints of the given OpenAPI documents into one data object.
|
|
4
|
+
* Schemas are collected from the components, definitions, parameters, request bodies, responses and headers, including
|
|
5
|
+
* all nested schemas. Schemas and endpoints are keyed by their source location, so each one is collected only once.
|
|
6
|
+
* Objects marked with `x-ignore` are skipped.
|
|
7
|
+
* @param apis The parsed OpenAPI documents to collect from.
|
|
8
|
+
* @returns The collected documents, schemas and endpoints.
|
|
9
|
+
*/
|
|
2
10
|
export function collectOpenApi(apis) {
|
|
3
11
|
const data = {
|
|
4
12
|
documents: [],
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import type { Nullable } from '../utils/type.utils.ts';
|
|
2
2
|
import type { OpenApiCollectorData } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Calls `func` for each object in a value that is either a single object or an array of objects.
|
|
5
|
+
* Null entries and objects marked with `x-ignore` are skipped.
|
|
6
|
+
* @template T The type of the objects.
|
|
7
|
+
* @param data The collector data that is passed on to `func`.
|
|
8
|
+
* @param obj The single object or array of objects to visit.
|
|
9
|
+
* @param func The function that is called for each object.
|
|
10
|
+
*/
|
|
3
11
|
export declare function collect<T extends Record<`x-${string}`, unknown>>(data: OpenApiCollectorData, obj: Nullable<T | Nullable<T>[]>, func: (data: OpenApiCollectorData, obj: NonNullable<T>) => void): void;
|
|
12
|
+
/**
|
|
13
|
+
* Calls `func` for each value of a record, such as the schemas of a document or the paths of a specification.
|
|
14
|
+
* Keys starting with `$` or `x-`, null values and values marked with `x-ignore` are skipped.
|
|
15
|
+
* @template T The type of the values.
|
|
16
|
+
* @param data The collector data that is passed on to `func`.
|
|
17
|
+
* @param obj The record to visit.
|
|
18
|
+
* @param func The function that is called for each value together with its key.
|
|
19
|
+
*/
|
|
4
20
|
export declare function collectRecord<T extends Record<`x-${string}`, unknown>>(data: OpenApiCollectorData, obj: Nullable<Record<string, Nullable<T>>>, func: (data: OpenApiCollectorData, obj: NonNullable<T>, key: string) => void): void;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { isOpenApiObjectProperty } from '../internal-utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Calls `func` for each object in a value that is either a single object or an array of objects.
|
|
4
|
+
* Null entries and objects marked with `x-ignore` are skipped.
|
|
5
|
+
* @template T The type of the objects.
|
|
6
|
+
* @param data The collector data that is passed on to `func`.
|
|
7
|
+
* @param obj The single object or array of objects to visit.
|
|
8
|
+
* @param func The function that is called for each object.
|
|
9
|
+
*/
|
|
2
10
|
export function collect(data, obj, func) {
|
|
3
11
|
if (!obj)
|
|
4
12
|
return;
|
|
@@ -17,6 +25,14 @@ export function collect(data, obj, func) {
|
|
|
17
25
|
func(data, obj);
|
|
18
26
|
}
|
|
19
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Calls `func` for each value of a record, such as the schemas of a document or the paths of a specification.
|
|
30
|
+
* Keys starting with `$` or `x-`, null values and values marked with `x-ignore` are skipped.
|
|
31
|
+
* @template T The type of the values.
|
|
32
|
+
* @param data The collector data that is passed on to `func`.
|
|
33
|
+
* @param obj The record to visit.
|
|
34
|
+
* @param func The function that is called for each value together with its key.
|
|
35
|
+
*/
|
|
20
36
|
export function collectRecord(data, obj, func) {
|
|
21
37
|
if (!obj)
|
|
22
38
|
return;
|
|
@@ -1,13 +1,41 @@
|
|
|
1
1
|
import type { OpenApiDocument, OpenApiHttpMethod, OpenApiOperation, OpenApiPathItem, OpenApiSchema } from '../parse/openapi-types.ts';
|
|
2
2
|
import type { Deref } from '../parse/types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Information about an endpoint that was collected from an OpenAPI document.
|
|
5
|
+
*/
|
|
3
6
|
export type OpenApiCollectorEndpointInfo = {
|
|
7
|
+
/**
|
|
8
|
+
* The path template of the endpoint, such as `/pets/{id}`.
|
|
9
|
+
*/
|
|
4
10
|
path: string;
|
|
11
|
+
/**
|
|
12
|
+
* The HTTP method of the operation.
|
|
13
|
+
*/
|
|
5
14
|
method: OpenApiHttpMethod;
|
|
15
|
+
/**
|
|
16
|
+
* The path item that contains the operation.
|
|
17
|
+
*/
|
|
6
18
|
pathItem: Deref<OpenApiPathItem>;
|
|
19
|
+
/**
|
|
20
|
+
* The operation that describes the endpoint.
|
|
21
|
+
*/
|
|
7
22
|
operation: Deref<OpenApiOperation>;
|
|
8
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* The data that is collected from the OpenAPI documents.
|
|
26
|
+
* @see collectOpenApi
|
|
27
|
+
*/
|
|
9
28
|
export type OpenApiCollectorData = {
|
|
29
|
+
/**
|
|
30
|
+
* The collected OpenAPI documents.
|
|
31
|
+
*/
|
|
10
32
|
documents: Deref<OpenApiDocument>[];
|
|
33
|
+
/**
|
|
34
|
+
* The collected schemas, keyed by their source location (`file#path`).
|
|
35
|
+
*/
|
|
11
36
|
schemas: Map<string, Deref<OpenApiSchema>>;
|
|
37
|
+
/**
|
|
38
|
+
* The collected endpoints, keyed by the source location (`file#path`) of their operation.
|
|
39
|
+
*/
|
|
12
40
|
endpoints: Map<string, OpenApiCollectorEndpointInfo>;
|
|
13
41
|
};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a property name of an OpenAPI object is a regular property. Names starting with `$` (such as `$ref`)
|
|
3
|
+
* and specification extensions starting with `x-` are not regular properties and should be skipped.
|
|
4
|
+
* @template T The type of the property name.
|
|
5
|
+
* @param propertyName The property name to check.
|
|
6
|
+
* @returns `true` if the name is a regular property name; otherwise, `false`.
|
|
7
|
+
*/
|
|
1
8
|
export declare function isOpenApiObjectProperty<T extends string>(propertyName: T): propertyName is Exclude<T, `$${string}` | `x-${string}`>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a property name of an OpenAPI object is a regular property. Names starting with `$` (such as `$ref`)
|
|
3
|
+
* and specification extensions starting with `x-` are not regular properties and should be skipped.
|
|
4
|
+
* @template T The type of the property name.
|
|
5
|
+
* @param propertyName The property name to check.
|
|
6
|
+
* @returns `true` if the name is a regular property name; otherwise, `false`.
|
|
7
|
+
*/
|
|
1
8
|
export function isOpenApiObjectProperty(propertyName) {
|
|
2
9
|
return !propertyName.startsWith('$') && !propertyName.startsWith('x-');
|
|
3
10
|
}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
1
|
import type { OpenApiObject } from './openapi-types.ts';
|
|
2
2
|
import type { Deref, DerefSource } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a raw OpenAPI object in a proxy so that `$ref` references are followed transparently.
|
|
5
|
+
*
|
|
6
|
+
* Property reads go to the wrapped object first. If it does not define the property, the read falls through to the
|
|
7
|
+
* resolved `$ref` target, which is looked up at access time. Consumers can therefore read `schema.properties` on a
|
|
8
|
+
* referencing object without checking whether the value is local or referenced. `title` is the exception and is never
|
|
9
|
+
* inherited from the target. Assignments are stored on the proxy and do not modify `obj`. The `$ref` and `$src`
|
|
10
|
+
* properties are always answered by the proxy itself.
|
|
11
|
+
*
|
|
12
|
+
* The parser attaches the resolved target as `$ref` while it dereferences a document. The result is typed as
|
|
13
|
+
* `Deref<T>`, which has the shape of `T` without the raw `$ref` key, plus `$ref` and `$src`.
|
|
14
|
+
* @template T The raw OpenAPI object type being wrapped.
|
|
15
|
+
* @param obj The raw object to wrap. It is not modified.
|
|
16
|
+
* @param source Provenance information, returned by the `$src` property.
|
|
17
|
+
* @param ref The resolved target of the object's `$ref`, if it has one.
|
|
18
|
+
* @returns A proxy that behaves like `obj` and follows its reference.
|
|
19
|
+
* @see Deref
|
|
20
|
+
* @see DerefSource
|
|
21
|
+
*/
|
|
3
22
|
export declare function createDerefProxy<T extends OpenApiObject<string>>(obj: T, source: DerefSource<T>, ref?: Deref<T>): Deref<T>;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { isNullish } from '../utils/common.utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps a raw OpenAPI object in a proxy so that `$ref` references are followed transparently.
|
|
4
|
+
*
|
|
5
|
+
* Property reads go to the wrapped object first. If it does not define the property, the read falls through to the
|
|
6
|
+
* resolved `$ref` target, which is looked up at access time. Consumers can therefore read `schema.properties` on a
|
|
7
|
+
* referencing object without checking whether the value is local or referenced. `title` is the exception and is never
|
|
8
|
+
* inherited from the target. Assignments are stored on the proxy and do not modify `obj`. The `$ref` and `$src`
|
|
9
|
+
* properties are always answered by the proxy itself.
|
|
10
|
+
*
|
|
11
|
+
* The parser attaches the resolved target as `$ref` while it dereferences a document. The result is typed as
|
|
12
|
+
* `Deref<T>`, which has the shape of `T` without the raw `$ref` key, plus `$ref` and `$src`.
|
|
13
|
+
* @template T The raw OpenAPI object type being wrapped.
|
|
14
|
+
* @param obj The raw object to wrap. It is not modified.
|
|
15
|
+
* @param source Provenance information, returned by the `$src` property.
|
|
16
|
+
* @param ref The resolved target of the object's `$ref`, if it has one.
|
|
17
|
+
* @returns A proxy that behaves like `obj` and follows its reference.
|
|
18
|
+
* @see Deref
|
|
19
|
+
* @see DerefSource
|
|
20
|
+
*/
|
|
2
21
|
export function createDerefProxy(obj, source, ref) {
|
|
3
22
|
return new Proxy(obj, new DerefProxyHandler(source, ref));
|
|
4
23
|
}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference Object (OpenAPI 2.0 and 3.x). Points to another definition, either within the same document or in an
|
|
3
|
+
* external file or URL.
|
|
4
|
+
*/
|
|
1
5
|
export type OpenApiReference = {
|
|
2
6
|
/**
|
|
3
7
|
* Allows for an external definition of this object.
|
|
4
8
|
*/
|
|
5
9
|
$ref: string;
|
|
6
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Base shape shared by the OpenAPI object types in this file. Adds specification extensions (`x-*` keys), an optional
|
|
13
|
+
* `$ref`, and an optional type-only `__marker` that tags the kind of object.
|
|
14
|
+
* @template TMarker The string literal that identifies the object kind, such as `'info'` or `'schema'`.
|
|
15
|
+
*/
|
|
7
16
|
export type OpenApiObject<TMarker extends string> = Record<`x-${string}`, unknown> & Partial<OpenApiReference> & {
|
|
8
17
|
__marker?: TMarker;
|
|
9
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Root object of an OpenAPI document. Accepts OpenAPI 2.0 (Swagger) as well as 3.0 and 3.1 documents. Fields marked
|
|
21
|
+
* as OpenAPI 2.0 belong to Swagger documents, and the remaining fields apply to 3.x.
|
|
22
|
+
*/
|
|
10
23
|
export type OpenApiDocument = OpenApiObject<'document'> & {
|
|
11
24
|
/**
|
|
12
25
|
* The OpenAPI (v3.x) version.
|
|
@@ -89,6 +102,10 @@ export type OpenApiDocument = OpenApiObject<'document'> & {
|
|
|
89
102
|
*/
|
|
90
103
|
securityDefinitions?: Record<string, OpenApiSecurityScheme>;
|
|
91
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* Info Object (OpenAPI 2.0 and 3.x). Provides metadata about the API, such as its title, version and license.
|
|
107
|
+
* The `summary` field exists only in OpenAPI 3.1.
|
|
108
|
+
*/
|
|
92
109
|
export type OpenApiInfo = OpenApiObject<'info'> & {
|
|
93
110
|
/**
|
|
94
111
|
* The title of the API.
|
|
@@ -119,6 +136,9 @@ export type OpenApiInfo = OpenApiObject<'info'> & {
|
|
|
119
136
|
*/
|
|
120
137
|
license?: OpenApiLicense;
|
|
121
138
|
};
|
|
139
|
+
/**
|
|
140
|
+
* Contact Object (OpenAPI 2.0 and 3.x). Holds the contact information for the exposed API.
|
|
141
|
+
*/
|
|
122
142
|
export type OpenApiContact = OpenApiObject<'contact'> & {
|
|
123
143
|
/**
|
|
124
144
|
* The identifying name of the contact person/organization.
|
|
@@ -133,6 +153,10 @@ export type OpenApiContact = OpenApiObject<'contact'> & {
|
|
|
133
153
|
*/
|
|
134
154
|
email?: string;
|
|
135
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* License Object (OpenAPI 2.0 and 3.x). Holds the license information for the exposed API.
|
|
158
|
+
* The `identifier` field, an SPDX license expression, exists only in OpenAPI 3.1.
|
|
159
|
+
*/
|
|
136
160
|
export type OpenApiLicense = OpenApiObject<'license'> & {
|
|
137
161
|
/**
|
|
138
162
|
* The license name used for the API.
|
|
@@ -147,6 +171,10 @@ export type OpenApiLicense = OpenApiObject<'license'> & {
|
|
|
147
171
|
*/
|
|
148
172
|
identifier?: string;
|
|
149
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Server Object (OpenAPI 3.x). Provides connectivity information for a target server. OpenAPI 2.0 uses `host`,
|
|
176
|
+
* `basePath` and `schemes` on the document instead.
|
|
177
|
+
*/
|
|
150
178
|
export type OpenApiServer = OpenApiObject<'server'> & {
|
|
151
179
|
/**
|
|
152
180
|
* A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.
|
|
@@ -161,6 +189,9 @@ export type OpenApiServer = OpenApiObject<'server'> & {
|
|
|
161
189
|
*/
|
|
162
190
|
variables?: Record<string, OpenApiServerVariable>;
|
|
163
191
|
};
|
|
192
|
+
/**
|
|
193
|
+
* Server Variable Object (OpenAPI 3.x). Defines a substitution value for a variable in a Server Object's URL template.
|
|
194
|
+
*/
|
|
164
195
|
export type OpenApiServerVariable = OpenApiObject<'server-variable'> & {
|
|
165
196
|
/**
|
|
166
197
|
* An enumeration of string values to be used if the substitution options are from a limited set.
|
|
@@ -175,6 +206,10 @@ export type OpenApiServerVariable = OpenApiObject<'server-variable'> & {
|
|
|
175
206
|
*/
|
|
176
207
|
description?: string;
|
|
177
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* Fields shared by the OpenAPI 3.x Parameter and Header Objects. A Parameter Object adds `name` and `in`.
|
|
211
|
+
* @template TMarker The object kind, either `'parameter'` or `'header'`.
|
|
212
|
+
*/
|
|
178
213
|
export type OpenApiParameterBase<TMarker extends string> = OpenApiObject<'param-base'> & {
|
|
179
214
|
/**
|
|
180
215
|
* A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
|
|
@@ -223,7 +258,14 @@ export type OpenApiParameterBase<TMarker extends string> = OpenApiObject<'param-
|
|
|
223
258
|
} & {
|
|
224
259
|
__pbMarker: TMarker;
|
|
225
260
|
};
|
|
261
|
+
/**
|
|
262
|
+
* Header Object (OpenAPI 3.x). Describes a header of a response, or a header in an encoding.
|
|
263
|
+
* @see OpenApiParameterBase
|
|
264
|
+
*/
|
|
226
265
|
export type OpenApiHeader = OpenApiParameterBase<'header'>;
|
|
266
|
+
/**
|
|
267
|
+
* Example Object (OpenAPI 3.x). Holds an example value, either inline or as an external URL.
|
|
268
|
+
*/
|
|
227
269
|
export type OpenApiExample = OpenApiObject<'example'> & {
|
|
228
270
|
/**
|
|
229
271
|
* Short description for the example.
|
|
@@ -242,6 +284,10 @@ export type OpenApiExample = OpenApiObject<'example'> & {
|
|
|
242
284
|
*/
|
|
243
285
|
externalValue?: string;
|
|
244
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* Media Type Object (OpenAPI 3.x). Describes the schema, examples and encoding for one media type of a request or
|
|
289
|
+
* response body. OpenAPI 2.0 declares body schemas directly on parameters and responses instead.
|
|
290
|
+
*/
|
|
245
291
|
export type OpenApiMediaType = OpenApiObject<'media-type'> & {
|
|
246
292
|
/**
|
|
247
293
|
* The schema defining the type used for the component.
|
|
@@ -260,6 +306,9 @@ export type OpenApiMediaType = OpenApiObject<'media-type'> & {
|
|
|
260
306
|
*/
|
|
261
307
|
encoding?: Record<string, OpenApiEncoding>;
|
|
262
308
|
};
|
|
309
|
+
/**
|
|
310
|
+
* Encoding Object (OpenAPI 3.x). Describes how a property of a multipart or form-urlencoded request body is encoded.
|
|
311
|
+
*/
|
|
263
312
|
export type OpenApiEncoding = OpenApiObject<'encoding'> & {
|
|
264
313
|
/**
|
|
265
314
|
* The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binary – application/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
|
|
@@ -282,7 +331,15 @@ export type OpenApiEncoding = OpenApiObject<'encoding'> & {
|
|
|
282
331
|
*/
|
|
283
332
|
allowReserved?: boolean;
|
|
284
333
|
};
|
|
334
|
+
/**
|
|
335
|
+
* HTTP methods that can be used as operation keys on a Path Item Object. OpenAPI 2.0 supports the same methods,
|
|
336
|
+
* except `trace`.
|
|
337
|
+
*/
|
|
285
338
|
export type OpenApiHttpMethod = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
|
|
339
|
+
/**
|
|
340
|
+
* Path Item Object (OpenAPI 2.0 and 3.x). Groups the operations and shared parameters for one path. The `summary`,
|
|
341
|
+
* `description` and `servers` fields exist only in OpenAPI 3.x.
|
|
342
|
+
*/
|
|
286
343
|
export type OpenApiPathItem = OpenApiObject<'path-item'> & {
|
|
287
344
|
/**
|
|
288
345
|
* An optional, string summary, intended to apply to all operations in this path.
|
|
@@ -303,8 +360,20 @@ export type OpenApiPathItem = OpenApiObject<'path-item'> & {
|
|
|
303
360
|
} & {
|
|
304
361
|
[method in OpenApiHttpMethod]?: OpenApiOperation;
|
|
305
362
|
};
|
|
363
|
+
/**
|
|
364
|
+
* Parameter locations known to the parser. OpenAPI 3.x defines `path`, `query`, `header` and `cookie`, and OpenAPI 2.0
|
|
365
|
+
* uses `body`.
|
|
366
|
+
*/
|
|
306
367
|
export type KnownOpenApiParameterTarget = 'path' | 'query' | 'header' | 'cookie' | 'body' | 'form';
|
|
368
|
+
/**
|
|
369
|
+
* Parameter location. Accepts a known location or any other string.
|
|
370
|
+
* @see KnownOpenApiParameterTarget
|
|
371
|
+
*/
|
|
307
372
|
export type OpenApiParameterTarget = KnownOpenApiParameterTarget | string;
|
|
373
|
+
/**
|
|
374
|
+
* Parameter Object (OpenAPI 2.0 and 3.x). Describes one parameter of an operation or path item. The `in` field gives
|
|
375
|
+
* the location of the parameter.
|
|
376
|
+
*/
|
|
308
377
|
export type OpenApiParameter = OpenApiParameterBase<'parameter'> & {
|
|
309
378
|
/**
|
|
310
379
|
* The name of the parameter. Parameter names are case sensitive.
|
|
@@ -315,6 +384,11 @@ export type OpenApiParameter = OpenApiParameterBase<'parameter'> & {
|
|
|
315
384
|
*/
|
|
316
385
|
in?: OpenApiParameterTarget;
|
|
317
386
|
};
|
|
387
|
+
/**
|
|
388
|
+
* Operation Object (OpenAPI 2.0 and 3.x). Describes one API operation on a path, such as a GET on `/pets`.
|
|
389
|
+
* `consumes`, `produces` and `schemes` apply only to OpenAPI 2.0, while `requestBody`, `callbacks` and `servers`
|
|
390
|
+
* apply only to OpenAPI 3.x.
|
|
391
|
+
*/
|
|
318
392
|
export type OpenApiOperation = OpenApiObject<'operation'> & {
|
|
319
393
|
/**
|
|
320
394
|
* A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
|
|
@@ -377,8 +451,15 @@ export type OpenApiOperation = OpenApiObject<'operation'> & {
|
|
|
377
451
|
* (OpenAPI v2) The MIME types the operation can produce. This overrides the produces definition at the OpenAPI Object. An empty value MAY be used to clear the global definition. Value MUST be as described under Mime Types.
|
|
378
452
|
*/
|
|
379
453
|
produces?: Record<string, string[]>;
|
|
454
|
+
/**
|
|
455
|
+
* (OpenAPI v2) The transfer protocols used by this operation, such as `http`, `https`, `ws` or `wss`.
|
|
456
|
+
*/
|
|
380
457
|
schemes?: string[];
|
|
381
458
|
};
|
|
459
|
+
/**
|
|
460
|
+
* External Documentation Object (OpenAPI 2.0 and 3.x). Points to additional documentation that is kept outside
|
|
461
|
+
* the API description.
|
|
462
|
+
*/
|
|
382
463
|
export type OpenApiExternalDocumentation = OpenApiObject<'external-doc'> & {
|
|
383
464
|
/**
|
|
384
465
|
* A short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
|
|
@@ -389,6 +470,10 @@ export type OpenApiExternalDocumentation = OpenApiObject<'external-doc'> & {
|
|
|
389
470
|
*/
|
|
390
471
|
url: string;
|
|
391
472
|
};
|
|
473
|
+
/**
|
|
474
|
+
* Request Body Object (OpenAPI 3.x). Describes the body of an operation's request, keyed by media type.
|
|
475
|
+
* OpenAPI 2.0 uses a `body` parameter for this purpose.
|
|
476
|
+
*/
|
|
392
477
|
export type OpenApiRequestBody = OpenApiObject<'request-body'> & {
|
|
393
478
|
/**
|
|
394
479
|
* A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
|
|
@@ -403,6 +488,11 @@ export type OpenApiRequestBody = OpenApiObject<'request-body'> & {
|
|
|
403
488
|
*/
|
|
404
489
|
required?: boolean;
|
|
405
490
|
};
|
|
491
|
+
/**
|
|
492
|
+
* Response Object (OpenAPI 2.0 and 3.x). Describes one response of an operation, keyed by HTTP status code or
|
|
493
|
+
* `default`. The `schema` and `examples` fields apply only to OpenAPI 2.0, while `content` and `links` apply only to
|
|
494
|
+
* OpenAPI 3.x.
|
|
495
|
+
*/
|
|
406
496
|
export type OpenApiResponse = OpenApiObject<'response'> & {
|
|
407
497
|
/**
|
|
408
498
|
* A short description of the response. CommonMark syntax MAY be used for rich text representation.
|
|
@@ -429,6 +519,9 @@ export type OpenApiResponse = OpenApiObject<'response'> & {
|
|
|
429
519
|
*/
|
|
430
520
|
examples?: Record<string, unknown>;
|
|
431
521
|
};
|
|
522
|
+
/**
|
|
523
|
+
* Link Object (OpenAPI 3.x). Describes how a value from a response can be used to call another operation.
|
|
524
|
+
*/
|
|
432
525
|
export type OpenApiLink = OpenApiObject<'link'> & {
|
|
433
526
|
/**
|
|
434
527
|
* A relative or absolute reference to an OAS operation. This field is mutually exclusive of the operationId field, and MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
|
|
@@ -455,6 +548,10 @@ export type OpenApiLink = OpenApiObject<'link'> & {
|
|
|
455
548
|
*/
|
|
456
549
|
server?: OpenApiServer;
|
|
457
550
|
};
|
|
551
|
+
/**
|
|
552
|
+
* Components Object (OpenAPI 3.x). Holds reusable objects that other parts of the document can reference with `$ref`.
|
|
553
|
+
* OpenAPI 2.0 places the equivalent definitions at the root of the document instead.
|
|
554
|
+
*/
|
|
458
555
|
export type OpenApiComponents = OpenApiObject<'components'> & {
|
|
459
556
|
/**
|
|
460
557
|
* An object to hold reusable OpenAPI objects.
|
|
@@ -497,7 +594,16 @@ export type OpenApiComponents = OpenApiObject<'components'> & {
|
|
|
497
594
|
*/
|
|
498
595
|
pathItems?: Record<string, OpenApiPathItem>;
|
|
499
596
|
};
|
|
597
|
+
/**
|
|
598
|
+
* Security Scheme Object (OpenAPI 2.0 and 3.x). A union of the known scheme kinds, told apart by their `type` field.
|
|
599
|
+
* The known kinds are `basic` (OpenAPI 2.0 only), `http` and `openIdConnect` (OpenAPI 3.x only), and `apiKey` and
|
|
600
|
+
* `oauth2` (both versions). Any other object is also accepted.
|
|
601
|
+
*/
|
|
500
602
|
export type OpenApiSecurityScheme = OpenApiHttpSecurityScheme | OpenApiApiKeySecurityScheme | OpenApiOAuth2SecurityScheme | OpenApiOpenIdSecurityScheme | OpenApiObject<'security-scheme'>;
|
|
603
|
+
/**
|
|
604
|
+
* Basic authentication security scheme (OpenAPI 2.0). OpenAPI 3.x expresses basic authentication as an `http`
|
|
605
|
+
* scheme with `scheme: 'basic'`.
|
|
606
|
+
*/
|
|
501
607
|
export type OpenApiBasicSecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
502
608
|
/**
|
|
503
609
|
* The type of the security scheme.
|
|
@@ -508,6 +614,10 @@ export type OpenApiBasicSecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
|
508
614
|
*/
|
|
509
615
|
description?: string;
|
|
510
616
|
};
|
|
617
|
+
/**
|
|
618
|
+
* HTTP authentication security scheme (OpenAPI 3.x), such as `bearer` or `basic`. The credentials are sent in the
|
|
619
|
+
* `Authorization` header.
|
|
620
|
+
*/
|
|
511
621
|
export type OpenApiHttpSecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
512
622
|
/**
|
|
513
623
|
* The type of the security scheme.
|
|
@@ -526,8 +636,20 @@ export type OpenApiHttpSecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
|
526
636
|
*/
|
|
527
637
|
bearerFormat?: string;
|
|
528
638
|
};
|
|
639
|
+
/**
|
|
640
|
+
* Locations where an API key can be sent. OpenAPI 2.0 supports `query` and `header`, and OpenAPI 3.x also supports
|
|
641
|
+
* `cookie`.
|
|
642
|
+
*/
|
|
529
643
|
export type KnownOpenApiApiKeySource = 'query' | 'header' | 'cookie';
|
|
644
|
+
/**
|
|
645
|
+
* Location of an API key. Accepts a known location or any other string.
|
|
646
|
+
* @see KnownOpenApiApiKeySource
|
|
647
|
+
*/
|
|
530
648
|
export type OpenApiApiKeySource = KnownOpenApiApiKeySource | string;
|
|
649
|
+
/**
|
|
650
|
+
* API key security scheme (OpenAPI 2.0 and 3.x). The key is sent in the query string, a header or a cookie, as
|
|
651
|
+
* named by `name`.
|
|
652
|
+
*/
|
|
531
653
|
export type OpenApiApiKeySecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
532
654
|
/**
|
|
533
655
|
* The type of the security scheme.
|
|
@@ -546,8 +668,20 @@ export type OpenApiApiKeySecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
|
546
668
|
*/
|
|
547
669
|
in?: OpenApiApiKeySource;
|
|
548
670
|
};
|
|
671
|
+
/**
|
|
672
|
+
* OAuth 2.0 flow names known to the parser. OpenAPI 2.0 uses `implicit`, `password`, `application` and `accessCode`,
|
|
673
|
+
* and OpenAPI 3.x uses `implicit`, `password`, `clientCredentials` and `authorizationCode`.
|
|
674
|
+
*/
|
|
549
675
|
export type KnownOpenApiOAuth2SecurityFlow = 'implicit' | 'password' | 'application' | 'accessCode';
|
|
676
|
+
/**
|
|
677
|
+
* OAuth 2.0 flow name. Accepts a known flow name or any other string.
|
|
678
|
+
* @see KnownOpenApiOAuth2SecurityFlow
|
|
679
|
+
*/
|
|
550
680
|
export type OpenApiOAuth2SecurityFlow = KnownOpenApiOAuth2SecurityFlow | string;
|
|
681
|
+
/**
|
|
682
|
+
* OAuth 2.0 security scheme (OpenAPI 2.0 and 3.x). OpenAPI 3.x describes its flows in the `flows` object, while
|
|
683
|
+
* OpenAPI 2.0 uses the top-level `flow`, `scopes`, `authorizationUrl` and `tokenUrl` fields.
|
|
684
|
+
*/
|
|
551
685
|
export type OpenApiOAuth2SecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
552
686
|
/**
|
|
553
687
|
* The type of the security scheme.
|
|
@@ -651,6 +785,9 @@ export type OpenApiOAuth2SecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
|
651
785
|
*/
|
|
652
786
|
tokenUrl?: string;
|
|
653
787
|
};
|
|
788
|
+
/**
|
|
789
|
+
* OpenID Connect security scheme (OpenAPI 3.x). The OAuth 2.0 configuration is discovered from `openIdConnectUrl`.
|
|
790
|
+
*/
|
|
654
791
|
export type OpenApiOpenIdSecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
655
792
|
/**
|
|
656
793
|
* The type of the security scheme.
|
|
@@ -665,6 +802,9 @@ export type OpenApiOpenIdSecurityScheme = OpenApiObject<'security-scheme'> & {
|
|
|
665
802
|
*/
|
|
666
803
|
openIdConnectUrl: string;
|
|
667
804
|
};
|
|
805
|
+
/**
|
|
806
|
+
* Tag Object (OpenAPI 2.0 and 3.x). Adds a name and optional metadata to a tag that is used to group operations.
|
|
807
|
+
*/
|
|
668
808
|
export type OpenApiTag = OpenApiObject<'tag'> & {
|
|
669
809
|
/**
|
|
670
810
|
* The name of the tag.
|
|
@@ -679,10 +819,30 @@ export type OpenApiTag = OpenApiObject<'tag'> & {
|
|
|
679
819
|
*/
|
|
680
820
|
externalDocs?: OpenApiExternalDocumentation;
|
|
681
821
|
};
|
|
822
|
+
/**
|
|
823
|
+
* JSON Schema primitive type names known to the parser. `null` is a type in OpenAPI 3.1, while OpenAPI 3.0 expresses
|
|
824
|
+
* nullability with `nullable` instead.
|
|
825
|
+
*/
|
|
682
826
|
export type KnownOpenApiSchemaType = 'object' | 'array' | 'string' | 'number' | 'boolean' | 'integer' | 'null';
|
|
827
|
+
/**
|
|
828
|
+
* JSON Schema type name. Accepts a known primitive type or any other string.
|
|
829
|
+
* @see KnownOpenApiSchemaType
|
|
830
|
+
*/
|
|
683
831
|
export type OpenApiSchemaType = KnownOpenApiSchemaType | string;
|
|
832
|
+
/**
|
|
833
|
+
* Format names known to the parser. These include the OpenAPI formats, such as `int64`, `byte` and `password`, and
|
|
834
|
+
* the JSON Schema formats, such as `date-time` and `uri`. A format refines a `string`, `number` or `integer` schema.
|
|
835
|
+
*/
|
|
684
836
|
export type KnownOpenApiSchemaFormat = 'int32' | 'int64' | 'float' | 'double' | 'byte' | 'binary' | 'date' | 'date-time' | 'time' | 'duration' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | 'password';
|
|
837
|
+
/**
|
|
838
|
+
* Schema format name. Accepts a known format or any other string.
|
|
839
|
+
* @see KnownOpenApiSchemaFormat
|
|
840
|
+
*/
|
|
685
841
|
export type OpenApiSchemaFormat = KnownOpenApiSchemaFormat | string;
|
|
842
|
+
/**
|
|
843
|
+
* Schema Object (OpenAPI 2.0 and 3.x). Describes the data type of a value using JSON Schema keywords. OpenAPI 2.0 uses
|
|
844
|
+
* it for parameters, responses and `definitions`, and OpenAPI 3.x uses it for components, media types and parameters.
|
|
845
|
+
*/
|
|
686
846
|
export type OpenApiSchema = OpenApiObject<'schema'> & {
|
|
687
847
|
/**
|
|
688
848
|
* Type of the schema (e.g., object, array, string, number, boolean, integer).
|
|
@@ -858,6 +1018,10 @@ export type OpenApiSchema = OpenApiObject<'schema'> & {
|
|
|
858
1018
|
*/
|
|
859
1019
|
deprecated?: boolean;
|
|
860
1020
|
};
|
|
1021
|
+
/**
|
|
1022
|
+
* Discriminator Object (OpenAPI 3.x). Names the property that selects between polymorphic schemas, and can map its
|
|
1023
|
+
* values to schema names. OpenAPI 2.0 uses a plain string property name instead.
|
|
1024
|
+
*/
|
|
861
1025
|
export type OpenApiDiscriminator = OpenApiObject<'discriminator'> & {
|
|
862
1026
|
/**
|
|
863
1027
|
* The name of the property in the payload that will hold the discriminator value.
|
|
@@ -873,6 +1037,10 @@ export type OpenApiDiscriminator = OpenApiObject<'discriminator'> & {
|
|
|
873
1037
|
[key: string]: string;
|
|
874
1038
|
};
|
|
875
1039
|
};
|
|
1040
|
+
/**
|
|
1041
|
+
* XML Object (OpenAPI 2.0 and 3.x). Controls how a schema is serialized as XML, such as its element name, its
|
|
1042
|
+
* namespace, and whether it is an attribute.
|
|
1043
|
+
*/
|
|
876
1044
|
export type OpenApiXml = OpenApiObject<'xml'> & {
|
|
877
1045
|
/**
|
|
878
1046
|
* Replaces the name of the element/attribute used for the described schema property.
|