@tsed/openspec 8.0.0 → 8.0.2
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/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
package/package.json
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
"name": "@tsed/openspec",
|
|
3
3
|
"description": "OpenSpec2 and OpenSpec3 interfaces declarations for TypeScript application",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.0.
|
|
5
|
+
"version": "8.0.2",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
9
9
|
"typings": "./lib/types/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
+
"@tsed/source": "./src/index.ts",
|
|
12
13
|
"types": "./lib/types/index.d.ts",
|
|
13
14
|
"import": "./lib/esm/index.js",
|
|
14
15
|
"default": "./lib/esm/index.js"
|
|
@@ -30,8 +31,8 @@
|
|
|
30
31
|
"JsonSchema"
|
|
31
32
|
],
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@tsed/barrels": "8.0.
|
|
34
|
-
"@tsed/typescript": "8.0.
|
|
34
|
+
"@tsed/barrels": "8.0.2",
|
|
35
|
+
"@tsed/typescript": "8.0.2",
|
|
35
36
|
"eslint": "9.12.0",
|
|
36
37
|
"typescript": "5.4.5"
|
|
37
38
|
},
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface OpenSpecExternalDocs {
|
|
2
|
+
/**
|
|
3
|
+
* The URL for the target documentation. Value MUST be in the format of a URL.
|
|
4
|
+
*/
|
|
5
|
+
url: string;
|
|
6
|
+
/**
|
|
7
|
+
* A short description of the target documentation. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
|
|
8
|
+
*/
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type OpenSpecHash<T> = Record<string, T>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface OpenSpecContact {
|
|
2
|
+
/**
|
|
3
|
+
* The identifying name of the contact person/organization.
|
|
4
|
+
*/
|
|
5
|
+
name?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The email address of the contact person/organization. MUST be in the format of an email address.
|
|
8
|
+
*/
|
|
9
|
+
email?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The URL pointing to the contact information. MUST be in the format of a URL.
|
|
12
|
+
*/
|
|
13
|
+
url?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface OpenSpecLicense {
|
|
17
|
+
/**
|
|
18
|
+
* The license name used for the API.
|
|
19
|
+
*/
|
|
20
|
+
name: string;
|
|
21
|
+
/**
|
|
22
|
+
* A URL to the license used for the API. MUST be in the format of a URL.
|
|
23
|
+
*/
|
|
24
|
+
url?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface OpenSpecInfo {
|
|
28
|
+
/**
|
|
29
|
+
* The title of the application.
|
|
30
|
+
*/
|
|
31
|
+
title: string;
|
|
32
|
+
/**
|
|
33
|
+
* The version of the OpenAPI document (which is distinct from the [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#oasVersion) version or the API implementation version).
|
|
34
|
+
*/
|
|
35
|
+
version: string;
|
|
36
|
+
/**
|
|
37
|
+
* A short description of the application. [CommonMark syntax](http://spec.commonmark.org/) MAY be used for rich text representation.
|
|
38
|
+
*/
|
|
39
|
+
description?: string;
|
|
40
|
+
/**
|
|
41
|
+
* A URL to the Terms of Service for the API. MUST be in the format of a URL.
|
|
42
|
+
*/
|
|
43
|
+
termsOfService?: string;
|
|
44
|
+
/**
|
|
45
|
+
* The contact information for the exposed API.
|
|
46
|
+
*/
|
|
47
|
+
contact?: OpenSpecContact;
|
|
48
|
+
/**
|
|
49
|
+
* The license information for the exposed API.
|
|
50
|
+
*/
|
|
51
|
+
license?: OpenSpecLicense;
|
|
52
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {OpenSpecHash} from "./OpenSpecHash.js";
|
|
2
|
+
import {OpenSpecRef} from "./OpenSpecRef.js";
|
|
3
|
+
import {OpenSpecTypes} from "./OpenSpecTypes.js";
|
|
4
|
+
|
|
5
|
+
export interface OpenSpecBaseJsonSchema {
|
|
6
|
+
$ref?: string;
|
|
7
|
+
/**
|
|
8
|
+
* This attribute is a string that provides a short description of the instance property.
|
|
9
|
+
*
|
|
10
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
|
11
|
+
*/
|
|
12
|
+
title?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Must be strictly greater than 0.
|
|
15
|
+
* A numeric instance is valid only if division by this keyword's value results in an integer.
|
|
16
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1
|
|
17
|
+
*/
|
|
18
|
+
multipleOf?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Representing an inclusive upper limit for a numeric instance.
|
|
21
|
+
* This keyword validates only if the instance is less than or exactly equal to "maximum".
|
|
22
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2
|
|
23
|
+
*/
|
|
24
|
+
maximum?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Representing an exclusive upper limit for a numeric instance.
|
|
27
|
+
* This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum".
|
|
28
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3
|
|
29
|
+
*/
|
|
30
|
+
exclusiveMaximum?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Representing an inclusive lower limit for a numeric instance.
|
|
33
|
+
* This keyword validates only if the instance is greater than or exactly equal to "minimum".
|
|
34
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4
|
|
35
|
+
*/
|
|
36
|
+
minimum?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Representing an exclusive lower limit for a numeric instance.
|
|
39
|
+
* This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum".
|
|
40
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5
|
|
41
|
+
*/
|
|
42
|
+
exclusiveMinimum?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Must be a non-negative integer.
|
|
45
|
+
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
|
|
46
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6
|
|
47
|
+
*/
|
|
48
|
+
maxLength?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Must be a non-negative integer.
|
|
51
|
+
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
|
|
52
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
53
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7
|
|
54
|
+
*/
|
|
55
|
+
minLength?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Should be a valid regular expression, according to the ECMA 262 regular expression dialect.
|
|
58
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8
|
|
59
|
+
*/
|
|
60
|
+
pattern?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Must be a non-negative integer.
|
|
63
|
+
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
|
|
64
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11
|
|
65
|
+
*/
|
|
66
|
+
maxItems?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Must be a non-negative integer.
|
|
69
|
+
* An array instance is valid against "maxItems" if its size is greater than, or equal to, the value of this keyword.
|
|
70
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
71
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12
|
|
72
|
+
*/
|
|
73
|
+
minItems?: number;
|
|
74
|
+
/**
|
|
75
|
+
* If this keyword has boolean value false, the instance validates successfully.
|
|
76
|
+
* If it has boolean value true, the instance validates successfully if all of its elements are unique.
|
|
77
|
+
* Omitting this keyword has the same behavior as a value of false.
|
|
78
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13
|
|
79
|
+
*/
|
|
80
|
+
uniqueItems?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Must be a non-negative integer.
|
|
83
|
+
* An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
|
|
84
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15
|
|
85
|
+
*/
|
|
86
|
+
maxProperties?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Must be a non-negative integer.
|
|
89
|
+
* An object instance is valid against "maxProperties" if its number of properties is greater than,
|
|
90
|
+
* or equal to, the value of this keyword.
|
|
91
|
+
* Omitting this keyword has the same behavior as a value of 0.
|
|
92
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16
|
|
93
|
+
*/
|
|
94
|
+
minProperties?: number;
|
|
95
|
+
/**
|
|
96
|
+
* This provides an enumeration of all possible values that are valid
|
|
97
|
+
* for the instance property. This MUST be an array, and each item in
|
|
98
|
+
* the array represents a possible value for the instance value. If
|
|
99
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
100
|
+
* values in the array in order for the schema to be valid.
|
|
101
|
+
*
|
|
102
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23
|
|
103
|
+
*/
|
|
104
|
+
enum?: any[];
|
|
105
|
+
/**
|
|
106
|
+
* This attribute is a string that provides a full description of the of purpose the instance property.
|
|
107
|
+
*
|
|
108
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
|
|
109
|
+
*/
|
|
110
|
+
description?: string;
|
|
111
|
+
/**
|
|
112
|
+
* This keyword can be used to supply a default JSON value associated with a particular schema.
|
|
113
|
+
* It is RECOMMENDED that a default value be valid against the associated schema.
|
|
114
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3
|
|
115
|
+
*/
|
|
116
|
+
default?: any;
|
|
117
|
+
/**
|
|
118
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8
|
|
119
|
+
*/
|
|
120
|
+
format?: string;
|
|
121
|
+
/**
|
|
122
|
+
* A single type, or a union of simple types
|
|
123
|
+
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25
|
|
124
|
+
*/
|
|
125
|
+
type?: OpenSpecTypes;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface OpenSpecJsonSchema<Schema = any> extends OpenSpecBaseJsonSchema {
|
|
129
|
+
/**
|
|
130
|
+
* Required if type is "array". Describes the type of items in the array.
|
|
131
|
+
*/
|
|
132
|
+
items?: Schema | OpenSpecRef;
|
|
133
|
+
/**
|
|
134
|
+
* A free-form property to include an example of an instance for this schema.
|
|
135
|
+
*/
|
|
136
|
+
required?: string[];
|
|
137
|
+
/**
|
|
138
|
+
* Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
|
|
139
|
+
*/
|
|
140
|
+
additionalProperties?: Schema | boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
|
|
143
|
+
*/
|
|
144
|
+
properties?: OpenSpecHash<Schema>;
|
|
145
|
+
/**
|
|
146
|
+
* 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.
|
|
147
|
+
*/
|
|
148
|
+
allOf?: (Schema | OpenSpecRef)[];
|
|
149
|
+
/**
|
|
150
|
+
* Additional external documentation for this schema.
|
|
151
|
+
*/
|
|
152
|
+
example?: any;
|
|
153
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type OpenSpecTypes = "string" | "number" | "integer" | "boolean" | "array" | "object" | "file";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface OpenSpecXML {
|
|
2
|
+
/**
|
|
3
|
+
* Replaces the name of the element/attribute used for the described schema property. When defined within items, it will affect the name of the individual XML elements within the list. When defined alongside type being array (outside the items), it will affect the wrapping element and only if wrapped is true. If wrapped is false, it will be ignored.
|
|
4
|
+
*/
|
|
5
|
+
name?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The URI of the namespace definition. Value MUST be in the form of an absolute URI.
|
|
8
|
+
*/
|
|
9
|
+
namespace?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The prefix to be used for the [name](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#xmlName).
|
|
12
|
+
*/
|
|
13
|
+
prefix?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Declares whether the property definition translates to an attribute instead of an element. Default value is false.
|
|
16
|
+
*/
|
|
17
|
+
attribute?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* MAY be used only for an array definition. Signifies whether the array is wrapped (for example, <books><book/><book/></books>) or unwrapped (<book/><book/>). Default value is false. The definition takes effect only when defined alongside type being array (outside the items).
|
|
20
|
+
*/
|
|
21
|
+
wrapped?: boolean;
|
|
22
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by @tsed/barrels.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./common/OpenSpecExternalDocs.js";
|
|
5
|
+
export * from "./common/OpenSpecHash.js";
|
|
6
|
+
export * from "./common/OpenSpecInfo.js";
|
|
7
|
+
export * from "./common/OpenSpecJsonSchema.js";
|
|
8
|
+
export * from "./common/OpenSpecPath.js";
|
|
9
|
+
export * from "./common/OpenSpecRef.js";
|
|
10
|
+
export * from "./common/OpenSpecSecurity.js";
|
|
11
|
+
export * from "./common/OpenSpecTag.js";
|
|
12
|
+
export * from "./common/OpenSpecTypes.js";
|
|
13
|
+
export * from "./common/OpenSpecVersions.js";
|
|
14
|
+
export * from "./common/OpenSpecXML.js";
|
|
15
|
+
export * from "./openspec2/OpenSpec2.js";
|
|
16
|
+
export * from "./openspec2/OS2Header.js";
|
|
17
|
+
export * from "./openspec2/OS2Operation.js";
|
|
18
|
+
export * from "./openspec2/OS2Parameter.js";
|
|
19
|
+
export * from "./openspec2/OS2Paths.js";
|
|
20
|
+
export * from "./openspec2/OS2Response.js";
|
|
21
|
+
export * from "./openspec2/OS2Schema.js";
|
|
22
|
+
export * from "./openspec2/OS2Security.js";
|
|
23
|
+
export * from "./openspec3/OpenSpec3.js";
|
|
24
|
+
export * from "./openspec3/OS3Callbacks.js";
|
|
25
|
+
export * from "./openspec3/OS3Components.js";
|
|
26
|
+
export * from "./openspec3/OS3Encoding.js";
|
|
27
|
+
export * from "./openspec3/OS3Example.js";
|
|
28
|
+
export * from "./openspec3/OS3Flows.js";
|
|
29
|
+
export * from "./openspec3/OS3Header.js";
|
|
30
|
+
export * from "./openspec3/OS3Link.js";
|
|
31
|
+
export * from "./openspec3/OS3MediaType.js";
|
|
32
|
+
export * from "./openspec3/OS3Operation.js";
|
|
33
|
+
export * from "./openspec3/OS3Parameter.js";
|
|
34
|
+
export * from "./openspec3/OS3Paths.js";
|
|
35
|
+
export * from "./openspec3/OS3RequestBody.js";
|
|
36
|
+
export * from "./openspec3/OS3Response.js";
|
|
37
|
+
export * from "./openspec3/OS3Schema.js";
|
|
38
|
+
export * from "./openspec3/OS3Security.js";
|
|
39
|
+
export * from "./openspec3/OS3Server.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {OS2BaseSchema} from "./OS2Schema.js";
|
|
2
|
+
|
|
3
|
+
export interface OS2Header extends OS2BaseSchema {
|
|
4
|
+
/**
|
|
5
|
+
* The type of the object. The value MUST be one of `string`, `number`, `integer`, `boolean`, or `array`.
|
|
6
|
+
*/
|
|
7
|
+
type: "string" | "number" | "integer" | "boolean" | "array";
|
|
8
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {OpenSpecExternalDocs} from "../common/OpenSpecExternalDocs.js";
|
|
2
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
3
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
4
|
+
import {OpenSpecSecurity} from "../common/OpenSpecSecurity.js";
|
|
5
|
+
import {OS2Parameter} from "./OS2Parameter.js";
|
|
6
|
+
import {OS2Response} from "./OS2Response.js";
|
|
7
|
+
|
|
8
|
+
export interface OS2Operation {
|
|
9
|
+
/**
|
|
10
|
+
* A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.
|
|
11
|
+
*/
|
|
12
|
+
tags?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* A short summary of what the operation does. For maximum readability in the swagger-ui, this field SHOULD be less than 120 characters.
|
|
15
|
+
*/
|
|
16
|
+
summary?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
|
|
19
|
+
*/
|
|
20
|
+
description?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Additional external documentation for this operation.
|
|
23
|
+
*/
|
|
24
|
+
externalDocs?: OpenSpecExternalDocs;
|
|
25
|
+
/**
|
|
26
|
+
* 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.
|
|
27
|
+
*/
|
|
28
|
+
operationId?: string;
|
|
29
|
+
/**
|
|
30
|
+
* A list of MIME types the operation can consume. This overrides the consumes definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#mimeTypes).
|
|
31
|
+
*/
|
|
32
|
+
consumes?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* A list of MIME types the operation can produce. This overrides the produces definition at the Swagger Object. An empty value MAY be used to clear the global definition. Value MUST be as described under [Mime Types](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#mimeTypes).
|
|
35
|
+
*/
|
|
36
|
+
produces?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* A list of parameters that are applicable for this operation.
|
|
39
|
+
* If a parameter is already defined at the [Path Item](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathItemParameters),
|
|
40
|
+
* the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters.
|
|
41
|
+
* A unique parameter is defined by a combination of a [name](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterName) and (location)[https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterIn].
|
|
42
|
+
* The list can use the [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#referenceObject) to link to parameters that are defined at the [Swagger Object's parameters](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerParameters).
|
|
43
|
+
* There can be one "body" parameter at most.
|
|
44
|
+
*/
|
|
45
|
+
parameters?: (OS2Parameter | OpenSpecRef)[];
|
|
46
|
+
/**
|
|
47
|
+
* The list of possible responses as they are returned from executing this operation.
|
|
48
|
+
*/
|
|
49
|
+
responses: OpenSpecHash<OS2Response | OpenSpecRef>;
|
|
50
|
+
/**
|
|
51
|
+
* 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.
|
|
52
|
+
*/
|
|
53
|
+
schemes?: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Declares this operation to be deprecated. Usage of the declared operation should be refrained. Default value is false.
|
|
56
|
+
*/
|
|
57
|
+
deprecated?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* A declaration of which security schemes are applied for this operation.
|
|
60
|
+
* The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements).
|
|
61
|
+
* This definition overrides any declared top-level [security](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swaggerSecurity).
|
|
62
|
+
* To remove a top-level security declaration, an empty array can be used.
|
|
63
|
+
*/
|
|
64
|
+
security?: OpenSpecSecurity;
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {OpenSpecTypes} from "../common/OpenSpecTypes.js";
|
|
2
|
+
import {OS2BaseSchema, OS2Schema} from "./OS2Schema.js";
|
|
3
|
+
|
|
4
|
+
export type OS2BaseParameter = {
|
|
5
|
+
name: string;
|
|
6
|
+
in: "body" | "query" | "path" | "header" | "formData";
|
|
7
|
+
required?: boolean;
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type OS2BodyParameter = OS2BaseParameter & {
|
|
12
|
+
in: "body";
|
|
13
|
+
schema?: OS2Schema;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type OS2GenericFormat = {
|
|
17
|
+
type?: OpenSpecTypes;
|
|
18
|
+
format?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type OS2IntegerFormat = {
|
|
22
|
+
type: "integer";
|
|
23
|
+
format?: "int32" | "int64";
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type OS2NumberFormat = {
|
|
27
|
+
type: "number";
|
|
28
|
+
format?: "float" | "double";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type OS2StringFormat = {
|
|
32
|
+
type: "string";
|
|
33
|
+
format?: "" | "byte" | "binary" | "date" | "date-time" | "password";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type OS2SchemaFormatConstraints = OS2GenericFormat | OS2IntegerFormat | OS2NumberFormat | OS2StringFormat;
|
|
37
|
+
export type OS2BaseFormatContrainedParameter = OS2BaseParameter & OS2SchemaFormatConstraints;
|
|
38
|
+
export type ParameterCollectionFormat = "csv" | "ssv" | "tsv" | "pipes" | "multi";
|
|
39
|
+
export type OS2QueryParameter = OS2BaseFormatContrainedParameter &
|
|
40
|
+
OS2BaseSchema & {
|
|
41
|
+
in: "query";
|
|
42
|
+
allowEmptyValue?: boolean;
|
|
43
|
+
collectionFormat?: ParameterCollectionFormat;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type OS2PathParameter = OS2BaseFormatContrainedParameter &
|
|
47
|
+
OS2BaseSchema & {
|
|
48
|
+
in: "path";
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type OS2HeaderParameter = OS2BaseFormatContrainedParameter &
|
|
53
|
+
OS2BaseSchema & {
|
|
54
|
+
in: "header";
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type OS2FormDataParameter = OS2BaseFormatContrainedParameter &
|
|
58
|
+
OS2BaseSchema & {
|
|
59
|
+
in: "formData";
|
|
60
|
+
type: OpenSpecTypes;
|
|
61
|
+
allowEmptyValue?: boolean;
|
|
62
|
+
collectionFormat?: ParameterCollectionFormat;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type OS2Parameter = OS2BodyParameter | OS2FormDataParameter | OS2QueryParameter | OS2PathParameter | OS2HeaderParameter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {OpenSpecPath} from "../common/OpenSpecPath.js";
|
|
2
|
+
import {OpenSpecRef} from "../common/OpenSpecRef.js";
|
|
3
|
+
import {OS2Operation} from "./OS2Operation.js";
|
|
4
|
+
import {OS2Parameter} from "./OS2Parameter.js";
|
|
5
|
+
|
|
6
|
+
export interface OS2Paths extends OpenSpecPath<OS2Operation> {
|
|
7
|
+
parameters?: (OS2Parameter | OpenSpecRef)[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
import {OS2Header} from "./OS2Header.js";
|
|
3
|
+
import {OS2Schema} from "./OS2Schema.js";
|
|
4
|
+
|
|
5
|
+
export interface OS2Response {
|
|
6
|
+
/**
|
|
7
|
+
* A short description of the response. GFM syntax can be used for rich text representation.
|
|
8
|
+
*/
|
|
9
|
+
description: string;
|
|
10
|
+
/**
|
|
11
|
+
* A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the Schema Object, its root type value may also be "file". This SHOULD be accompanied by a relevant produces mime-type.
|
|
12
|
+
*/
|
|
13
|
+
schema?: OS2Schema;
|
|
14
|
+
/**
|
|
15
|
+
* A list of headers that are sent with the response.
|
|
16
|
+
*/
|
|
17
|
+
headers?: OpenSpecHash<OS2Header>;
|
|
18
|
+
/**
|
|
19
|
+
* An example of the response message.
|
|
20
|
+
*/
|
|
21
|
+
examples?: OpenSpecHash<{}>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 OS2XML {
|
|
7
|
+
name?: string;
|
|
8
|
+
namespace?: string;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
attribute?: boolean;
|
|
11
|
+
wrapped?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface OS2BaseSchema extends OpenSpecBaseJsonSchema {
|
|
15
|
+
/**
|
|
16
|
+
* Required if type is "array". Describes the type of items in the array.
|
|
17
|
+
*/
|
|
18
|
+
items?: OS2Schema | OpenSpecRef;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface OS2Schema extends OpenSpecJsonSchema<OS2Schema> {
|
|
22
|
+
/**
|
|
23
|
+
* Adds support for polymorphism.
|
|
24
|
+
* 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.
|
|
25
|
+
*/
|
|
26
|
+
discriminator?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 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.
|
|
29
|
+
*/
|
|
30
|
+
readOnly?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 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.
|
|
33
|
+
*/
|
|
34
|
+
xml?: OpenSpecXML;
|
|
35
|
+
/**
|
|
36
|
+
* Additional external documentation for this schema.
|
|
37
|
+
*/
|
|
38
|
+
externalDocs?: OpenSpecExternalDocs;
|
|
39
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {OpenSpecHash} from "../common/OpenSpecHash.js";
|
|
2
|
+
|
|
3
|
+
export interface OS2SecurityBase {
|
|
4
|
+
/**
|
|
5
|
+
* The type of the security scheme
|
|
6
|
+
*/
|
|
7
|
+
type: "basic" | "apiKey" | "oauth2";
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface OS2SecurityBasic extends OS2SecurityBase {
|
|
15
|
+
type: "basic";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface OS2SecurityApiKey extends OS2SecurityBase {
|
|
19
|
+
type: "apiKey";
|
|
20
|
+
name: string;
|
|
21
|
+
in: "query" | "header";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface OS2SecurityOAuth extends OS2SecurityBase {
|
|
25
|
+
type: "oauth2";
|
|
26
|
+
flow: "accessCode" | "application" | "implicit" | "password";
|
|
27
|
+
/**
|
|
28
|
+
* The available scopes for the OAuth2 security scheme.
|
|
29
|
+
*/
|
|
30
|
+
scopes: OpenSpecHash<string>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface OS2FlowImplicit extends OS2SecurityOAuth {
|
|
34
|
+
type: "oauth2";
|
|
35
|
+
flow: "implicit";
|
|
36
|
+
authorizationUrl: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface OS2FlowPassword extends OS2SecurityOAuth {
|
|
40
|
+
type: "oauth2";
|
|
41
|
+
flow: "password";
|
|
42
|
+
tokenUrl: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface OS2FlowApplication extends OS2SecurityOAuth {
|
|
46
|
+
type: "oauth2";
|
|
47
|
+
flow: "application";
|
|
48
|
+
tokenUrl: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface OS2FlowAccessCode extends OS2SecurityOAuth {
|
|
52
|
+
type: "oauth2";
|
|
53
|
+
flow: "accessCode";
|
|
54
|
+
tokenUrl: string;
|
|
55
|
+
authorizationUrl: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type OS2Security = OS2SecurityBasic | OS2FlowAccessCode | OS2FlowApplication | OS2FlowImplicit | OS2FlowPassword | OS2SecurityApiKey;
|