diff --git a/src/common/requests.ts b/src/common/requests.ts index b9e906f..ba5153c 100644 --- a/src/common/requests.ts +++ b/src/common/requests.ts @@ -133,14 +133,8 @@ function makeRequestsDeclaration( ); } -type HttpMethods = - | "get" - | "delete" - | "post" - | "put" - | "patch" - | "head" - | "options"; +const methods = ['get', 'delete', 'post', 'put', 'patch', 'head', 'options'] as const; +type HttpMethods = typeof methods[number]; function makeRequestsPropertyAssignment( $refs: SwaggerParser.$Refs, @@ -150,15 +144,6 @@ function makeRequestsPropertyAssignment( ) { const requests: ts.PropertyAssignment[] = []; const params = item.parameters; - const methods: HttpMethods[] = [ - "get", - "delete", - "post", - "put", - "patch", - "head", - "options", - ]; methods.forEach((method) => { const operation: OpenAPIV3.OperationObject | undefined = item[method]; @@ -172,6 +157,7 @@ function makeRequestsPropertyAssignment( return requests; } + function isRequestBodyObject( obj: OpenAPIV3.ReferenceObject | OpenAPIV3.RequestBodyObject ): obj is OpenAPIV3.RequestBodyObject {