@ahoo-wang/fetcher-openapi 1.9.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/LICENSE +201 -0
- package/README.md +92 -0
- package/README.zh-CN.md +91 -0
- package/dist/base-types.d.ts +56 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/components.d.ts +45 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +2 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/info.d.ts +44 -0
- package/dist/info.d.ts.map +1 -0
- package/dist/openAPI.d.ts +30 -0
- package/dist/openAPI.d.ts.map +1 -0
- package/dist/parameters.d.ts +78 -0
- package/dist/parameters.d.ts.map +1 -0
- package/dist/paths.d.ts +75 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/reference.d.ts +18 -0
- package/dist/reference.d.ts.map +1 -0
- package/dist/responses.d.ts +51 -0
- package/dist/responses.d.ts.map +1 -0
- package/dist/schema.d.ts +109 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/security.d.ts +58 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/server.d.ts +28 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/tags.d.ts +14 -0
- package/dist/tags.d.ts.map +1 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2025] [ahoo wang <ahoowang@qq.com>]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @ahoo-wang/fetcher-openapi
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-openapi)
|
|
4
|
+
[](https://github.com/Ahoo-Wang/fetcher/actions)
|
|
5
|
+
[](https://codecov.io/gh/Ahoo-Wang/fetcher)
|
|
6
|
+
[](https://github.com/Ahoo-Wang/fetcher/blob/main/LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-openapi)
|
|
8
|
+
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-openapi)
|
|
9
|
+
[](https://deepwiki.com/Ahoo-Wang/fetcher)
|
|
10
|
+
|
|
11
|
+
OpenAPI Specification TypeScript types and utilities for [Fetcher](https://github.com/Ahoo-Wang/fetcher) - A modern,
|
|
12
|
+
ultra-lightweight HTTP client.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- 📦 **Ultra-lightweight** - Minimal overhead TypeScript types only
|
|
17
|
+
- 🦺 **Full TypeScript Support** - Complete type definitions for OpenAPI 3.x specification
|
|
18
|
+
- 🧩 **Modular Design** - Import only what you need
|
|
19
|
+
- 🎯 **Framework Agnostic** - Works with any OpenAPI-compatible tooling
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @ahoo-wang/fetcher-openapi
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Basic Types
|
|
30
|
+
|
|
31
|
+
Import OpenAPI specification types:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import type { OpenAPI, Schema, Operation } from '@ahoo-wang/fetcher-openapi';
|
|
35
|
+
|
|
36
|
+
const openAPI: OpenAPI = {
|
|
37
|
+
openapi: '3.0.1',
|
|
38
|
+
info: {
|
|
39
|
+
title: 'My API',
|
|
40
|
+
version: '1.0.0'
|
|
41
|
+
},
|
|
42
|
+
paths: {
|
|
43
|
+
'/users': {
|
|
44
|
+
get: {
|
|
45
|
+
summary: 'Get users',
|
|
46
|
+
responses: {
|
|
47
|
+
'200': {
|
|
48
|
+
description: 'A list of users',
|
|
49
|
+
content: {
|
|
50
|
+
'application/json': {
|
|
51
|
+
schema: {
|
|
52
|
+
type: 'array',
|
|
53
|
+
items: {
|
|
54
|
+
$ref: '#/components/schemas/User'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API Reference
|
|
68
|
+
|
|
69
|
+
### Core Types
|
|
70
|
+
|
|
71
|
+
- `OpenAPI` - Root document object
|
|
72
|
+
- `Info` - API metadata
|
|
73
|
+
- `Server` - Server configuration
|
|
74
|
+
- `Paths` - API paths and operations
|
|
75
|
+
- `Operation` - Single API operation
|
|
76
|
+
- `Schema` - Data schema definition
|
|
77
|
+
- `Parameter` - Operation parameter
|
|
78
|
+
- `RequestBody` - Request body definition
|
|
79
|
+
- `Response` - Response definition
|
|
80
|
+
- `Components` - Reusable components
|
|
81
|
+
- `SecurityScheme` - Security scheme definition
|
|
82
|
+
|
|
83
|
+
### Utility Types
|
|
84
|
+
|
|
85
|
+
- `ExtractSchemaType<S>` - Extract TypeScript type from OpenAPI Schema
|
|
86
|
+
- `ExtractRequestBodyType<Op, Components>` - Extract request body type from Operation
|
|
87
|
+
- `ExtractOkResponseBodyType<Op, Components>` - Extract successful response body type from Operation
|
|
88
|
+
- `ResolveReference<R, Components>` - Resolve $ref references to actual types
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
[Apache 2.0](https://github.com/Ahoo-Wang/fetcher/blob/master/LICENSE)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @ahoo-wang/fetcher-openapi
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-openapi)
|
|
4
|
+
[](https://github.com/Ahoo-Wang/fetcher/actions)
|
|
5
|
+
[](https://codecov.io/gh/Ahoo-Wang/fetcher)
|
|
6
|
+
[](https://github.com/Ahoo-Wang/fetcher/blob/main/LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-openapi)
|
|
8
|
+
[](https://www.npmjs.com/package/@ahoo-wang/fetcher-openapi)
|
|
9
|
+
[](https://deepwiki.com/Ahoo-Wang/fetcher)
|
|
10
|
+
|
|
11
|
+
[Fetcher](https://github.com/Ahoo-Wang/fetcher) 的 OpenAPI 规范 TypeScript 类型和工具 - 一个现代、超轻量级的 HTTP 客户端。
|
|
12
|
+
|
|
13
|
+
## 功能特性
|
|
14
|
+
|
|
15
|
+
- 📦 **超轻量级** - 最小化开销的 TypeScript 类型定义
|
|
16
|
+
- 🦺 **完整 TypeScript 支持** - OpenAPI 3.x 规范的完整类型定义
|
|
17
|
+
- 🧩 **模块化设计** - 按需导入所需功能
|
|
18
|
+
- 🎯 **框架无关** - 适用于任何与 OpenAPI 兼容的工具
|
|
19
|
+
|
|
20
|
+
## 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @ahoo-wang/fetcher-openapi
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 使用方法
|
|
27
|
+
|
|
28
|
+
### 基础类型
|
|
29
|
+
|
|
30
|
+
导入 OpenAPI 规范类型:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import type { OpenAPI, Schema, Operation } from '@ahoo-wang/fetcher-openapi';
|
|
34
|
+
|
|
35
|
+
const openAPI: OpenAPI = {
|
|
36
|
+
openapi: '3.0.1',
|
|
37
|
+
info: {
|
|
38
|
+
title: '我的 API',
|
|
39
|
+
version: '1.0.0'
|
|
40
|
+
},
|
|
41
|
+
paths: {
|
|
42
|
+
'/users': {
|
|
43
|
+
get: {
|
|
44
|
+
summary: '获取用户列表',
|
|
45
|
+
responses: {
|
|
46
|
+
'200': {
|
|
47
|
+
description: '用户列表',
|
|
48
|
+
content: {
|
|
49
|
+
'application/json': {
|
|
50
|
+
schema: {
|
|
51
|
+
type: 'array',
|
|
52
|
+
items: {
|
|
53
|
+
$ref: '#/components/schemas/User'
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API 参考
|
|
67
|
+
|
|
68
|
+
### 核心类型
|
|
69
|
+
|
|
70
|
+
- `OpenAPI` - 根文档对象
|
|
71
|
+
- `Info` - API 元数据
|
|
72
|
+
- `Server` - 服务器配置
|
|
73
|
+
- `Paths` - API 路径和操作
|
|
74
|
+
- `Operation` - 单个 API 操作
|
|
75
|
+
- `Schema` - 数据模式定义
|
|
76
|
+
- `Parameter` - 操作参数
|
|
77
|
+
- `RequestBody` - 请求体定义
|
|
78
|
+
- `Response` - 响应定义
|
|
79
|
+
- `Components` - 可复用组件
|
|
80
|
+
- `SecurityScheme` - 安全方案定义
|
|
81
|
+
|
|
82
|
+
### 工具类型
|
|
83
|
+
|
|
84
|
+
- `ExtractSchemaType<S>` - 从 OpenAPI Schema 中提取 TypeScript 类型
|
|
85
|
+
- `ExtractRequestBodyType<Op, Components>` - 从 Operation 中提取请求体类型
|
|
86
|
+
- `ExtractOkResponseBodyType<Op, Components>` - 从 Operation 中提取成功响应体类型
|
|
87
|
+
- `ResolveReference<R, Components>` - 解析 $ref 引用为实际类型
|
|
88
|
+
|
|
89
|
+
## 许可证
|
|
90
|
+
|
|
91
|
+
[Apache 2.0](https://github.com/Ahoo-Wang/fetcher/blob/master/LICENSE)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Schema } from './schema';
|
|
2
|
+
import { Reference } from './reference';
|
|
3
|
+
import { MediaType } from './parameters';
|
|
4
|
+
/**
|
|
5
|
+
* HTTP methods as defined in the OpenAPI specification
|
|
6
|
+
*/
|
|
7
|
+
export type HTTPMethod = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
|
|
8
|
+
/**
|
|
9
|
+
* Supported parameter locations in HTTP requests
|
|
10
|
+
*/
|
|
11
|
+
export type ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
|
|
12
|
+
/**
|
|
13
|
+
* Primitive data types supported by JSON Schema
|
|
14
|
+
*/
|
|
15
|
+
export type SchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
|
|
16
|
+
/**
|
|
17
|
+
* Additional external documentation
|
|
18
|
+
*
|
|
19
|
+
* @property description - A description of the target documentation
|
|
20
|
+
* @property url - The URL for the target documentation
|
|
21
|
+
*/
|
|
22
|
+
export interface ExternalDocumentation {
|
|
23
|
+
description?: string;
|
|
24
|
+
url: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Example object
|
|
28
|
+
*
|
|
29
|
+
* @property summary - Short description for the example
|
|
30
|
+
* @property description - Long description for the example
|
|
31
|
+
* @property value - Embedded literal example
|
|
32
|
+
* @property externalValue - A URL that points to the literal example
|
|
33
|
+
*/
|
|
34
|
+
export interface Example {
|
|
35
|
+
summary?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
value?: any;
|
|
38
|
+
externalValue?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The Header Object follows the structure of the Parameter Object
|
|
42
|
+
*/
|
|
43
|
+
export interface Header {
|
|
44
|
+
description?: string;
|
|
45
|
+
required?: boolean;
|
|
46
|
+
deprecated?: boolean;
|
|
47
|
+
allowEmptyValue?: boolean;
|
|
48
|
+
style?: string;
|
|
49
|
+
explode?: boolean;
|
|
50
|
+
allowReserved?: boolean;
|
|
51
|
+
schema?: Schema | Reference;
|
|
52
|
+
example?: any;
|
|
53
|
+
examples?: Record<string, Example | Reference>;
|
|
54
|
+
content?: Record<string, MediaType>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=base-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../src/base-types.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpG;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEnG;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACrC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Reference } from './reference';
|
|
2
|
+
import { Schema } from './schema';
|
|
3
|
+
import { Response, Link, Callback } from './responses';
|
|
4
|
+
import { Parameter, RequestBody } from './parameters';
|
|
5
|
+
import { SecurityScheme } from './security';
|
|
6
|
+
import { Example, Header } from './base-types';
|
|
7
|
+
/**
|
|
8
|
+
* Holds a set of reusable objects for different aspects of the OAS
|
|
9
|
+
*
|
|
10
|
+
* @property schemas - An object to hold reusable Schema Objects
|
|
11
|
+
* @property responses - An object to hold reusable Response Objects
|
|
12
|
+
* @property parameters - An object to hold reusable Parameter Objects
|
|
13
|
+
* @property examples - An object to hold reusable Example Objects
|
|
14
|
+
* @property requestBodies - An object to hold reusable Request Body Objects
|
|
15
|
+
* @property headers - An object to hold reusable Header Objects
|
|
16
|
+
* @property securitySchemes - An object to hold reusable Security Scheme Objects
|
|
17
|
+
* @property links - An object to hold reusable Link Objects
|
|
18
|
+
* @property callbacks - An object to hold reusable Callback Objects
|
|
19
|
+
*/
|
|
20
|
+
export interface Components {
|
|
21
|
+
schemas?: Record<string, Schema | Reference>;
|
|
22
|
+
responses?: Record<string, Response | Reference>;
|
|
23
|
+
parameters?: Record<string, Parameter | Reference>;
|
|
24
|
+
examples?: Record<string, Example | Reference>;
|
|
25
|
+
requestBodies?: Record<string, RequestBody | Reference>;
|
|
26
|
+
headers?: Record<string, Header | Reference>;
|
|
27
|
+
securitySchemes?: Record<string, SecurityScheme | Reference>;
|
|
28
|
+
links?: Record<string, Link | Reference>;
|
|
29
|
+
callbacks?: Record<string, Callback | Reference>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Mapping of component types to their respective interfaces
|
|
33
|
+
*/
|
|
34
|
+
export type ComponentTypeMap = {
|
|
35
|
+
schemas: Schema;
|
|
36
|
+
responses: Response;
|
|
37
|
+
parameters: Parameter;
|
|
38
|
+
examples: Example;
|
|
39
|
+
requestBodies: RequestBody;
|
|
40
|
+
headers: Header;
|
|
41
|
+
securitySchemes: SecurityScheme;
|
|
42
|
+
links: Link;
|
|
43
|
+
callbacks: Callback;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,QAAQ,CAAC;IACpB,UAAU,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,cAAc,CAAC;IAChC,KAAK,EAAE,IAAI,CAAC;IACZ,SAAS,EAAE,QAAQ,CAAC;CACrB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main entry point for OpenAPI TypeScript type definitions
|
|
3
|
+
*/
|
|
4
|
+
export * from './base-types';
|
|
5
|
+
export * from './reference';
|
|
6
|
+
export * from './info';
|
|
7
|
+
export * from './server';
|
|
8
|
+
export * from './paths';
|
|
9
|
+
export * from './parameters';
|
|
10
|
+
export * from './responses';
|
|
11
|
+
export * from './components';
|
|
12
|
+
export * from './security';
|
|
13
|
+
export * from './schema';
|
|
14
|
+
export * from './tags';
|
|
15
|
+
export * from './openAPI';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA;;GAEG;AAGH,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/info.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API metadata type definitions for OpenAPI Specification
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Contact information for the exposed API
|
|
6
|
+
*
|
|
7
|
+
* @property name - The identifying name of the contact person/organization
|
|
8
|
+
* @property url - The URL pointing to the contact information
|
|
9
|
+
* @property email - The email address of the contact person/organization
|
|
10
|
+
*/
|
|
11
|
+
export interface Contact {
|
|
12
|
+
name?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* License information for the exposed API
|
|
18
|
+
*
|
|
19
|
+
* @property name - The license name used for the API
|
|
20
|
+
* @property url - A URL to the license used for the API
|
|
21
|
+
*/
|
|
22
|
+
export interface License {
|
|
23
|
+
name: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Metadata about the API
|
|
28
|
+
*
|
|
29
|
+
* @property title - The title of the API
|
|
30
|
+
* @property description - A short description of the API
|
|
31
|
+
* @property termsOfService - A URL to the Terms of Service for the API
|
|
32
|
+
* @property contact - The contact information for the exposed API
|
|
33
|
+
* @property license - The license information for the exposed API
|
|
34
|
+
* @property version - The version of the OpenAPI document
|
|
35
|
+
*/
|
|
36
|
+
export interface Info {
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
termsOfService?: string;
|
|
40
|
+
contact?: Contact;
|
|
41
|
+
license?: License;
|
|
42
|
+
version?: string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,IAAI;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Info } from './info';
|
|
2
|
+
import { Server } from './server';
|
|
3
|
+
import { Paths } from './paths';
|
|
4
|
+
import { Components } from './components';
|
|
5
|
+
import { SecurityRequirement } from './security';
|
|
6
|
+
import { Tag } from './tags';
|
|
7
|
+
import { ExternalDocumentation } from './base-types';
|
|
8
|
+
/**
|
|
9
|
+
* Root document object for the OpenAPI specification
|
|
10
|
+
*
|
|
11
|
+
* @property openapi - This string must be the version number of the OpenAPI Specification
|
|
12
|
+
* @property info - Provides metadata about the API
|
|
13
|
+
* @property servers - An array of Server Objects which provide connectivity information
|
|
14
|
+
* @property paths - The available paths and operations for the API
|
|
15
|
+
* @property components - An element to hold various schemas for the specification
|
|
16
|
+
* @property security - A declaration of which security mechanisms can be used across the API
|
|
17
|
+
* @property tags - A list of tags used by the specification with additional metadata
|
|
18
|
+
* @property externalDocs - Additional external documentation
|
|
19
|
+
*/
|
|
20
|
+
export interface OpenAPI {
|
|
21
|
+
openapi: string;
|
|
22
|
+
info: Info;
|
|
23
|
+
servers?: Server[];
|
|
24
|
+
paths: Paths;
|
|
25
|
+
components?: Components;
|
|
26
|
+
security?: SecurityRequirement[];
|
|
27
|
+
tags?: Tag[];
|
|
28
|
+
externalDocs?: ExternalDocumentation;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=openAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openAPI.d.ts","sourceRoot":"","sources":["../src/openAPI.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACjC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Example, Header, ParameterLocation } from './base-types';
|
|
2
|
+
import { Reference } from './reference';
|
|
3
|
+
import { Schema } from './schema';
|
|
4
|
+
/**
|
|
5
|
+
* Describes a single operation parameter
|
|
6
|
+
*
|
|
7
|
+
* @property name - The name of the parameter
|
|
8
|
+
* @property in - The location of the parameter
|
|
9
|
+
* @property description - A brief description of the parameter
|
|
10
|
+
* @property required - Determines whether this parameter is mandatory
|
|
11
|
+
* @property deprecated - Specifies that a parameter is deprecated
|
|
12
|
+
* @property allowEmptyValue - Sets the ability to pass empty-valued parameters
|
|
13
|
+
* @property style - Describes how the parameter value will be serialized
|
|
14
|
+
* @property explode - When true, parameter values of type array or object generate separate parameters
|
|
15
|
+
* @property allowReserved - Determines whether the parameter value should allow reserved characters
|
|
16
|
+
* @property schema - The schema defining the type used for the parameter
|
|
17
|
+
* @property example - Example of the parameter's potential value
|
|
18
|
+
* @property examples - Examples of the parameter's potential value
|
|
19
|
+
* @property content - A map containing the representations for the parameter
|
|
20
|
+
*/
|
|
21
|
+
export interface Parameter {
|
|
22
|
+
name: string;
|
|
23
|
+
in: ParameterLocation;
|
|
24
|
+
description?: string;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
deprecated?: boolean;
|
|
27
|
+
allowEmptyValue?: boolean;
|
|
28
|
+
style?: string;
|
|
29
|
+
explode?: boolean;
|
|
30
|
+
allowReserved?: boolean;
|
|
31
|
+
schema?: Schema | Reference;
|
|
32
|
+
example?: any;
|
|
33
|
+
examples?: Record<string, Example | Reference>;
|
|
34
|
+
content?: Record<string, MediaType>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Describes a single request body
|
|
38
|
+
*
|
|
39
|
+
* @property description - A brief description of the request body
|
|
40
|
+
* @property content - The content of the request body
|
|
41
|
+
* @property required - Determines if the request body is required in the request
|
|
42
|
+
*/
|
|
43
|
+
export interface RequestBody {
|
|
44
|
+
description?: string;
|
|
45
|
+
content: Record<string, MediaType>;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Each Media Type Object provides schema and examples for the media type identified by its key
|
|
50
|
+
*
|
|
51
|
+
* @property schema - The schema defining the content of the request, response, or parameter
|
|
52
|
+
* @property example - Example of the media type
|
|
53
|
+
* @property examples - Examples of the media type
|
|
54
|
+
* @property encoding - A map between a property name and its encoding information
|
|
55
|
+
*/
|
|
56
|
+
export interface MediaType {
|
|
57
|
+
schema?: Schema | Reference;
|
|
58
|
+
example?: any;
|
|
59
|
+
examples?: Record<string, Example | Reference>;
|
|
60
|
+
encoding?: Record<string, Encoding>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A single encoding definition applied to a single schema property
|
|
64
|
+
*
|
|
65
|
+
* @property contentType - The Content-Type for encoding a specific property
|
|
66
|
+
* @property headers - A map allowing additional information to be provided as headers
|
|
67
|
+
* @property style - Describes how a specific property value will be serialized
|
|
68
|
+
* @property explode - When true, property values of type array or object generate separate parameters
|
|
69
|
+
* @property allowReserved - Determines whether the parameter value should allow reserved characters
|
|
70
|
+
*/
|
|
71
|
+
export interface Encoding {
|
|
72
|
+
contentType?: string;
|
|
73
|
+
headers?: Record<string, Header | Reference>;
|
|
74
|
+
style?: string;
|
|
75
|
+
explode?: boolean;
|
|
76
|
+
allowReserved?: boolean;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../src/parameters.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,iBAAiB,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACrC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Reference } from './reference';
|
|
2
|
+
import { Server } from './server';
|
|
3
|
+
import { Parameter, RequestBody } from './parameters';
|
|
4
|
+
import { Responses, Callback } from './responses';
|
|
5
|
+
import { SecurityRequirement } from './security';
|
|
6
|
+
import { ExternalDocumentation } from './base-types';
|
|
7
|
+
/**
|
|
8
|
+
* Describes a single API operation on a path
|
|
9
|
+
*
|
|
10
|
+
* @property tags - A list of tags for API documentation control
|
|
11
|
+
* @property summary - A short summary of what the operation does
|
|
12
|
+
* @property description - A verbose explanation of the operation behavior
|
|
13
|
+
* @property externalDocs - Additional external documentation for this operation
|
|
14
|
+
* @property operationId - Unique string used to identify the operation
|
|
15
|
+
* @property parameters - List of parameters that are applicable for this operation
|
|
16
|
+
* @property requestBody - The request body applicable for this operation
|
|
17
|
+
* @property responses - The list of possible responses as they are returned from executing this operation
|
|
18
|
+
* @property callbacks - A map of possible out-of band callbacks related to the parent operation
|
|
19
|
+
* @property deprecated - Declares this operation to be deprecated
|
|
20
|
+
* @property security - Declaration of which security mechanisms can be used for this operation
|
|
21
|
+
* @property servers - Alternative server array to service this operation
|
|
22
|
+
*/
|
|
23
|
+
export interface Operation {
|
|
24
|
+
tags?: string[];
|
|
25
|
+
summary?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
externalDocs?: ExternalDocumentation;
|
|
28
|
+
operationId?: string;
|
|
29
|
+
parameters?: (Parameter | Reference)[];
|
|
30
|
+
requestBody?: RequestBody | Reference;
|
|
31
|
+
responses: Responses;
|
|
32
|
+
callbacks?: Record<string, Callback | Reference>;
|
|
33
|
+
deprecated?: boolean;
|
|
34
|
+
security?: SecurityRequirement[];
|
|
35
|
+
servers?: Server[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Describes the operations available on a single path
|
|
39
|
+
*
|
|
40
|
+
* @property $ref - A reference to another path item
|
|
41
|
+
* @property summary - An optional summary of the path item
|
|
42
|
+
* @property description - An optional description of the path item
|
|
43
|
+
* @property get - Definition of a GET operation on this path
|
|
44
|
+
* @property put - Definition of a PUT operation on this path
|
|
45
|
+
* @property post - Definition of a POST operation on this path
|
|
46
|
+
* @property delete - Definition of a DELETE operation on this path
|
|
47
|
+
* @property options - Definition of an OPTIONS operation on this path
|
|
48
|
+
* @property head - Definition of a HEAD operation on this path
|
|
49
|
+
* @property patch - Definition of a PATCH operation on this path
|
|
50
|
+
* @property trace - Definition of a TRACE operation on this path
|
|
51
|
+
* @property servers - Alternative server array to service all operations in this path
|
|
52
|
+
* @property parameters - List of parameters that are applicable for all operations in this path
|
|
53
|
+
*/
|
|
54
|
+
export interface PathItem {
|
|
55
|
+
$ref?: string;
|
|
56
|
+
summary?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
get?: Operation;
|
|
59
|
+
put?: Operation;
|
|
60
|
+
post?: Operation;
|
|
61
|
+
delete?: Operation;
|
|
62
|
+
options?: Operation;
|
|
63
|
+
head?: Operation;
|
|
64
|
+
patch?: Operation;
|
|
65
|
+
trace?: Operation;
|
|
66
|
+
servers?: Server[];
|
|
67
|
+
parameters?: (Parameter | Reference)[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Holds the relative paths to the individual endpoints and their operations
|
|
71
|
+
*/
|
|
72
|
+
export interface Paths {
|
|
73
|
+
[path: string]: PathItem;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference object definitions for OpenAPI Specification
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Reference object to allow referencing components in the document
|
|
6
|
+
*
|
|
7
|
+
* @property $ref - JSON Pointer to the target component
|
|
8
|
+
*/
|
|
9
|
+
export interface Reference {
|
|
10
|
+
$ref: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Utility type to check if an object is a reference
|
|
14
|
+
*/
|
|
15
|
+
export type IsReference<T> = T extends {
|
|
16
|
+
$ref: string;
|
|
17
|
+
} ? T : never;
|
|
18
|
+
//# sourceMappingURL=reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../src/reference.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Reference } from './reference';
|
|
2
|
+
import { MediaType } from './parameters';
|
|
3
|
+
import { Server } from './server';
|
|
4
|
+
import { PathItem } from './paths';
|
|
5
|
+
import { Header } from './base-types';
|
|
6
|
+
/**
|
|
7
|
+
* The Link object represents a possible design-time link for a response
|
|
8
|
+
*
|
|
9
|
+
* @property operationRef - A relative or absolute reference to an OAS operation
|
|
10
|
+
* @property operationId - The name of an existing, resolvable OAS operation
|
|
11
|
+
* @property parameters - A map representing parameters to pass to an operation
|
|
12
|
+
* @property requestBody - A literal value or expression to use as a request body
|
|
13
|
+
* @property description - A description of the link
|
|
14
|
+
* @property server - A server object to be used by the target operation
|
|
15
|
+
*/
|
|
16
|
+
export interface Link {
|
|
17
|
+
operationRef?: string;
|
|
18
|
+
operationId?: string;
|
|
19
|
+
parameters?: Record<string, any>;
|
|
20
|
+
requestBody?: any;
|
|
21
|
+
description?: string;
|
|
22
|
+
server?: Server;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Describes a single response from an API Operation
|
|
26
|
+
*
|
|
27
|
+
* @property description - A description of the response
|
|
28
|
+
* @property headers - Maps a header name to its definition
|
|
29
|
+
* @property content - A map containing descriptions of potential response payloads
|
|
30
|
+
* @property links - A map of operations links that can be followed from the response
|
|
31
|
+
*/
|
|
32
|
+
export interface Response {
|
|
33
|
+
description?: string;
|
|
34
|
+
headers?: Record<string, Header | Reference>;
|
|
35
|
+
content?: Record<string, MediaType>;
|
|
36
|
+
links?: Record<string, Link | Reference>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A container for the expected responses of an operation
|
|
40
|
+
*/
|
|
41
|
+
export interface Responses {
|
|
42
|
+
default?: Response | Reference;
|
|
43
|
+
[httpCode: string]: Response | Reference | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A map of possible out-of-band callbacks related to the parent operation
|
|
47
|
+
*/
|
|
48
|
+
export interface Callback {
|
|
49
|
+
[expression: string]: PathItem;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../src/responses.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC;;;;;;;;;GASG;AACH,MAAM,WAAW,IAAI;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAE/B,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC;CAChC"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ExternalDocumentation, SchemaType } from './base-types';
|
|
2
|
+
import { Reference } from './reference';
|
|
3
|
+
/**
|
|
4
|
+
* Adds support for polymorphism using discriminator
|
|
5
|
+
*
|
|
6
|
+
* @property propertyName - The name of the property in the payload that will hold the discriminator value
|
|
7
|
+
* @property mapping - An object to hold mappings between payload values and schema names or references
|
|
8
|
+
*/
|
|
9
|
+
export interface Discriminator {
|
|
10
|
+
propertyName: string;
|
|
11
|
+
mapping?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A metadata object that allows for more fine-tuned XML model definitions
|
|
15
|
+
*
|
|
16
|
+
* @property name - Replaces the name of the element/attribute used for the described schema property
|
|
17
|
+
* @property namespace - The URI of the namespace definition
|
|
18
|
+
* @property prefix - The prefix to be used for the name
|
|
19
|
+
* @property attribute - Declares whether the property definition translates to an attribute instead of an element
|
|
20
|
+
* @property wrapped - MAY be used only for an array definition and signifies whether the array is wrapped
|
|
21
|
+
*/
|
|
22
|
+
export interface XML {
|
|
23
|
+
name?: string;
|
|
24
|
+
namespace?: string;
|
|
25
|
+
prefix?: string;
|
|
26
|
+
attribute?: boolean;
|
|
27
|
+
wrapped?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The Schema Object allows the definition of input and output data types
|
|
31
|
+
*
|
|
32
|
+
* @property $schema - The URI of the JSON Schema dialect used for validation
|
|
33
|
+
* @property title - The title of the schema
|
|
34
|
+
* @property description - A description of the schema
|
|
35
|
+
* @property type - The data type of the schema
|
|
36
|
+
* @property format - The extending format for the previously mentioned type
|
|
37
|
+
* @property nullable - Allows sending a null value for the defined schema
|
|
38
|
+
* @property readOnly - Relevant only for Schema "properties" definitions
|
|
39
|
+
* @property writeOnly - Relevant only for Schema "properties" definitions
|
|
40
|
+
* @property deprecated - Specifies that a schema is deprecated
|
|
41
|
+
* @property example - A free-form property to include an example of an instance for this schema
|
|
42
|
+
* @property const - A value that the schema must exactly match
|
|
43
|
+
* @property default - The default value for this schema
|
|
44
|
+
* @property minimum - The minimum value of the range (for numeric types)
|
|
45
|
+
* @property maximum - The maximum value of the range (for numeric types)
|
|
46
|
+
* @property exclusiveMinimum - Whether the minimum value is excluded from the range
|
|
47
|
+
* @property exclusiveMaximum - Whether the maximum value is excluded from the range
|
|
48
|
+
* @property multipleOf - A number that must be a multiple of this value
|
|
49
|
+
* @property minLength - The minimum length of a string value
|
|
50
|
+
* @property maxLength - The maximum length of a string value
|
|
51
|
+
* @property pattern - The regular expression pattern that a string value must match
|
|
52
|
+
* @property items - The type definition for array items
|
|
53
|
+
* @property minItems - The minimum number of items in an array
|
|
54
|
+
* @property maxItems - The maximum number of items in an array
|
|
55
|
+
* @property uniqueItems - Whether all items in an array must be unique
|
|
56
|
+
* @property properties - The property definitions for an object type
|
|
57
|
+
* @property required - The list of required properties for an object type
|
|
58
|
+
* @property minProperties - The minimum number of properties for an object type
|
|
59
|
+
* @property maxProperties - The maximum number of properties for an object type
|
|
60
|
+
* @property additionalProperties - Defines whether additional properties are allowed
|
|
61
|
+
* @property allOf - Must be valid against all of the subschemas
|
|
62
|
+
* @property anyOf - Must be valid against any of the subschemas
|
|
63
|
+
* @property oneOf - Must be valid against exactly one of the subschemas
|
|
64
|
+
* @property not - Must not be valid against the supplied schema
|
|
65
|
+
* @property enum - The enumeration of possible values
|
|
66
|
+
* @property discriminator - Adds support for polymorphism
|
|
67
|
+
* @property xml - Additional metadata for XML formatting
|
|
68
|
+
* @property externalDocs - Additional external documentation for this schema
|
|
69
|
+
*/
|
|
70
|
+
export interface Schema {
|
|
71
|
+
$schema?: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
type?: SchemaType | SchemaType[];
|
|
75
|
+
format?: string;
|
|
76
|
+
nullable?: boolean;
|
|
77
|
+
readOnly?: boolean;
|
|
78
|
+
writeOnly?: boolean;
|
|
79
|
+
deprecated?: boolean;
|
|
80
|
+
example?: any;
|
|
81
|
+
const?: any;
|
|
82
|
+
default?: any;
|
|
83
|
+
minimum?: number;
|
|
84
|
+
maximum?: number;
|
|
85
|
+
exclusiveMinimum?: boolean | number;
|
|
86
|
+
exclusiveMaximum?: boolean | number;
|
|
87
|
+
multipleOf?: number;
|
|
88
|
+
minLength?: number;
|
|
89
|
+
maxLength?: number;
|
|
90
|
+
pattern?: string;
|
|
91
|
+
items?: Schema | Reference;
|
|
92
|
+
minItems?: number;
|
|
93
|
+
maxItems?: number;
|
|
94
|
+
uniqueItems?: boolean;
|
|
95
|
+
properties?: Record<string, Schema | Reference>;
|
|
96
|
+
required?: string[];
|
|
97
|
+
minProperties?: number;
|
|
98
|
+
maxProperties?: number;
|
|
99
|
+
additionalProperties?: boolean | Schema | Reference;
|
|
100
|
+
allOf?: Array<Schema | Reference>;
|
|
101
|
+
anyOf?: Array<Schema | Reference>;
|
|
102
|
+
oneOf?: Array<Schema | Reference>;
|
|
103
|
+
not?: Schema | Reference;
|
|
104
|
+
enum?: any[];
|
|
105
|
+
discriminator?: Discriminator;
|
|
106
|
+
xml?: XML;
|
|
107
|
+
externalDocs?: ExternalDocumentation;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,MAAM;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,CAAC,EAAE,GAAG,CAAC;IAGd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IAGtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAGpD,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAGzB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAGb,aAAa,CAAC,EAAE,aAAa,CAAC;IAG9B,GAAG,CAAC,EAAE,GAAG,CAAC;IAGV,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ParameterLocation } from './base-types';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration details for a supported OAuth Flow
|
|
4
|
+
*
|
|
5
|
+
* @property authorizationUrl - The authorization URL to be used for this flow
|
|
6
|
+
* @property tokenUrl - The token URL to be used for this flow
|
|
7
|
+
* @property refreshUrl - The URL to be used for obtaining refresh tokens
|
|
8
|
+
* @property scopes - The available scopes for the OAuth2 security scheme
|
|
9
|
+
*/
|
|
10
|
+
export interface OAuthFlow {
|
|
11
|
+
authorizationUrl?: string;
|
|
12
|
+
tokenUrl?: string;
|
|
13
|
+
refreshUrl?: string;
|
|
14
|
+
scopes: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Allows configuration of the supported OAuth Flows
|
|
18
|
+
*
|
|
19
|
+
* @property implicit - Configuration for the OAuth Implicit flow
|
|
20
|
+
* @property password - Configuration for the OAuth Resource Owner Password flow
|
|
21
|
+
* @property clientCredentials - Configuration for the OAuth Client Credentials flow
|
|
22
|
+
* @property authorizationCode - Configuration for the OAuth Authorization Code flow
|
|
23
|
+
*/
|
|
24
|
+
export interface OAuthFlows {
|
|
25
|
+
implicit?: OAuthFlow;
|
|
26
|
+
password?: OAuthFlow;
|
|
27
|
+
clientCredentials?: OAuthFlow;
|
|
28
|
+
authorizationCode?: OAuthFlow;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Defines a security scheme that can be used by the operations
|
|
32
|
+
*
|
|
33
|
+
* @property type - The type of the security scheme
|
|
34
|
+
* @property description - A short description for security scheme
|
|
35
|
+
* @property name - The name of the header, query or cookie parameter to be used
|
|
36
|
+
* @property in - The location of the API key
|
|
37
|
+
* @property scheme - The name of the HTTP Authorization scheme
|
|
38
|
+
* @property bearerFormat - A hint to the client to identify how the bearer token is formatted
|
|
39
|
+
* @property flows - An object containing configuration information for the flow types supported
|
|
40
|
+
* @property openIdConnectUrl - OpenId Connect URL to discover OAuth2 configuration values
|
|
41
|
+
*/
|
|
42
|
+
export interface SecurityScheme {
|
|
43
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
44
|
+
description?: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
in?: ParameterLocation;
|
|
47
|
+
scheme?: string;
|
|
48
|
+
bearerFormat?: string;
|
|
49
|
+
flows?: OAuthFlows;
|
|
50
|
+
openIdConnectUrl?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Lists the required security schemes to execute this operation
|
|
54
|
+
*/
|
|
55
|
+
export interface SecurityRequirement {
|
|
56
|
+
[name: string]: string[];
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,iBAAiB,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server configuration type definitions for OpenAPI Specification
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Server variable for URL template substitution
|
|
6
|
+
*
|
|
7
|
+
* @property enum - An enumeration of string values to be used if the substitution options are from a limited set
|
|
8
|
+
* @property default - The default value to use for substitution
|
|
9
|
+
* @property description - An optional description for the server variable
|
|
10
|
+
*/
|
|
11
|
+
export interface ServerVariable {
|
|
12
|
+
enum?: string[];
|
|
13
|
+
default: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Server configuration details
|
|
18
|
+
*
|
|
19
|
+
* @property url - A URL to the target host
|
|
20
|
+
* @property description - An optional string describing the host designated by the URL
|
|
21
|
+
* @property variables - A map between a variable name and its value
|
|
22
|
+
*/
|
|
23
|
+
export interface Server {
|
|
24
|
+
url: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
variables?: Record<string, ServerVariable>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAaA;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC5C"}
|
package/dist/tags.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExternalDocumentation } from './base-types';
|
|
2
|
+
/**
|
|
3
|
+
* Adds metadata to a single tag that is used by the Operation Object
|
|
4
|
+
*
|
|
5
|
+
* @property name - The name of the tag
|
|
6
|
+
* @property description - A description for the tag
|
|
7
|
+
* @property externalDocs - Additional external documentation for this tag
|
|
8
|
+
*/
|
|
9
|
+
export interface Tag {
|
|
10
|
+
name: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
externalDocs?: ExternalDocumentation;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../src/tags.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ahoo-wang/fetcher-openapi",
|
|
3
|
+
"version": "1.9.1",
|
|
4
|
+
"description": "OpenAPI Specification TypeScript types for Fetcher - A modern, ultra-lightweight HTTP client for browsers and Node.js. Provides complete TypeScript support with type inference for OpenAPI 3.x schemas.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"fetch",
|
|
7
|
+
"http",
|
|
8
|
+
"client",
|
|
9
|
+
"axios",
|
|
10
|
+
"ultra-lightweight",
|
|
11
|
+
"modular",
|
|
12
|
+
"typescript",
|
|
13
|
+
"interceptor",
|
|
14
|
+
"llm",
|
|
15
|
+
"streaming",
|
|
16
|
+
"sse",
|
|
17
|
+
"server-sent-events",
|
|
18
|
+
"openapi",
|
|
19
|
+
"openapi3",
|
|
20
|
+
"swagger",
|
|
21
|
+
"types",
|
|
22
|
+
"type-inference",
|
|
23
|
+
"schema",
|
|
24
|
+
"api",
|
|
25
|
+
"rest"
|
|
26
|
+
],
|
|
27
|
+
"author": "Ahoo-Wang",
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"homepage": "https://github.com/Ahoo-Wang/fetcher/tree/master/packages/openapi",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/Ahoo-Wang/fetcher.git",
|
|
33
|
+
"directory": "packages/openapi"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/Ahoo-Wang/fetcher/issues"
|
|
37
|
+
},
|
|
38
|
+
"type": "module",
|
|
39
|
+
"main": "./dist/index.umd.js",
|
|
40
|
+
"module": "./dist/index.es.js",
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"import": "./dist/index.es.js",
|
|
46
|
+
"require": "./dist/index.umd.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"README.md",
|
|
52
|
+
"README.zh-CN.md"
|
|
53
|
+
],
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@eslint/js": "^9.35.0",
|
|
56
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
57
|
+
"@vitest/ui": "^3.2.4",
|
|
58
|
+
"eslint": "^9.35.0",
|
|
59
|
+
"globals": "^16.4.0",
|
|
60
|
+
"prettier": "^3.6.2",
|
|
61
|
+
"typescript": "^5.9.2",
|
|
62
|
+
"typescript-eslint": "^8.44.0",
|
|
63
|
+
"unplugin-dts": "1.0.0-beta.6",
|
|
64
|
+
"vite": "^7.1.6",
|
|
65
|
+
"vite-bundle-analyzer": "^1.2.3",
|
|
66
|
+
"vitest": "^3.2.4"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "vite build",
|
|
70
|
+
"test:ui": "vitest --ui",
|
|
71
|
+
"test": "vitest run --coverage",
|
|
72
|
+
"lint": "eslint . --fix",
|
|
73
|
+
"clean": "rm -rf dist",
|
|
74
|
+
"analyze": "npx vite-bundle-analyzer -p auto"
|
|
75
|
+
}
|
|
76
|
+
}
|