@@ -28,8 +28,20 @@ export declare type ResponseSchemaAndNames = {
2828 responseSchemaNames ?: SchemaNames ;
2929 statusCode ?: string ;
3030} ;
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+ }
3240export 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 ;
3345/**
3446 * Resolves on a validated OAS 3 for the given spec (OAS 2 or OAS 3), or rejects
3547 * if errors occur.
@@ -98,7 +110,7 @@ export declare function getRequestBodyObject(operation: OperationObject, oas: Oa
98110 * a dictionary of names from different sources (if available), and whether the
99111 * request schema is required for the operation.
100112 */
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 ;
102114/**
103115 * Returns JSON-compatible schema produced by the given operation
104116 */
@@ -111,21 +123,21 @@ export declare function getResponseObject(operation: OperationObject, statusCode
111123 * a successful status code, and a dictionary of names from different sources
112124 * (if available).
113125 */
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 ;
115127/**
116128 * Returns a success status code for the given operation
117129 */
118130export declare function getResponseStatusCode < TSource , TContext , TArgs > ( path : string , method : string , operation : OperationObject , oas : Oas3 , data : PreprocessingData < TSource , TContext , TArgs > ) : string | void ;
119131/**
120132 * Returns a hash containing the links in the given operation.
121133 */
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 > ) : {
123135 [ key : string ] : LinkObject ;
124136} ;
125137/**
126138 * Returns the list of parameters in the given operation.
127139 */
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 [ ] ;
129141/**
130142 * Returns an array of server objects for the operation at the given path and
131143 * method. Considers in the following order: global server definitions,
@@ -172,7 +184,7 @@ export declare function trim(str: string, length: number): string;
172184 * Determines if the given "method" is indeed an operation. Alternatively, the
173185 * method could point to other types of information (e.g., parameters, servers).
174186 */
175- export declare function isOperation ( method : string ) : boolean ;
187+ export declare function isHttpMethod ( method : string ) : boolean ;
176188/**
177189 * Formats a string that describes an operation in the form:
178190 * {name of OAS} {HTTP method in ALL_CAPS} {operation path}
@@ -191,4 +203,4 @@ export declare function uncapitalize(str: string): string;
191203/**
192204 * For operations that do not have an operationId, generate one
193205 */
194- export declare function generateOperationId ( method : string , path : string ) : string ;
206+ export declare function generateOperationId ( method : HTTP_METHODS , path : string ) : string ;
0 commit comments