1 |
|
2 |
|
3 |
|
4 | import { Oas2 } from './types/oas2';
|
5 | import { Operation } from './types/operation';
|
6 | import { Oas3, ServerObject, ParameterObject, SchemaObject, OperationObject, ResponseObject, PathItemObject, RequestBodyObject, ReferenceObject, LinkObject, SecuritySchemeObject } from './types/oas3';
|
7 | import { PreprocessingData, ProcessedSecurityScheme } from './types/preprocessing_data';
|
8 | import { InternalOptions } from './types/options';
|
9 | export declare type SchemaNames = {
|
10 | fromRef?: string;
|
11 | fromSchema?: string;
|
12 | fromPath?: string;
|
13 | |
14 |
|
15 |
|
16 |
|
17 | preferred?: string;
|
18 | };
|
19 | export declare type RequestSchemaAndNames = {
|
20 | payloadContentType?: string;
|
21 | payloadSchema?: SchemaObject | ReferenceObject;
|
22 | payloadSchemaNames?: SchemaNames;
|
23 | payloadRequired: boolean;
|
24 | };
|
25 | export declare type ResponseSchemaAndNames = {
|
26 | responseContentType?: string;
|
27 | responseSchema?: SchemaObject | ReferenceObject;
|
28 | responseSchemaNames?: SchemaNames;
|
29 | statusCode?: string;
|
30 | };
|
31 | export declare enum HTTP_METHODS {
|
32 | 'get' = "get",
|
33 | 'put' = "put",
|
34 | 'post' = "post",
|
35 | 'patch' = "patch",
|
36 | 'delete' = "delete",
|
37 | 'options' = "options",
|
38 | 'head' = "head"
|
39 | }
|
40 | export declare const SUCCESS_STATUS_RX: RegExp;
|
41 |
|
42 |
|
43 |
|
44 | export declare function methodToHttpMethod(method: string): HTTP_METHODS;
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export declare function getValidOAS3(spec: Oas2 | Oas3): Promise<Oas3>;
|
50 |
|
51 |
|
52 |
|
53 | export declare function countOperations(oas: Oas3): number;
|
54 |
|
55 |
|
56 |
|
57 | export declare function countOperationsQuery(oas: Oas3): number;
|
58 |
|
59 |
|
60 |
|
61 | export declare function countOperationsMutation(oas: Oas3): number;
|
62 |
|
63 |
|
64 |
|
65 | export declare function countOperationsSubscription(oas: Oas3): number;
|
66 |
|
67 |
|
68 |
|
69 | export declare function countOperationsWithPayload(oas: Oas3): number;
|
70 |
|
71 |
|
72 |
|
73 | export declare function resolveRef(ref: string, oas: Oas3): any;
|
74 |
|
75 |
|
76 |
|
77 | export declare function getBaseUrl(operation: Operation): string;
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | export declare function sanitizeObjectKeys(obj: any,
|
83 | caseStyle?: CaseStyle): any;
|
84 |
|
85 |
|
86 |
|
87 |
|
88 | export declare function desanitizeObjectKeys(obj: object | Array<any>, mapping?: object): object | Array<any>;
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | export declare function getSchemaTargetGraphQLType<TSource, TContext, TArgs>(schema: SchemaObject, data: PreprocessingData<TSource, TContext, TArgs>): string | null;
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | export declare function inferResourceNameFromPath(path: string): string;
|
101 |
|
102 |
|
103 |
|
104 | export declare function getRequestBodyObject(operation: OperationObject, oas: Oas3): {
|
105 | payloadContentType: string;
|
106 | requestBodyObject: RequestBodyObject;
|
107 | } | null;
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | export declare function getRequestSchemaAndNames(path: string, operation: OperationObject, oas: Oas3): RequestSchemaAndNames;
|
114 |
|
115 |
|
116 |
|
117 | export declare function getResponseObject(operation: OperationObject, statusCode: string, oas: Oas3): {
|
118 | responseContentType: string;
|
119 | responseObject: ResponseObject;
|
120 | } | null;
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | export declare function getResponseSchemaAndNames<TSource, TContext, TArgs>(path: string, method: HTTP_METHODS, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>, options: InternalOptions<TSource, TContext, TArgs>): ResponseSchemaAndNames;
|
127 |
|
128 |
|
129 |
|
130 | export declare function getResponseStatusCode<TSource, TContext, TArgs>(path: string, method: string, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>): string | void;
|
131 |
|
132 |
|
133 |
|
134 | export declare function getLinks<TSource, TContext, TArgs>(path: string, method: HTTP_METHODS, operation: OperationObject, oas: Oas3, data: PreprocessingData<TSource, TContext, TArgs>): {
|
135 | [key: string]: LinkObject;
|
136 | };
|
137 |
|
138 |
|
139 |
|
140 | export declare function getParameters(path: string, method: HTTP_METHODS, operation: OperationObject, pathItem: PathItemObject, oas: Oas3): ParameterObject[];
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 | export declare function getServers(operation: OperationObject, pathItem: PathItemObject, oas: Oas3): ServerObject[];
|
148 |
|
149 |
|
150 |
|
151 |
|
152 | export declare function getSecuritySchemes(oas: Oas3): {
|
153 | [key: string]: SecuritySchemeObject;
|
154 | };
|
155 |
|
156 |
|
157 |
|
158 |
|
159 | export declare function getSecurityRequirements(operation: OperationObject, securitySchemes: {
|
160 | [key: string]: ProcessedSecurityScheme;
|
161 | }, oas: Oas3): string[];
|
162 | export declare enum CaseStyle {
|
163 | simple = 0,
|
164 | PascalCase = 1,
|
165 | camelCase = 2,
|
166 | ALL_CAPS = 3
|
167 | }
|
168 |
|
169 |
|
170 |
|
171 | export declare function sanitize(str: string, caseStyle: CaseStyle): string;
|
172 |
|
173 |
|
174 |
|
175 |
|
176 | export declare function storeSaneName(saneStr: string, str: string, mapping: {
|
177 | [key: string]: string;
|
178 | }): string;
|
179 |
|
180 |
|
181 |
|
182 | export declare function trim(str: string, length: number): string;
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | export declare function isHttpMethod(method: string): boolean;
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 | export declare function formatOperationString(method: string, path: string, title?: string): string;
|
195 |
|
196 |
|
197 |
|
198 | export declare function capitalize(str: string): string;
|
199 |
|
200 |
|
201 |
|
202 | export declare function uncapitalize(str: string): string;
|
203 |
|
204 |
|
205 |
|
206 | export declare function generateOperationId(method: HTTP_METHODS, path: string): string;
|