@@ -28,8 +28,20 @@ export declare type ResponseSchemaAndNames = {
28
28
responseSchemaNames ?: SchemaNames ;
29
29
statusCode ?: string ;
30
30
} ;
31
- export declare const OAS_OPERATIONS : string [ ] ;
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
+ }
32
40
export declare const SUCCESS_STATUS_RX : RegExp ;
41
+ /**
42
+ * Given an HTTP method, convert it to the HTTP_METHODS enum
43
+ */
44
+ export declare function methodToHttpMethod ( method : string ) : HTTP_METHODS ;
33
45
/**
34
46
* Resolves on a validated OAS 3 for the given spec (OAS 2 or OAS 3), or rejects
35
47
* if errors occur.
@@ -98,7 +110,7 @@ export declare function getRequestBodyObject(operation: OperationObject, oas: Oa
98
110
* a dictionary of names from different sources (if available), and whether the
99
111
* request schema is required for the operation.
100
112
*/
101
- export declare function getRequestSchemaAndNames ( path : string , method : string , operation : OperationObject , oas : Oas3 ) : RequestSchemaAndNames ;
113
+ export declare function getRequestSchemaAndNames ( path : string , method : HTTP_METHODS , operation : OperationObject , oas : Oas3 ) : RequestSchemaAndNames ;
102
114
/**
103
115
* Returns JSON-compatible schema produced by the given operation
104
116
*/
@@ -111,21 +123,21 @@ export declare function getResponseObject(operation: OperationObject, statusCode
111
123
* a successful status code, and a dictionary of names from different sources
112
124
* (if available).
113
125
*/
114
- export declare function getResponseSchemaAndNames < TSource , TContext , TArgs > ( path : string , method : string , operation : OperationObject , oas : Oas3 , data : PreprocessingData < TSource , TContext , TArgs > , options : InternalOptions < TSource , TContext , TArgs > ) : ResponseSchemaAndNames ;
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 ;
115
127
/**
116
128
* Returns a success status code for the given operation
117
129
*/
118
130
export declare function getResponseStatusCode < TSource , TContext , TArgs > ( path : string , method : string , operation : OperationObject , oas : Oas3 , data : PreprocessingData < TSource , TContext , TArgs > ) : string | void ;
119
131
/**
120
132
* Returns a hash containing the links in the given operation.
121
133
*/
122
- export declare function getLinks < TSource , TContext , TArgs > ( path : string , method : string , operation : OperationObject , oas : Oas3 , data : PreprocessingData < TSource , TContext , TArgs > ) : {
134
+ export declare function getLinks < TSource , TContext , TArgs > ( path : string , method : HTTP_METHODS , operation : OperationObject , oas : Oas3 , data : PreprocessingData < TSource , TContext , TArgs > ) : {
123
135
[ key : string ] : LinkObject ;
124
136
} ;
125
137
/**
126
138
* Returns the list of parameters in the given operation.
127
139
*/
128
- export declare function getParameters ( path : string , method : string , operation : OperationObject , pathItem : PathItemObject , oas : Oas3 ) : ParameterObject [ ] ;
140
+ export declare function getParameters ( path : string , method : HTTP_METHODS , operation : OperationObject , pathItem : PathItemObject , oas : Oas3 ) : ParameterObject [ ] ;
129
141
/**
130
142
* Returns an array of server objects for the operation at the given path and
131
143
* method. Considers in the following order: global server definitions,
@@ -172,7 +184,7 @@ export declare function trim(str: string, length: number): string;
172
184
* Determines if the given "method" is indeed an operation. Alternatively, the
173
185
* method could point to other types of information (e.g., parameters, servers).
174
186
*/
175
- export declare function isOperation ( method : string ) : boolean ;
187
+ export declare function isHttpMethod ( method : string ) : boolean ;
176
188
/**
177
189
* Formats a string that describes an operation in the form:
178
190
* {name of OAS} {HTTP method in ALL_CAPS} {operation path}
@@ -191,4 +203,4 @@ export declare function uncapitalize(str: string): string;
191
203
/**
192
204
* For operations that do not have an operationId, generate one
193
205
*/
194
- export declare function generateOperationId ( method : string , path : string ) : string ;
206
+ export declare function generateOperationId ( method : HTTP_METHODS , path : string ) : string ;
0 commit comments