UNPKG

8.7 kBTypeScriptView Raw
1declare type DataType =
2/** This includes dates and files */
3"string" | "number" | "integer" | "boolean" | "array" | "object";
4export interface Schema {
5 title?: string;
6 nullable?: boolean;
7 ["x-nullable"]?: boolean;
8 maxLength?: number;
9 max?: number;
10 min?: number;
11 pattern?: string;
12 type?: DataType;
13 /**
14 * An array of arbitrary types can be defined as:
15 *
16 * Type: array;
17 * items: {
18 * }
19 */
20 items?: Schema | {};
21 /**
22 * Files are defined as strings: "binary" | "byte"
23 *
24 * - integer int32 signed 32 bits
25 * - integer int64 signed 64 bits (a.k.a long)
26 * - number float
27 * - number double
28 * - string
29 * - string byte base64 encoded characters
30 * - string binary any sequence of octets
31 * - boolean
32 * - string date As defined by full-date - RFC3339
33 * - string date-time As defined by date-time - RFC3339
34 * - string password A hint to UIs to obscure input.
35 */
36 format?: "int32" | "int64" | "float" | "double" | "byte" | "binary" | "date" | "date-time" | "date" | "password" | "guid" | "uuid";
37 /**
38 * A free-form object (arbitrary property/value pairs) is defined as:
39 *
40 * Type: object
41 * additionalProperties: {}
42 * Or additionalProperties: true
43 */
44 additionalProperties?: Schema | true | {};
45 properties?: {
46 [name: string]: Schema;
47 };
48 /**
49 * By default, all object properties are optional. You can specify the
50 * required properties in the required list:
51 */
52 required?: string[];
53 description?: string;
54 example?: string;
55 deprecated?: boolean;
56 "x-deprecatedMessage"?: string;
57 "x-enumNames"?: string[];
58 enum?: string[];
59 $ref?: string;
60 allOf?: Schema[];
61 oneOf?: Schema[];
62 /** Is something link oneOf */
63 anyOf?: Schema[];
64 /**
65 * Use the minimum and maximum keywords to specify the range of possible values:
66 *
67 * Type: integer;
68 * minimum: 1;
69 * maximum: 20;
70 *
71 * By default, the minimum and maximum values are included in the range, that is:
72 *
73 * Minimum ≤ value ≤ maximum
74 *
75 * To exclude the boundary values, specify exclusiveMinimum: true and
76 * exclusiveMaximum: true. For example, you can define a floating-point number
77 * range as 0–50 and exclude the 0 value:
78 */
79 minimum?: number;
80 exclusiveMinimum?: boolean;
81 exclusiveMaximum?: boolean;
82 maximum?: number;
83 /**
84 * A schema without a type matches any data type – numbers, strings, objects,
85 * and so on. {} is shorthand syntax for an arbitrary-type schema:
86 *
87 * @example
88 * components: {
89 * schemas: {
90 * AnyValue: {
91 * }
92 * }
93 * }
94 */
95 AnyValue?: {
96 nullable?: boolean;
97 description?: string;
98 };
99 discriminator?: {
100 propertyName: string;
101 mapping?: {
102 [key: string]: string;
103 };
104 };
105 readOnly?: boolean;
106 writeOnly?: boolean;
107 xml?: {
108 name?: string;
109 namespace?: string;
110 prefix?: string;
111 attribute?: boolean;
112 wrapped?: boolean;
113 };
114 externalDocs?: {
115 description?: string;
116 url: string;
117 };
118 examples?: {
119 [x: string]: string;
120 };
121 not?: Schema;
122 default?: any;
123 multipleOf?: number;
124 minLength?: number;
125 maxItems?: number;
126 minItems?: number;
127 uniqueItems?: boolean;
128 maxProperties?: number;
129 minProperties?: number;
130}
131export declare type Parameter = {
132 /**
133 * The name of the parameter. Parameter names are case sensitive. If in is
134 * "path", the name field MUST correspond to a template expression occurring
135 * within the path field in the Paths Object. See Path Templating for further
136 * information. If in is "header" and the name field is "Accept",
137 * "Content-Type" or "Authorization", the parameter definition SHALL be
138 * ignored. For all other cases, the name corresponds to the parameter name
139 * used by the in property.
140 */
141 name: string;
142 /** The location of the parameter. */
143 in: "query" | "header" | "cookie" | "path";
144 /**
145 * Determines whether this parameter is mandatory. If the parameter location
146 * is "path", this property is REQUIRED and its value MUST be true. Otherwise,
147 * the property MAY be included and its default value is false.
148 */
149 required?: boolean;
150 /** The schema defining the type used for the parameter. */
151 schema?: Schema;
152 $ref?: string;
153 /**
154 * A brief description of the parameter. This could contain examples of use.
155 * CommonMark syntax MAY be used for rich text representation.
156 */
157 description?: string;
158 /**
159 * Specifies that a parameter is deprecated and SHOULD be transitioned out of
160 * usage. Default value is false.
161 */
162 deprecated?: boolean;
163};
164export interface SwaggerResponse {
165 $ref?: string;
166 description?: string;
167 content?: Partial<Record<ApiAST["contentType"], Pick<Schema, "example" | "examples"> & {
168 schema: Schema;
169 }>>;
170}
171export interface SwaggerRequest {
172 tags?: string[];
173 summary?: string;
174 operationId?: string;
175 parameters?: Parameter[];
176 requestBody?: SwaggerResponse;
177 responses: {
178 [x: string]: SwaggerResponse;
179 };
180 deprecated?: boolean;
181 security?: any[];
182 description?: string;
183 externalDocs?: any;
184 callbacks?: any;
185 servers?: any[];
186}
187export interface Components {
188 schemas?: Record<string, Schema>;
189 parameters?: Record<string, Parameter>;
190 requestBodies?: Record<string, SwaggerResponse>;
191}
192export interface SwaggerJson {
193 openapi?: string;
194 swagger?: string;
195 paths: {
196 [url: string]: PathItem;
197 };
198 components?: Components;
199 info: InfoObject;
200 servers?: any[];
201 security?: any[];
202 tags?: any[];
203 externalDocs?: any;
204}
205export interface PathItem {
206 $ref?: string;
207 summary?: string;
208 description?: string;
209 get?: SwaggerRequest;
210 put?: SwaggerRequest;
211 post?: SwaggerRequest;
212 delete?: SwaggerRequest;
213 options?: SwaggerRequest;
214 head?: SwaggerRequest;
215 patch?: SwaggerRequest;
216 trace?: SwaggerRequest;
217 servers?: any[];
218 parameters?: any[];
219}
220export interface InfoObject {
221 title: string;
222 version: string;
223 description?: string;
224 termsOfService?: string;
225 contact?: any;
226 license?: any;
227}
228export interface Config {
229 url?: string | {
230 branch: string;
231 url: string;
232 }[];
233 dir: string;
234 /**
235 * SignalR json url generated by https://github.com/majidbigdeli/SigSpec
236 *
237 * @todo Repo need help
238 */
239 hub?: string;
240 /** Default is false */
241 keepJson?: boolean;
242 reactHooks?: boolean;
243 useQuery?: string[];
244 useInfiniteQuery?: string[];
245 tag?: string[];
246 mock?: string;
247 prettierPath?: string;
248 language?: "javascript" | "typescript";
249 methodName?: string;
250 prefix?: string;
251 ignore?: {
252 headerParams?: string[];
253 };
254 /** Generate with local swagger.json */
255 local?: boolean;
256 /** Generate specific branch swagger */
257 branch?: string;
258 generateEnumAsType?: boolean;
259 _isSwagger2?: boolean;
260}
261export declare type SwaggerConfig = Config | Config[];
262export declare type Method = "get" | "put" | "post" | "delete" | "options" | "head" | "patch" | "trace";
263export declare type ApiAST = {
264 contentType: "*/*" | "text/json" | "application/json" | "application/octet-stream" | "application/json-patch+json" | "application/*+json" | "multipart/form-data" | "application/x-www-form-urlencoded";
265 summary: string | undefined;
266 deprecated: boolean | undefined;
267 serviceName: string;
268 pathParams: Parameter[];
269 requestBody: Schema | undefined;
270 queryParamsTypeName: string | false;
271 headerParams: string;
272 isQueryParamsNullable: boolean;
273 isHeaderParamsNullable: boolean;
274 responses: Schema | undefined;
275 pathParamsRefString: string | undefined;
276 endPoint: string;
277 method: Method;
278 security: string;
279 additionalAxiosConfig: string;
280 queryParameters: Parameter[];
281};
282export declare type TypeAST = {
283 name: string;
284 schema?: Schema;
285 description?: string;
286};
287export declare type JsdocAST = Pick<Schema, "min" | "max" | "title" | "description" | "format" | "minimum" | "maximum" | "pattern" | "maxLength" | "minLength" | "example"> & {
288 deprecated?: string;
289};
290export declare type ConstantsAST = {
291 value: string;
292 name: string;
293};
294export {};
295//# sourceMappingURL=types.d.ts.map
\No newline at end of file