@novice1/api-doc-definitions 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +3 -3
- package/lib/base-helper.d.ts +19 -0
- package/lib/base-helper.js +3 -0
- package/lib/base-helper.js.map +1 -0
- package/lib/commons.d.ts +24 -0
- package/lib/commons.js +3 -0
- package/lib/commons.js.map +1 -0
- package/lib/generators/openapi/definitions.d.ts +227 -0
- package/lib/generators/openapi/definitions.js +11 -0
- package/lib/generators/openapi/definitions.js.map +1 -0
- package/lib/generators/openapi/helper.d.ts +23 -0
- package/lib/generators/openapi/helper.js +3 -0
- package/lib/generators/openapi/helper.js.map +1 -0
- package/lib/generators/postman/definitions.d.ts +212 -0
- package/lib/generators/postman/definitions.js +18 -0
- package/lib/generators/postman/definitions.js.map +1 -0
- package/lib/generators/postman/helper.d.ts +13 -0
- package/lib/generators/postman/helper.js +3 -0
- package/lib/generators/postman/helper.js.map +1 -0
- package/lib/helpers.d.ts +3 -0
- package/lib/helpers.js +3 -0
- package/lib/helpers.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/values.d.ts +5 -0
- package/lib/values.js +35 -0
- package/lib/values.js.map +1 -0
- package/package.json +50 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @novice1/api-doc-definitions
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The repository is now a monorepo.
|
|
8
|
+
|
|
9
|
+
New packages:
|
|
10
|
+
|
|
11
|
+
- `@novice1/api-doc-definitions`: shared definitions (types and interfaces) used by the generator and the schema helpers.
|
|
12
|
+
- `@novice1/api-doc-joi-helper`: the Joi schema helper.
|
|
13
|
+
|
|
14
|
+
Changes:
|
|
15
|
+
|
|
16
|
+
- `@novice1/api-doc-generator`:
|
|
17
|
+
- The default handled schema is now JSON schema instead of Joi. The JSON schema helper is now part of this package.
|
|
18
|
+
- Imports `@novice1/api-doc-definitions` and re-exports it.
|
|
19
|
+
- `@novice1/api-doc-json-helper`:
|
|
20
|
+
- Imports `@novice1/api-doc-definitions`.
|
|
21
|
+
- This is probably the last version: the JSON schema helper now lives in, and is maintained by, `@novice1/api-doc-generator`.
|
|
22
|
+
- `@novice1/api-doc-zod-helper`:
|
|
23
|
+
- Imports `@novice1/api-doc-definitions`.
|
|
24
|
+
- Updated `zod` from `^4.3.6` to `~4.6.7`. Zod can introduce breaking changes even in minor versions, so only patch updates are accepted.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kisiwu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
This
|
|
1
|
+
# @novice1/api-doc-definitions
|
|
2
|
+
|
|
3
|
+
This package contains the TypeScript definitions for the Novice API documentation generator (`@novice1/api-doc-generator`). It provides the necessary types and interfaces to work with OpenAPI and Postman documentation within the Novice ecosystem.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface BaseHelperInterface {
|
|
2
|
+
isValid(): boolean;
|
|
3
|
+
getType(): string;
|
|
4
|
+
getDescription(): string;
|
|
5
|
+
isRequired(): boolean;
|
|
6
|
+
isUnique(): boolean;
|
|
7
|
+
hasDefaultValue(): boolean;
|
|
8
|
+
getDefaultValue(): unknown;
|
|
9
|
+
hasExampleValue(): boolean;
|
|
10
|
+
getExampleValue(): unknown;
|
|
11
|
+
isDeprecated(): boolean;
|
|
12
|
+
allowsEmptyValue(): boolean;
|
|
13
|
+
getEnum(): unknown[];
|
|
14
|
+
hasMin(): boolean;
|
|
15
|
+
hasMax(): boolean;
|
|
16
|
+
getMin(): number | undefined;
|
|
17
|
+
getMax(): number | undefined;
|
|
18
|
+
getUnit(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-helper.js","sourceRoot":"","sources":["../src/base-helper.ts"],"names":[],"mappings":""}
|
package/lib/commons.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RouteMeta interface was copied from "@novice1/routing"
|
|
3
|
+
* to not import all of its dependencies.
|
|
4
|
+
*/
|
|
5
|
+
export interface RouteMeta<MetaParameters extends Record<string, any> = Record<string, any>, ResType = any> {
|
|
6
|
+
path: string | RegExp;
|
|
7
|
+
methods: Record<string, any>;
|
|
8
|
+
name?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
tags?: string | string[];
|
|
11
|
+
auth?: boolean;
|
|
12
|
+
parameters?: MetaParameters;
|
|
13
|
+
responses?: ResType;
|
|
14
|
+
}
|
|
15
|
+
export interface ProcessedRoute {
|
|
16
|
+
path: string;
|
|
17
|
+
method: string;
|
|
18
|
+
schema?: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface DocGenerator {
|
|
21
|
+
add(routes: RouteMeta[]): ProcessedRoute[];
|
|
22
|
+
add(routes: RouteMeta): ProcessedRoute[];
|
|
23
|
+
result(): unknown;
|
|
24
|
+
}
|
package/lib/commons.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commons.js","sourceRoot":"","sources":["../src/commons.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export type OpenAPISupportedVersion = '3.0.4' | '3.1.1';
|
|
2
|
+
export type AdditionalProperties<T = SchemaObject3_1 | SchemaObject3_0> = boolean | T | ReferenceObject;
|
|
3
|
+
export declare enum ParameterLocation {
|
|
4
|
+
cookie = "cookie",
|
|
5
|
+
header = "header",
|
|
6
|
+
path = "path",
|
|
7
|
+
query = "query"
|
|
8
|
+
}
|
|
9
|
+
export interface SecurityRequirementObject {
|
|
10
|
+
[key: string]: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface ContactObject {
|
|
13
|
+
name?: string;
|
|
14
|
+
url?: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface LicenseObject {
|
|
19
|
+
name: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface InfoObject {
|
|
24
|
+
title: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
termsOfService?: string;
|
|
27
|
+
contact?: ContactObject;
|
|
28
|
+
license?: LicenseObject;
|
|
29
|
+
version: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
export type SchemaObject = SchemaObject3_0 | SchemaObject3_1;
|
|
33
|
+
export interface CommonPropsSchemaObject<T> {
|
|
34
|
+
allOf?: Array<T | ReferenceObject>;
|
|
35
|
+
anyOf?: Array<T | ReferenceObject>;
|
|
36
|
+
oneOf?: Array<T | ReferenceObject>;
|
|
37
|
+
not?: T | ReferenceObject;
|
|
38
|
+
items?: T | ReferenceObject;
|
|
39
|
+
properties?: Record<string, T | ReferenceObject>;
|
|
40
|
+
additionalProperties?: AdditionalProperties<T>;
|
|
41
|
+
title?: string;
|
|
42
|
+
/**
|
|
43
|
+
* CommonMark syntax MAY be used for rich text representation.
|
|
44
|
+
*/
|
|
45
|
+
description?: string;
|
|
46
|
+
format?: string;
|
|
47
|
+
pattern?: RegExp | string;
|
|
48
|
+
default?: unknown;
|
|
49
|
+
enum?: unknown[];
|
|
50
|
+
multipleOf?: number;
|
|
51
|
+
uniqueItems?: boolean;
|
|
52
|
+
required?: string[];
|
|
53
|
+
maxLength?: number;
|
|
54
|
+
minLength?: number;
|
|
55
|
+
maxItems?: number;
|
|
56
|
+
minItems?: number;
|
|
57
|
+
maxProperties?: number;
|
|
58
|
+
minProperties?: number;
|
|
59
|
+
maximum?: number;
|
|
60
|
+
minimum?: number;
|
|
61
|
+
exclusiveMaximum?: boolean;
|
|
62
|
+
exclusiveMinimum?: boolean;
|
|
63
|
+
discriminator?: DiscriminatorObject;
|
|
64
|
+
readOnly?: boolean;
|
|
65
|
+
writeOnly?: boolean;
|
|
66
|
+
xml?: unknown;
|
|
67
|
+
externalDocs?: ExternalDocObject;
|
|
68
|
+
deprecated?: boolean;
|
|
69
|
+
allowEmptyValue?: boolean;
|
|
70
|
+
$ref?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @links
|
|
74
|
+
* - https://swagger.io/specification/#schema-object
|
|
75
|
+
* - https://tools.ietf.org/html/draft-wright-json-schema-validation-00
|
|
76
|
+
*/
|
|
77
|
+
export interface SchemaObject3_0 extends CommonPropsSchemaObject<SchemaObject3_0> {
|
|
78
|
+
type?: string;
|
|
79
|
+
nullable?: boolean;
|
|
80
|
+
example?: unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface SchemaObject3_1 extends CommonPropsSchemaObject<SchemaObject3_1> {
|
|
83
|
+
type?: string | string[];
|
|
84
|
+
examples?: unknown[];
|
|
85
|
+
contentEncoding?: string;
|
|
86
|
+
contentMediaType?: string;
|
|
87
|
+
$schema?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface XMLObject {
|
|
90
|
+
name?: string;
|
|
91
|
+
namespace?: string;
|
|
92
|
+
prefix?: string;
|
|
93
|
+
attribute?: boolean;
|
|
94
|
+
wrapped?: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface DiscriminatorObject {
|
|
97
|
+
propertyName: string;
|
|
98
|
+
mapping?: Record<string, string>;
|
|
99
|
+
}
|
|
100
|
+
export interface ExternalDocObject {
|
|
101
|
+
description?: string;
|
|
102
|
+
url: string;
|
|
103
|
+
}
|
|
104
|
+
export interface TagObject {
|
|
105
|
+
name: string;
|
|
106
|
+
description?: string;
|
|
107
|
+
externalDocs?: ExternalDocObject;
|
|
108
|
+
}
|
|
109
|
+
export type TagObject3_2 = TagObject & {
|
|
110
|
+
/**
|
|
111
|
+
* @support OpenAPI 3.2
|
|
112
|
+
*/
|
|
113
|
+
summary?: string;
|
|
114
|
+
/**
|
|
115
|
+
* @support OpenAPI 3.2
|
|
116
|
+
*/
|
|
117
|
+
parent?: string;
|
|
118
|
+
/**
|
|
119
|
+
* @support OpenAPI 3.2
|
|
120
|
+
*/
|
|
121
|
+
kind?: 'nav' | 'badge';
|
|
122
|
+
};
|
|
123
|
+
export interface OAuthFlowObject {
|
|
124
|
+
authorizationUrl?: string;
|
|
125
|
+
tokenUrl?: string;
|
|
126
|
+
refreshUrl?: string;
|
|
127
|
+
scopes?: Record<string, string>;
|
|
128
|
+
}
|
|
129
|
+
export interface OAuthFlowsObject {
|
|
130
|
+
implicit?: OAuthFlowObject;
|
|
131
|
+
password?: OAuthFlowObject;
|
|
132
|
+
clientCredentials?: OAuthFlowObject;
|
|
133
|
+
authorizationCode?: OAuthFlowObject;
|
|
134
|
+
}
|
|
135
|
+
export interface SecuritySchemeObject {
|
|
136
|
+
type: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
name?: string;
|
|
139
|
+
in?: string;
|
|
140
|
+
scheme?: string;
|
|
141
|
+
bearerFormat?: string;
|
|
142
|
+
flows?: OAuthFlowsObject;
|
|
143
|
+
openIdConnectUrl?: string;
|
|
144
|
+
}
|
|
145
|
+
export interface ReferenceObject {
|
|
146
|
+
$ref: string;
|
|
147
|
+
}
|
|
148
|
+
export interface ServerVariableObject {
|
|
149
|
+
enum?: string[];
|
|
150
|
+
default: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
[x: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
export interface ServerObject {
|
|
155
|
+
url: string;
|
|
156
|
+
description?: string;
|
|
157
|
+
variables?: Record<string, ServerVariableObject>;
|
|
158
|
+
[x: string]: unknown;
|
|
159
|
+
}
|
|
160
|
+
export interface LinkObject {
|
|
161
|
+
operationRef?: string;
|
|
162
|
+
operationId?: string;
|
|
163
|
+
parameters?: Record<string, unknown>;
|
|
164
|
+
requestBody?: unknown;
|
|
165
|
+
description?: string;
|
|
166
|
+
server?: ServerObject;
|
|
167
|
+
[x: string]: unknown;
|
|
168
|
+
}
|
|
169
|
+
export interface ExampleObject {
|
|
170
|
+
summary?: string;
|
|
171
|
+
description?: string;
|
|
172
|
+
value?: unknown;
|
|
173
|
+
externalValue?: string;
|
|
174
|
+
}
|
|
175
|
+
export interface HeaderObject {
|
|
176
|
+
description?: string;
|
|
177
|
+
required?: boolean;
|
|
178
|
+
deprecated?: boolean;
|
|
179
|
+
style?: string;
|
|
180
|
+
explode?: boolean;
|
|
181
|
+
allowReserved?: boolean;
|
|
182
|
+
schema?: SchemaObject | ReferenceObject;
|
|
183
|
+
example?: unknown;
|
|
184
|
+
examples?: Record<string, ExampleObject | ReferenceObject>;
|
|
185
|
+
content?: Record<string, MediaTypeObject>;
|
|
186
|
+
}
|
|
187
|
+
export interface ParameterObject extends HeaderObject {
|
|
188
|
+
name: string;
|
|
189
|
+
in: string;
|
|
190
|
+
allowEmptyValue?: boolean;
|
|
191
|
+
}
|
|
192
|
+
export interface EncodingObject {
|
|
193
|
+
contentType?: string;
|
|
194
|
+
headers?: Record<string, HeaderObject | ReferenceObject>;
|
|
195
|
+
style?: string;
|
|
196
|
+
explode?: boolean;
|
|
197
|
+
allowReserved?: boolean;
|
|
198
|
+
}
|
|
199
|
+
export interface MediaTypeObject {
|
|
200
|
+
schema?: SchemaObject | ReferenceObject;
|
|
201
|
+
example?: unknown;
|
|
202
|
+
examples?: Record<string, ExampleObject | ReferenceObject>;
|
|
203
|
+
encoding?: Record<string, EncodingObject>;
|
|
204
|
+
}
|
|
205
|
+
export interface RequestBodyObject {
|
|
206
|
+
content?: Record<string, MediaTypeObject>;
|
|
207
|
+
[key: string]: unknown;
|
|
208
|
+
}
|
|
209
|
+
export interface ResponseObject {
|
|
210
|
+
description: string;
|
|
211
|
+
headers?: Record<string, HeaderObject | ReferenceObject>;
|
|
212
|
+
content?: Record<string, MediaTypeObject>;
|
|
213
|
+
links?: Record<string, LinkObject | ReferenceObject>;
|
|
214
|
+
[key: string]: unknown;
|
|
215
|
+
}
|
|
216
|
+
export interface ComponentsObject {
|
|
217
|
+
schemas?: Record<string, SchemaObject | ReferenceObject>;
|
|
218
|
+
requestBodies?: Record<string, RequestBodyObject | ReferenceObject>;
|
|
219
|
+
headers?: Record<string, HeaderObject | ReferenceObject>;
|
|
220
|
+
parameters?: Record<string, ParameterObject | ReferenceObject>;
|
|
221
|
+
responses?: Record<string, ResponseObject | ReferenceObject>;
|
|
222
|
+
examples?: Record<string, ExampleObject | ReferenceObject>;
|
|
223
|
+
securitySchemes?: Record<string, SecuritySchemeObject | ReferenceObject>;
|
|
224
|
+
links?: Record<string, LinkObject | ReferenceObject>;
|
|
225
|
+
callbacks?: Record<string, unknown>;
|
|
226
|
+
[key: string]: unknown;
|
|
227
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParameterLocation = void 0;
|
|
4
|
+
var ParameterLocation;
|
|
5
|
+
(function (ParameterLocation) {
|
|
6
|
+
ParameterLocation["cookie"] = "cookie";
|
|
7
|
+
ParameterLocation["header"] = "header";
|
|
8
|
+
ParameterLocation["path"] = "path";
|
|
9
|
+
ParameterLocation["query"] = "query";
|
|
10
|
+
})(ParameterLocation || (exports.ParameterLocation = ParameterLocation = {}));
|
|
11
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/generators/openapi/definitions.ts"],"names":[],"mappings":";;;AAIA,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,oCAAe,CAAA;AACjB,CAAC,EALW,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QAK5B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseHelperInterface } from '../../base-helper';
|
|
2
|
+
import type { AdditionalProperties, DiscriminatorObject, EncodingObject, ExampleObject, ReferenceObject, SchemaObject, XMLObject } from './definitions';
|
|
3
|
+
export interface OpenAPIHelperInterface extends BaseHelperInterface {
|
|
4
|
+
getFirstItem(): OpenAPIHelperInterface | undefined;
|
|
5
|
+
getChildren(): Record<string, OpenAPIHelperInterface>;
|
|
6
|
+
getAlternatives(): OpenAPIHelperInterface[];
|
|
7
|
+
hasStyle?(): boolean;
|
|
8
|
+
getStyle?(): string | undefined;
|
|
9
|
+
hasAdditionalProperties?(): boolean;
|
|
10
|
+
getAdditionalProperties?(): AdditionalProperties | undefined;
|
|
11
|
+
hasRef?(): boolean;
|
|
12
|
+
getRef?(): string | undefined;
|
|
13
|
+
hasDiscriminator?(): boolean;
|
|
14
|
+
getDiscriminator?(): DiscriminatorObject | undefined;
|
|
15
|
+
hasXml?(): boolean;
|
|
16
|
+
getXml?(): XMLObject | undefined;
|
|
17
|
+
hasExamples?(): boolean;
|
|
18
|
+
getExamples?(): Record<string, ExampleObject | ReferenceObject> | undefined;
|
|
19
|
+
hasEncoding?(): boolean;
|
|
20
|
+
getEncoding?(): Record<string, EncodingObject> | undefined;
|
|
21
|
+
hasAnyOf?(): boolean;
|
|
22
|
+
getAnyOf?(): SchemaObject[];
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/generators/openapi/helper.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
export type Description = string | DescriptionObject | null;
|
|
2
|
+
export type FormParameter = ValueFormParameter | SrcFormParameter;
|
|
3
|
+
export declare enum AuthType {
|
|
4
|
+
apikey = "apikey",
|
|
5
|
+
awsv4 = "awsv4",
|
|
6
|
+
basic = "basic",
|
|
7
|
+
bearer = "bearer",
|
|
8
|
+
digest = "digest",
|
|
9
|
+
edgegrid = "edgegrid",
|
|
10
|
+
hawk = "hawk",
|
|
11
|
+
noauth = "noauth",
|
|
12
|
+
oauth1 = "oauth1",
|
|
13
|
+
oauth2 = "oauth2",
|
|
14
|
+
ntlm = "ntlm"
|
|
15
|
+
}
|
|
16
|
+
export interface DescriptionObject {
|
|
17
|
+
content?: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
version?: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface CollectionVersion {
|
|
22
|
+
major: number;
|
|
23
|
+
minor: number;
|
|
24
|
+
patch: number;
|
|
25
|
+
identifier?: string;
|
|
26
|
+
meta?: unknown;
|
|
27
|
+
}
|
|
28
|
+
export interface InfoObject {
|
|
29
|
+
name: string;
|
|
30
|
+
schema: string;
|
|
31
|
+
_postman_id?: string;
|
|
32
|
+
description?: Description;
|
|
33
|
+
version?: string | CollectionVersion;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface QueryParam {
|
|
37
|
+
key?: string | null;
|
|
38
|
+
value?: string | null;
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
description?: Description;
|
|
41
|
+
}
|
|
42
|
+
export interface Variable {
|
|
43
|
+
id?: string;
|
|
44
|
+
key?: string;
|
|
45
|
+
value?: unknown;
|
|
46
|
+
type?: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
description?: Description;
|
|
49
|
+
system?: boolean;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface UrlObject {
|
|
53
|
+
raw?: string;
|
|
54
|
+
hash?: string;
|
|
55
|
+
host?: string | string[];
|
|
56
|
+
href?: string;
|
|
57
|
+
path?: string | string[];
|
|
58
|
+
protocol?: string;
|
|
59
|
+
variable?: Variable[];
|
|
60
|
+
port?: string;
|
|
61
|
+
query?: QueryParam[];
|
|
62
|
+
}
|
|
63
|
+
export interface ScriptObject {
|
|
64
|
+
id?: string;
|
|
65
|
+
type?: string;
|
|
66
|
+
exec?: string[] | string;
|
|
67
|
+
src?: UrlObject | string;
|
|
68
|
+
name?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface EventObject {
|
|
71
|
+
id?: string;
|
|
72
|
+
listen: string;
|
|
73
|
+
script?: ScriptObject;
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface AuthAttribute {
|
|
77
|
+
key: string;
|
|
78
|
+
value?: unknown;
|
|
79
|
+
type?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface Auth {
|
|
82
|
+
type: string;
|
|
83
|
+
noauth?: unknown;
|
|
84
|
+
apikey?: AuthAttribute[];
|
|
85
|
+
awsv4?: AuthAttribute[];
|
|
86
|
+
basic?: AuthAttribute[];
|
|
87
|
+
bearer?: AuthAttribute[];
|
|
88
|
+
digest?: AuthAttribute[];
|
|
89
|
+
edgegrid?: AuthAttribute[];
|
|
90
|
+
hawk?: AuthAttribute[];
|
|
91
|
+
ntlm?: AuthAttribute[];
|
|
92
|
+
oauth1?: AuthAttribute[];
|
|
93
|
+
oauth2?: AuthAttribute[];
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}
|
|
96
|
+
export interface ProxyConfig {
|
|
97
|
+
match?: string;
|
|
98
|
+
host?: string;
|
|
99
|
+
port?: number;
|
|
100
|
+
tunnel?: boolean;
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface CertificateObject {
|
|
104
|
+
name?: string;
|
|
105
|
+
matches?: string[];
|
|
106
|
+
key?: {
|
|
107
|
+
src?: string;
|
|
108
|
+
};
|
|
109
|
+
cert?: {
|
|
110
|
+
src?: string;
|
|
111
|
+
};
|
|
112
|
+
passphrase?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface HeaderObject {
|
|
115
|
+
key: string;
|
|
116
|
+
value: string;
|
|
117
|
+
disabled?: boolean;
|
|
118
|
+
description?: Description;
|
|
119
|
+
}
|
|
120
|
+
export interface UrlEncodedParameter {
|
|
121
|
+
key: string;
|
|
122
|
+
value?: string;
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
description?: Description;
|
|
125
|
+
}
|
|
126
|
+
export interface ValueFormParameter {
|
|
127
|
+
key: string;
|
|
128
|
+
value?: string;
|
|
129
|
+
disabled?: boolean;
|
|
130
|
+
type?: string;
|
|
131
|
+
contentType?: string;
|
|
132
|
+
description?: Description;
|
|
133
|
+
}
|
|
134
|
+
export interface SrcFormParameter {
|
|
135
|
+
key: string;
|
|
136
|
+
src?: string[] | string | null;
|
|
137
|
+
disabled?: boolean;
|
|
138
|
+
type?: string;
|
|
139
|
+
contentType?: string;
|
|
140
|
+
description?: Description;
|
|
141
|
+
}
|
|
142
|
+
export interface RequestBodyObject {
|
|
143
|
+
mode?: string;
|
|
144
|
+
raw?: string;
|
|
145
|
+
graphql?: Record<string, unknown>;
|
|
146
|
+
urlencoded?: UrlEncodedParameter[];
|
|
147
|
+
formdata?: FormParameter[];
|
|
148
|
+
file?: {
|
|
149
|
+
src?: string | null;
|
|
150
|
+
content?: string;
|
|
151
|
+
};
|
|
152
|
+
options?: Record<string, unknown>;
|
|
153
|
+
disabled?: boolean;
|
|
154
|
+
[x: string]: unknown;
|
|
155
|
+
}
|
|
156
|
+
export interface RequestObject {
|
|
157
|
+
url?: UrlObject;
|
|
158
|
+
auth?: Auth | null;
|
|
159
|
+
proxy?: ProxyConfig;
|
|
160
|
+
certificate?: CertificateObject;
|
|
161
|
+
method?: string;
|
|
162
|
+
description?: Description;
|
|
163
|
+
header?: string | HeaderObject[];
|
|
164
|
+
body?: null | RequestBodyObject;
|
|
165
|
+
[x: string]: unknown;
|
|
166
|
+
}
|
|
167
|
+
export interface CookieObject {
|
|
168
|
+
domain: string;
|
|
169
|
+
expires?: null | string;
|
|
170
|
+
maxAge?: string;
|
|
171
|
+
hostOnly?: boolean;
|
|
172
|
+
httpOnly?: boolean;
|
|
173
|
+
name?: string;
|
|
174
|
+
path: string;
|
|
175
|
+
secure?: boolean;
|
|
176
|
+
session?: boolean;
|
|
177
|
+
value?: string;
|
|
178
|
+
extensions?: unknown[];
|
|
179
|
+
[x: string]: unknown;
|
|
180
|
+
}
|
|
181
|
+
export interface ResponseObject {
|
|
182
|
+
id?: string;
|
|
183
|
+
name?: string;
|
|
184
|
+
originalRequest?: RequestObject;
|
|
185
|
+
responseTime?: null | string | number;
|
|
186
|
+
timings?: Record<string, unknown> | null;
|
|
187
|
+
header?: string[] | null;
|
|
188
|
+
cookie?: CookieObject[];
|
|
189
|
+
body?: null | string;
|
|
190
|
+
status?: string;
|
|
191
|
+
code?: number;
|
|
192
|
+
[x: string]: unknown;
|
|
193
|
+
}
|
|
194
|
+
export interface Item {
|
|
195
|
+
id?: string;
|
|
196
|
+
name?: string;
|
|
197
|
+
description?: Description;
|
|
198
|
+
variable?: Variable[];
|
|
199
|
+
event?: EventObject[];
|
|
200
|
+
request: RequestObject;
|
|
201
|
+
response?: ResponseObject[];
|
|
202
|
+
protocolProfileBehavior?: unknown;
|
|
203
|
+
}
|
|
204
|
+
export interface Folder {
|
|
205
|
+
item: (Item | Folder)[];
|
|
206
|
+
name?: string;
|
|
207
|
+
description?: Description;
|
|
208
|
+
variable?: Variable[];
|
|
209
|
+
event?: EventObject[];
|
|
210
|
+
auth?: Auth | null;
|
|
211
|
+
protocolProfileBehavior?: unknown;
|
|
212
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthType = void 0;
|
|
4
|
+
var AuthType;
|
|
5
|
+
(function (AuthType) {
|
|
6
|
+
AuthType["apikey"] = "apikey";
|
|
7
|
+
AuthType["awsv4"] = "awsv4";
|
|
8
|
+
AuthType["basic"] = "basic";
|
|
9
|
+
AuthType["bearer"] = "bearer";
|
|
10
|
+
AuthType["digest"] = "digest";
|
|
11
|
+
AuthType["edgegrid"] = "edgegrid";
|
|
12
|
+
AuthType["hawk"] = "hawk";
|
|
13
|
+
AuthType["noauth"] = "noauth";
|
|
14
|
+
AuthType["oauth1"] = "oauth1";
|
|
15
|
+
AuthType["oauth2"] = "oauth2";
|
|
16
|
+
AuthType["ntlm"] = "ntlm";
|
|
17
|
+
})(AuthType || (exports.AuthType = AuthType = {}));
|
|
18
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/generators/postman/definitions.ts"],"names":[],"mappings":";;;AAIA,IAAY,QAYX;AAZD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,yBAAa,CAAA;AACf,CAAC,EAZW,QAAQ,aAAR,QAAQ,GAAR,QAAQ,QAYnB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BaseHelperInterface } from '../../base-helper';
|
|
2
|
+
import type { XMLObject } from '../openapi/definitions';
|
|
3
|
+
export interface PostmanHelperInterface extends BaseHelperInterface {
|
|
4
|
+
getFirstItem(): PostmanHelperInterface | undefined;
|
|
5
|
+
getChildren(): Record<string, PostmanHelperInterface>;
|
|
6
|
+
getAlternatives(): PostmanHelperInterface[];
|
|
7
|
+
hasContentType?(): boolean;
|
|
8
|
+
getContentType?(): string | undefined;
|
|
9
|
+
hasDescriptionType?(): boolean;
|
|
10
|
+
getDescriptionType?(): string | undefined;
|
|
11
|
+
hasXml?(): boolean;
|
|
12
|
+
getXml?(): XMLObject | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/generators/postman/helper.ts"],"names":[],"mappings":""}
|
package/lib/helpers.d.ts
ADDED
package/lib/helpers.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":""}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { DocGenerator, RouteMeta, ProcessedRoute } from './commons';
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/lib/values.d.ts
ADDED
package/lib/values.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VALID_TYPES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* List of valid types for API documentation.
|
|
6
|
+
* It includes basic types like 'string' and 'number', date types, and other specialized types.
|
|
7
|
+
*/
|
|
8
|
+
exports.VALID_TYPES = [
|
|
9
|
+
// https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2
|
|
10
|
+
'boolean',
|
|
11
|
+
'object',
|
|
12
|
+
'array',
|
|
13
|
+
'number',
|
|
14
|
+
'string',
|
|
15
|
+
// date types
|
|
16
|
+
'date',
|
|
17
|
+
'date-time',
|
|
18
|
+
'datetime',
|
|
19
|
+
// other number types
|
|
20
|
+
'float',
|
|
21
|
+
'double',
|
|
22
|
+
'integer',
|
|
23
|
+
'int32',
|
|
24
|
+
'int64',
|
|
25
|
+
// other string types
|
|
26
|
+
'byte',
|
|
27
|
+
'binary',
|
|
28
|
+
'password',
|
|
29
|
+
'email',
|
|
30
|
+
'guid',
|
|
31
|
+
'uuid',
|
|
32
|
+
'uri',
|
|
33
|
+
'dataUri',
|
|
34
|
+
];
|
|
35
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../src/values.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,WAAW,GAAa;IACnC,sEAAsE;IACtE,SAAS;IACT,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IAER,aAAa;IACb,MAAM;IACN,WAAW;IACX,UAAU;IAEV,qBAAqB;IACrB,OAAO;IACP,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IAEP,qBAAqB;IACrB,MAAM;IACN,QAAQ;IACR,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;IACL,SAAS;CACV,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novice1/api-doc-definitions",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./lib/index.d.ts",
|
|
10
|
+
"default": "./lib/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./helpers": {
|
|
13
|
+
"types": "./lib/helpers.d.ts",
|
|
14
|
+
"default": "./lib/helpers.js"
|
|
15
|
+
},
|
|
16
|
+
"./openapi": {
|
|
17
|
+
"types": "./lib/generators/openapi/definitions.d.ts",
|
|
18
|
+
"default": "./lib/generators/openapi/definitions.js"
|
|
19
|
+
},
|
|
20
|
+
"./postman": {
|
|
21
|
+
"types": "./lib/generators/postman/definitions.d.ts",
|
|
22
|
+
"default": "./lib/generators/postman/definitions.js"
|
|
23
|
+
},
|
|
24
|
+
"./values": {
|
|
25
|
+
"types": "./lib/values.d.ts",
|
|
26
|
+
"default": "./lib/values.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://kisiwu.github.io/novice-api-doc-generator/latest/",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/kisiwu/novice-api-doc-generator.git"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"openapi",
|
|
36
|
+
"postman",
|
|
37
|
+
"swagger",
|
|
38
|
+
"api-doc-generator",
|
|
39
|
+
"novice1"
|
|
40
|
+
],
|
|
41
|
+
"author": "demingongo",
|
|
42
|
+
"contributors": [
|
|
43
|
+
"sbolingo"
|
|
44
|
+
],
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "pnpm exec tsc",
|
|
48
|
+
"doc": "typedoc",
|
|
49
|
+
"format": "cross-env NODE_OPTIONS=--experimental-strip-types prettier --write ./src",
|
|
50
|
+
"format:check": "cross-env NODE_OPTIONS=--experimental-strip-types prettier --check ./src",
|
|
51
|
+
"lint": "eslint . && pnpm exec tsc --noEmit"
|
|
52
|
+
}
|
|
6
53
|
}
|