@tsed/openspec 8.0.1 → 8.0.3
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/package.json +4 -3
- package/readme.md +1 -1
- package/src/common/OpenSpecExternalDocs.ts +10 -0
- package/src/common/OpenSpecHash.ts +1 -0
- package/src/common/OpenSpecInfo.ts +52 -0
- package/src/common/OpenSpecJsonSchema.ts +153 -0
- package/src/common/OpenSpecPath.ts +10 -0
- package/src/common/OpenSpecRef.ts +3 -0
- package/src/common/OpenSpecSecurity.ts +3 -0
- package/src/common/OpenSpecTag.ts +7 -0
- package/src/common/OpenSpecTypes.ts +1 -0
- package/src/common/OpenSpecVersions.ts +3 -0
- package/src/common/OpenSpecXML.ts +22 -0
- package/src/index.ts +39 -0
- package/src/openspec2/OS2Header.ts +8 -0
- package/src/openspec2/OS2Operation.ts +65 -0
- package/src/openspec2/OS2Parameter.ts +65 -0
- package/src/openspec2/OS2Paths.ts +8 -0
- package/src/openspec2/OS2Response.ts +22 -0
- package/src/openspec2/OS2Schema.ts +39 -0
- package/src/openspec2/OS2Security.ts +58 -0
- package/src/openspec2/OpenSpec2.ts +73 -0
- package/src/openspec3/OS3Callbacks.ts +5 -0
- package/src/openspec3/OS3Components.ts +49 -0
- package/src/openspec3/OS3Encoding.ts +25 -0
- package/src/openspec3/OS3Example.ts +19 -0
- package/src/openspec3/OS3Flows.ts +49 -0
- package/src/openspec3/OS3Header.ts +18 -0
- package/src/openspec3/OS3Link.ts +25 -0
- package/src/openspec3/OS3MediaType.ts +24 -0
- package/src/openspec3/OS3Operation.ts +70 -0
- package/src/openspec3/OS3Parameter.ts +83 -0
- package/src/openspec3/OS3Paths.ts +29 -0
- package/src/openspec3/OS3RequestBody.ts +22 -0
- package/src/openspec3/OS3Response.ts +25 -0
- package/src/openspec3/OS3Schema.ts +51 -0
- package/src/openspec3/OS3Security.ts +63 -0
- package/src/openspec3/OS3Server.ts +31 -0
- package/src/openspec3/OpenSpec3.ts +44 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {OpenSpecExternalDocs} from "../common/OpenSpecExternalDocs.js";
|
|
2
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
3
|
+
import {OpenSpecInfo} from "../common/OpenSpecInfo.js";
|
|
4
|
+
import {OpenSpecSecurity} from "../common/OpenSpecSecurity.js";
|
|
5
|
+
import {OpenSpecTag} from "../common/OpenSpecTag.js";
|
|
6
|
+
import {OS2BodyParameter, OS2QueryParameter} from "./OS2Parameter.js";
|
|
7
|
+
import {OS2Paths} from "./OS2Paths.js";
|
|
8
|
+
import {OS2Response} from "./OS2Response.js";
|
|
9
|
+
import {OS2Schema} from "./OS2Schema.js";
|
|
10
|
+
import {OS2Security} from "./OS2Security.js";
|
|
11
|
+
|
|
12
|
+
export interface OpenSpec2 {
|
|
13
|
+
/**
|
|
14
|
+
* Specifies the Swagger Specification version being used. It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be "2.0".
|
|
15
|
+
*/
|
|
16
|
+
swagger: string;
|
|
17
|
+
/**
|
|
18
|
+
* Provides metadata about the API. The metadata can be used by the clients if needed.
|
|
19
|
+
*/
|
|
20
|
+
info?: OpenSpecInfo;
|
|
21
|
+
/**
|
|
22
|
+
* The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the host is not included, the host serving the documentation is to be used (including the port). The host does not support [path templating](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathTemplating).
|
|
23
|
+
*/
|
|
24
|
+
host?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The base path on which the API is served, which is relative to the host. If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/). The basePath does not support path [path templating](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathTemplating).
|
|
27
|
+
*/
|
|
28
|
+
basePath?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The transfer protocol of the API. Values MUST be from the list: `http`, `https`, `ws`, `wss`. If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
|
|
31
|
+
*/
|
|
32
|
+
schemes?: ("http" | "https" | "ws" | "wss")[];
|
|
33
|
+
/**
|
|
34
|
+
* A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#mimeTypes).
|
|
35
|
+
*/
|
|
36
|
+
consumes?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls. Value MUST be as described under [Mime Types](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#mimeTypes).
|
|
39
|
+
*/
|
|
40
|
+
produces?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* The available paths and operations for the API.
|
|
43
|
+
*/
|
|
44
|
+
paths?: OpenSpecHash<OS2Paths>;
|
|
45
|
+
/**
|
|
46
|
+
* An object to hold data types produced and consumed by operations.
|
|
47
|
+
*/
|
|
48
|
+
definitions?: OpenSpecHash<OS2Schema>;
|
|
49
|
+
/**
|
|
50
|
+
* An object to hold parameters that can be used across operations. This property does not define global parameters for all operations.
|
|
51
|
+
*/
|
|
52
|
+
parameters?: OpenSpecHash<OS2BodyParameter | OS2QueryParameter>;
|
|
53
|
+
/**
|
|
54
|
+
* An object to hold responses that can be used across operations. This property does not define global responses for all operations.
|
|
55
|
+
*/
|
|
56
|
+
responses?: OpenSpecHash<OS2Response>;
|
|
57
|
+
/**
|
|
58
|
+
* A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements). Individual operations can override this definition.
|
|
59
|
+
*/
|
|
60
|
+
security?: OpenSpecSecurity;
|
|
61
|
+
/**
|
|
62
|
+
* Security scheme definitions that can be used across the specification.
|
|
63
|
+
*/
|
|
64
|
+
securityDefinitions?: OpenSpecHash<OS2Security>;
|
|
65
|
+
/**
|
|
66
|
+
* A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. The tags that are not declared may be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.
|
|
67
|
+
*/
|
|
68
|
+
tags?: OpenSpecTag[];
|
|
69
|
+
/**
|
|
70
|
+
* Additional external documentation.
|
|
71
|
+
*/
|
|
72
|
+
externalDocs?: OpenSpecExternalDocs;
|
|
73
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OS3Callbacks} from "./OS3Callbacks.js";
|
|
3
|
+
import {OS3Example} from "./OS3Example.js";
|
|
4
|
+
import {OS3Header} from "./OS3Header.js";
|
|
5
|
+
import {OS3Link} from "./OS3Link.js";
|
|
6
|
+
import {OS3Parameter} from "./OS3Parameter.js";
|
|
7
|
+
import {OS3RequestBody} from "./OS3RequestBody.js";
|
|
8
|
+
import {OS3Response} from "./OS3Response.js";
|
|
9
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
10
|
+
import {OS3Security} from "./OS3Security.js";
|
|
11
|
+
|
|
12
|
+
export interface OS3Components<Schema = OS3Schema> {
|
|
13
|
+
/**
|
|
14
|
+
* An object to hold reusable [Schema Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schemaObject).
|
|
15
|
+
*/
|
|
16
|
+
schemas?: OpenSpecHash<Schema>;
|
|
17
|
+
/**
|
|
18
|
+
* An object to hold reusable [Response Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#responseObject).
|
|
19
|
+
*/
|
|
20
|
+
responses?: OpenSpecHash<OS3Response<Schema>>;
|
|
21
|
+
/**
|
|
22
|
+
* An object to hold reusable [Parameter Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterObject).
|
|
23
|
+
*/
|
|
24
|
+
parameters?: OpenSpecHash<OS3Parameter<Schema>>;
|
|
25
|
+
/**
|
|
26
|
+
* An object to hold reusable [Example Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#exampleObject).
|
|
27
|
+
*/
|
|
28
|
+
examples?: OpenSpecHash<OS3Example>;
|
|
29
|
+
/**
|
|
30
|
+
* An object to hold reusable [Request Body Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#requestBodyObject).
|
|
31
|
+
*/
|
|
32
|
+
requestBodies?: OpenSpecHash<OS3RequestBody<Schema>>;
|
|
33
|
+
/**
|
|
34
|
+
* An object to hold reusable [Header Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#headerObject).
|
|
35
|
+
*/
|
|
36
|
+
headers?: OpenSpecHash<OS3Header<Schema>>;
|
|
37
|
+
/**
|
|
38
|
+
* An object to hold reusable [Security Scheme Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#securitySchemeObject).
|
|
39
|
+
*/
|
|
40
|
+
securitySchemes?: OpenSpecHash<OS3Security>;
|
|
41
|
+
/**
|
|
42
|
+
* An object to hold reusable [Link Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#linkObject).
|
|
43
|
+
*/
|
|
44
|
+
links?: OpenSpecHash<OS3Link>;
|
|
45
|
+
/**
|
|
46
|
+
* An object to hold reusable [Callback Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#callbackObject).
|
|
47
|
+
*/
|
|
48
|
+
callbacks?: OS3Callbacks;
|
|
49
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OS3Header} from "./OS3Header.js";
|
|
3
|
+
|
|
4
|
+
export interface OS3Encoding {
|
|
5
|
+
/**
|
|
6
|
+
* 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.
|
|
7
|
+
*/
|
|
8
|
+
contentType?: string;
|
|
9
|
+
/**
|
|
10
|
+
* A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.
|
|
11
|
+
*/
|
|
12
|
+
headers?: OpenSpecHash<OS3Header>;
|
|
13
|
+
/**
|
|
14
|
+
* Describes how a specific property value will be serialized depending on its type. See [Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterObject) for details on the `[style](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterStyle)` property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
|
|
15
|
+
*/
|
|
16
|
+
style?: string;
|
|
17
|
+
/**
|
|
18
|
+
* When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When `[style](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterStyle)` is `form`, the default value is true. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
|
|
19
|
+
*/
|
|
20
|
+
explode?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.
|
|
23
|
+
*/
|
|
24
|
+
allowReserved?: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface OS3Example {
|
|
2
|
+
/**
|
|
3
|
+
* Short description for the example.
|
|
4
|
+
*/
|
|
5
|
+
summary?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Long description for the example. CommonMark syntax MAY be used for rich text representation.
|
|
8
|
+
*/
|
|
9
|
+
description?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
|
|
12
|
+
*/
|
|
13
|
+
value?: any;
|
|
14
|
+
/**
|
|
15
|
+
* A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents.
|
|
16
|
+
* The `value` field and `externalValue` field are mutually exclusive.
|
|
17
|
+
*/
|
|
18
|
+
externalValue?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface OS3Flow {
|
|
2
|
+
/**
|
|
3
|
+
* The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
|
|
4
|
+
*/
|
|
5
|
+
refreshUrl?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
|
|
8
|
+
*/
|
|
9
|
+
scopes: {[key: string]: string};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface OS3FlowImplicit extends OS3Flow {
|
|
13
|
+
/**
|
|
14
|
+
* The authorization URL to be used for this flow. This MUST be in the form of a URL.
|
|
15
|
+
*/
|
|
16
|
+
authorizationUrl: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface OS3FlowPassword extends OS3Flow {
|
|
20
|
+
/**
|
|
21
|
+
* The token URL to be used for this flow. This MUST be in the form of a URL.
|
|
22
|
+
*/
|
|
23
|
+
tokenUrl: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface OS3FlowClientCredentials extends OS3Flow {
|
|
27
|
+
/**
|
|
28
|
+
* The token URL to be used for this flow. This MUST be in the form of a URL.
|
|
29
|
+
*/
|
|
30
|
+
tokenUrl: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface OS3FlowAuthorizationCode extends OS3Flow {
|
|
34
|
+
/**
|
|
35
|
+
* The authorization URL to be used for this flow. This MUST be in the form of a URL.
|
|
36
|
+
*/
|
|
37
|
+
authorizationUrl: string;
|
|
38
|
+
/**
|
|
39
|
+
* The token URL to be used for this flow. This MUST be in the form of a URL.
|
|
40
|
+
*/
|
|
41
|
+
tokenUrl: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface OS3Flows {
|
|
45
|
+
implicit?: OS3FlowImplicit;
|
|
46
|
+
password?: OS3FlowPassword;
|
|
47
|
+
clientCredentials?: OS3FlowClientCredentials;
|
|
48
|
+
authorizationCode?: OS3FlowAuthorizationCode;
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {OpenSpecExternalDocs} from "../common/OpenSpecExternalDocs.js";
|
|
2
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
3
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
4
|
+
|
|
5
|
+
export interface OS3Header<Schema = OS3Schema> {
|
|
6
|
+
/**
|
|
7
|
+
* A description of the header. CommonMark syntax MAY be used for rich text representation.
|
|
8
|
+
*/
|
|
9
|
+
description?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The schema defining the type used for the header.
|
|
12
|
+
*/
|
|
13
|
+
schema?: Schema | OpenSpecRef;
|
|
14
|
+
/**
|
|
15
|
+
* Additional external documentation for this tag.
|
|
16
|
+
*/
|
|
17
|
+
externalDocs?: OpenSpecExternalDocs;
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OS3Server} from "./OS3Server.js";
|
|
3
|
+
|
|
4
|
+
export interface OS3Link {
|
|
5
|
+
/**
|
|
6
|
+
* 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.
|
|
7
|
+
*/
|
|
8
|
+
operationRef?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The name of an existing, resolvable OAS operation, as defined with a unique operationId. This field is mutually exclusive of the operationRef field.
|
|
11
|
+
*/
|
|
12
|
+
operationId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same [parameter name](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterIn) in different locations (e.g. path.id).
|
|
15
|
+
*/
|
|
16
|
+
parameters?: OpenSpecHash<any>;
|
|
17
|
+
/**
|
|
18
|
+
* A description of the link. CommonMark syntax MAY be used for rich text representation.
|
|
19
|
+
*/
|
|
20
|
+
description?: string;
|
|
21
|
+
/**
|
|
22
|
+
* A server object to be used by the target operation.
|
|
23
|
+
*/
|
|
24
|
+
server?: OS3Server;
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
3
|
+
import {OS3Encoding} from "./OS3Encoding.js";
|
|
4
|
+
import {OS3Example} from "./OS3Example.js";
|
|
5
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
6
|
+
|
|
7
|
+
export interface OS3MediaType<Schema = OS3Schema> {
|
|
8
|
+
/**
|
|
9
|
+
* The schema defining the type used for the request body.
|
|
10
|
+
*/
|
|
11
|
+
schema?: Schema | OpenSpecRef;
|
|
12
|
+
/**
|
|
13
|
+
* Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
|
|
14
|
+
*/
|
|
15
|
+
example?: any;
|
|
16
|
+
/**
|
|
17
|
+
* Examples of the media type. Each example object SHOULD match the media type and specified schema if present. The examples field is mutually exclusive of the example field. Furthermore, if referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.
|
|
18
|
+
*/
|
|
19
|
+
examples?: OpenSpecHash<OS3Example | OpenSpecRef>;
|
|
20
|
+
/**
|
|
21
|
+
* A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is `multipart` or `application/x-www-form-urlencoded`.
|
|
22
|
+
*/
|
|
23
|
+
encoding?: OpenSpecHash<OS3Encoding>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {OpenSpecExternalDocs} from "../common/OpenSpecExternalDocs.js";
|
|
2
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
3
|
+
import {OpenSpecSecurity} from "../common/OpenSpecSecurity.js";
|
|
4
|
+
import {OS3Callbacks} from "./OS3Callbacks.js";
|
|
5
|
+
import {OS3Parameter} from "./OS3Parameter.js";
|
|
6
|
+
import {OS3RequestBody} from "./OS3RequestBody.js";
|
|
7
|
+
import {OS3Response} from "./OS3Response.js";
|
|
8
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
9
|
+
import {OS3Server} from "./OS3Server.js";
|
|
10
|
+
|
|
11
|
+
export interface OS3Operation<Schema = OS3Schema, Parameter = OS3Parameter<Schema>, Response = OpenSpecHash<OS3Response<Schema>>> {
|
|
12
|
+
/**
|
|
13
|
+
* Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.
|
|
14
|
+
*/
|
|
15
|
+
operationId: string;
|
|
16
|
+
/**
|
|
17
|
+
* A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
|
|
18
|
+
*/
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* A short summary of what the operation does.
|
|
22
|
+
*/
|
|
23
|
+
summary?: string;
|
|
24
|
+
/**
|
|
25
|
+
* A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
|
|
26
|
+
*/
|
|
27
|
+
tags?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Additional external documentation for this operation.
|
|
30
|
+
*/
|
|
31
|
+
externalDocs?: OpenSpecExternalDocs;
|
|
32
|
+
/**
|
|
33
|
+
* A list of parameters that are applicable for this operation. If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#pathItemParameters),
|
|
34
|
+
* the new definition will override it but can never remove it.
|
|
35
|
+
* The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a [name](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterName) and (location)[https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterIn].
|
|
36
|
+
* The list can use the [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#referenceObject) to link to parameters that are defined at the [OpenAPI Object's components/parameters](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#componentsParameters).
|
|
37
|
+
*/
|
|
38
|
+
parameters?: Parameter[];
|
|
39
|
+
/**
|
|
40
|
+
* The request body applicable for this operation.
|
|
41
|
+
* The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) has explicitly defined semantics for request bodies.
|
|
42
|
+
* In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.
|
|
43
|
+
*/
|
|
44
|
+
requestBody?: OS3RequestBody<Schema>;
|
|
45
|
+
/**
|
|
46
|
+
* The list of possible responses as they are returned from executing this operation.
|
|
47
|
+
*/
|
|
48
|
+
responses: Response;
|
|
49
|
+
/**
|
|
50
|
+
* Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. Default value is false.
|
|
51
|
+
*/
|
|
52
|
+
deprecated?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used.
|
|
55
|
+
* Only one of the security requirement objects need to be satisfied to authorize a request.
|
|
56
|
+
* This definition overrides any declared top-level [security](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#oasSecurity). To remove a top-level security declaration, an empty array can be used.
|
|
57
|
+
*/
|
|
58
|
+
security?: OpenSpecSecurity;
|
|
59
|
+
/**
|
|
60
|
+
* An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.
|
|
61
|
+
*/
|
|
62
|
+
servers?: OS3Server[];
|
|
63
|
+
/**
|
|
64
|
+
* A map of possible out-of band callbacks related to the parent operation.
|
|
65
|
+
* The key is a unique identifier for the [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#callbackObject).
|
|
66
|
+
* Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses.
|
|
67
|
+
* The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
|
|
68
|
+
*/
|
|
69
|
+
callbacks?: OS3Callbacks<Schema>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
3
|
+
import {OS3Example} from "./OS3Example.js";
|
|
4
|
+
import {OS3MediaType} from "./OS3MediaType.js";
|
|
5
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
6
|
+
|
|
7
|
+
export type OS3StyleParameter = "matrix" | "label" | "form" | "simple" | "spaceDelimited" | "pipeDelimited" | "deepObject";
|
|
8
|
+
|
|
9
|
+
export interface OS3Parameter<Schema = OS3Schema> {
|
|
10
|
+
/**
|
|
11
|
+
*The name of the parameter. Parameter names are case sensitive.
|
|
12
|
+
*
|
|
13
|
+
* - If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterIn) is `"path"`, the `name` field MUST correspond to the associated [path](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#pathsPath) segment from the path field in the [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#pathsObject). See [Path Templating](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#pathTemplating) for further information.
|
|
14
|
+
* - If [`in`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterIn) is `"header"` and the `name` field is `"Accept"`, `"Content-Type"` or `"Authorization"`, the parameter definition SHALL be ignored.
|
|
15
|
+
* - For all other cases, the `name` corresponds to the parameter name used by the [`in`](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#parameterIn) property.
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* The location of the parameter. Possible values are `"query"`, `"header"`, `"path"` or `"cookie"`.
|
|
20
|
+
*/
|
|
21
|
+
in: "path" | "query" | "header" | "cookie";
|
|
22
|
+
/**
|
|
23
|
+
* Determines whether this parameter is mandatory. If the [parameter location](Determines whether this parameter is mandatory.
|
|
24
|
+
* If the parameter location is `"path"`, this property is **REQUIRED** and its value MUST be `true`.
|
|
25
|
+
* Otherwise, the property MAY be included and its default value is false.) is `"path"`, this property is **REQUIRED** and its value MUST be `true`.
|
|
26
|
+
* Otherwise, the property MAY be included and its default value is `false`.
|
|
27
|
+
*/
|
|
28
|
+
required: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
|
|
31
|
+
*/
|
|
32
|
+
description?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
|
|
35
|
+
*/
|
|
36
|
+
deprecated?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the ability to pass empty-valued parameters.
|
|
39
|
+
* This is valid only for query parameters and allows sending a parameter with an empty value.
|
|
40
|
+
* Default value is `false`.
|
|
41
|
+
* If style is used, and if behavior is `n/a` (cannot be serialized), the value of `allowEmptyValue` SHALL be ignored.
|
|
42
|
+
*/
|
|
43
|
+
allowEmptyValue?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The schema defining the type used for the parameter.
|
|
46
|
+
*/
|
|
47
|
+
schema?: OS3Schema | OpenSpecRef;
|
|
48
|
+
/**
|
|
49
|
+
* Describes how the parameter value will be serialized depending on the type of the parameter value.
|
|
50
|
+
* Default values (based on value of in): for `query` - `form`; for `path` - `simple`; for `header` - `simple`; for `cookie` - `form`.
|
|
51
|
+
* See [style values](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#style-values).
|
|
52
|
+
*/
|
|
53
|
+
style?: OS3StyleParameter;
|
|
54
|
+
/**
|
|
55
|
+
* When this is true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map.
|
|
56
|
+
* For other types of parameters this property has no effect. When style is form, the default value is true. For all other styles, the default value is false.
|
|
57
|
+
*/
|
|
58
|
+
explode?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding.
|
|
61
|
+
* This property only applies to parameters with an `in` value of `query`. The default value is `false`.
|
|
62
|
+
*/
|
|
63
|
+
allowReserved?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Example of the media type.
|
|
66
|
+
* The `example` SHOULD match the specified schema and encoding properties if present.
|
|
67
|
+
* The `example` field is mutually exclusive of the `examples` field.
|
|
68
|
+
* Furthermore, if referencing a `schema` which contains an example, the `example` value SHALL override the example provided by the schema.
|
|
69
|
+
* To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary.
|
|
70
|
+
*/
|
|
71
|
+
example?: any;
|
|
72
|
+
/**
|
|
73
|
+
* Examples of the media type.
|
|
74
|
+
* Each example SHOULD contain a value in the correct format as specified in the parameter encoding.
|
|
75
|
+
* The `examples` field is mutually exclusive of the `example` field.
|
|
76
|
+
* Furthermore, if referencing a `schema` which contains an example, the examples value SHALL override the example provided by the schema.
|
|
77
|
+
*/
|
|
78
|
+
examples?: OpenSpecHash<OS3Example | OpenSpecRef>;
|
|
79
|
+
/***
|
|
80
|
+
* A map containing the representations for the parameter. The key is the media type and the value describes it. The map MUST only contain one entry.
|
|
81
|
+
*/
|
|
82
|
+
content?: OpenSpecHash<OS3MediaType>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {OpenSpecPath} from "../common/OpenSpecPath.js";
|
|
2
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
3
|
+
import {OS3Operation} from "./OS3Operation.js";
|
|
4
|
+
import {OS3Parameter} from "./OS3Parameter.js";
|
|
5
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
6
|
+
import {OS3Server} from "./OS3Server.js";
|
|
7
|
+
|
|
8
|
+
export interface OS3Paths<Schema = OS3Schema> extends OpenSpecPath<OS3Operation<Schema>> {
|
|
9
|
+
/**
|
|
10
|
+
* An optional, string summary, intended to apply to all operations in this path.
|
|
11
|
+
*/
|
|
12
|
+
summary?: string;
|
|
13
|
+
/**
|
|
14
|
+
* An optional, string description, intended to apply to all operations in this path. CommonMark syntax MAY be used for rich text representation.
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A definition of a TRACE operation on this path.
|
|
19
|
+
*/
|
|
20
|
+
trace?: OS3Operation<Schema>;
|
|
21
|
+
/**
|
|
22
|
+
* An alternative server array to service all operations in this path.
|
|
23
|
+
*/
|
|
24
|
+
servers?: OS3Server[];
|
|
25
|
+
/**
|
|
26
|
+
* A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters.
|
|
27
|
+
*/
|
|
28
|
+
parameters?: (OS3Parameter<Schema> | OpenSpecRef)[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
3
|
+
import {OS3Example} from "./OS3Example.js";
|
|
4
|
+
import {OS3MediaType} from "./OS3MediaType.js";
|
|
5
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
6
|
+
|
|
7
|
+
export interface OS3RequestBody<Schema = OS3Schema> {
|
|
8
|
+
/**
|
|
9
|
+
* A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.
|
|
10
|
+
*/
|
|
11
|
+
description?: string;
|
|
12
|
+
/**
|
|
13
|
+
* A map containing descriptions of potential request body. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
|
|
14
|
+
*/
|
|
15
|
+
content?: OpenSpecHash<OS3MediaType<Schema>>;
|
|
16
|
+
/**
|
|
17
|
+
* Determines if the request body is required in the request. Defaults to false.
|
|
18
|
+
*/
|
|
19
|
+
required?: boolean;
|
|
20
|
+
|
|
21
|
+
examples?: OpenSpecHash<OS3Example | OpenSpecRef>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
3
|
+
import {OS3Header} from "./OS3Header.js";
|
|
4
|
+
import {OS3Link} from "./OS3Link.js";
|
|
5
|
+
import {OS3MediaType} from "./OS3MediaType.js";
|
|
6
|
+
import {OS3Schema} from "./OS3Schema.js";
|
|
7
|
+
|
|
8
|
+
export interface OS3Response<Schema = OS3Schema, Header = OS3Header<Schema>> {
|
|
9
|
+
/**
|
|
10
|
+
* A short description of the response. CommonMark syntax MAY be used for rich text representation.
|
|
11
|
+
*/
|
|
12
|
+
description: string;
|
|
13
|
+
/**
|
|
14
|
+
* Maps a header name to its definition. [RFC7230](https://tools.ietf.org/html/rfc7230#page-22) states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.
|
|
15
|
+
*/
|
|
16
|
+
headers?: OpenSpecHash<Header>;
|
|
17
|
+
/**
|
|
18
|
+
* A map containing descriptions of potential response payloads. The key is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
|
|
19
|
+
*/
|
|
20
|
+
content?: OpenSpecHash<OS3MediaType<Schema>>;
|
|
21
|
+
/**
|
|
22
|
+
* A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for [Component Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#componentsObject).
|
|
23
|
+
*/
|
|
24
|
+
links?: OpenSpecHash<OS3Link | OpenSpecRef>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {OpenSpecExternalDocs} from "../common/OpenSpecExternalDocs.js";
|
|
2
|
+
import {OpenSpecBaseJsonSchema, OpenSpecJsonSchema} from "../common/OpenSpecJsonSchema.js";
|
|
3
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
4
|
+
import {OpenSpecXML} from "../common/OpenSpecXML.js";
|
|
5
|
+
|
|
6
|
+
export interface OS3BaseSchema extends OpenSpecBaseJsonSchema {
|
|
7
|
+
/**
|
|
8
|
+
* Required if type is "array". Describes the type of items in the array.
|
|
9
|
+
*/
|
|
10
|
+
items?: OS3Schema | OpenSpecRef;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface OS3Schema extends OpenSpecJsonSchema<OS3Schema> {
|
|
14
|
+
/**
|
|
15
|
+
* Inline or referenced schema MUST be of a [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schemaObject) and not a standard JSON Schema.
|
|
16
|
+
*/
|
|
17
|
+
oneOf?: (OS3Schema | OpenSpecRef)[];
|
|
18
|
+
/**
|
|
19
|
+
* Inline or referenced schema MUST be of a [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schemaObject) and not a standard JSON Schema.
|
|
20
|
+
*/
|
|
21
|
+
anyOf?: (OS3Schema | OpenSpecRef)[];
|
|
22
|
+
/**
|
|
23
|
+
* Inline or referenced schema MUST be of a [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schemaObject) and not a standard JSON Schema.
|
|
24
|
+
*/
|
|
25
|
+
not?: OS3Schema | OpenSpecRef;
|
|
26
|
+
/**
|
|
27
|
+
* Allows sending a null value for the defined schema. Default value is false.
|
|
28
|
+
*/
|
|
29
|
+
nullable?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Adds support for polymorphism.
|
|
32
|
+
* The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the required property list. When used, the value MUST be the name of this schema or any schema that inherits it.
|
|
33
|
+
*/
|
|
34
|
+
discriminator?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as readOnly being true SHOULD NOT be in the required list of the defined schema. Default value is false.
|
|
37
|
+
*/
|
|
38
|
+
readOnly?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Relevant only for Schema "properties" definitions. Declares the property as "write only". Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.
|
|
41
|
+
*/
|
|
42
|
+
writeOnly?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* This MAY be used only on properties schemas. It has no effect on root schemas. Adds Additional metadata to describe the XML representation format of this property.
|
|
45
|
+
*/
|
|
46
|
+
xml?: OpenSpecXML;
|
|
47
|
+
/**
|
|
48
|
+
* Additional external documentation for this schema.
|
|
49
|
+
*/
|
|
50
|
+
externalDocs?: OpenSpecExternalDocs;
|
|
51
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {OS3Flows} from "./OS3Flows.js";
|
|
2
|
+
|
|
3
|
+
export interface OS3SecurityBase {
|
|
4
|
+
/**
|
|
5
|
+
* The type of the security scheme
|
|
6
|
+
*/
|
|
7
|
+
type: "apiKey" | "oauth2" | "http" | "openIdConnect";
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface OS3SecurityApiKey extends OS3SecurityBase {
|
|
15
|
+
/**
|
|
16
|
+
* The type of the security scheme
|
|
17
|
+
*/
|
|
18
|
+
type: "apiKey";
|
|
19
|
+
/**
|
|
20
|
+
* The name of the header, query or cookie parameter to be used.
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* The location of the API key. Valid values are `query`, `header` or `cookie`.
|
|
25
|
+
*/
|
|
26
|
+
in: "query" | "header" | "cookie";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface OS3SecurityOAuth2 extends OS3SecurityBase {
|
|
30
|
+
/**
|
|
31
|
+
* The type of the security scheme
|
|
32
|
+
*/
|
|
33
|
+
type: "oauth2";
|
|
34
|
+
/**
|
|
35
|
+
* An object containing configuration information for the flow types supported.
|
|
36
|
+
*/
|
|
37
|
+
flows: OS3Flows;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface OS3SecurityOpenIDConnect extends OS3SecurityBase {
|
|
41
|
+
/**
|
|
42
|
+
* The type of the security scheme
|
|
43
|
+
*/
|
|
44
|
+
type: "openIdConnect";
|
|
45
|
+
openIdConnectUrl: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface OS3SecurityHTTP extends OS3SecurityBase {
|
|
49
|
+
/**
|
|
50
|
+
* The type of the security scheme
|
|
51
|
+
*/
|
|
52
|
+
type: "http";
|
|
53
|
+
/**
|
|
54
|
+
* The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1).
|
|
55
|
+
*/
|
|
56
|
+
scheme: string;
|
|
57
|
+
/**
|
|
58
|
+
* A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
|
|
59
|
+
*/
|
|
60
|
+
bearerFormat?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type OS3Security = OS3SecurityApiKey | OS3SecurityHTTP | OS3SecurityOAuth2 | OS3SecurityOpenIDConnect;
|