Closed infomofo closed 4 years ago
I have an openapi json file with responses for operations defined like this:
"responses": { "404": { "description": "Not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } ...
When I run typegen on this client it seems to generate an invalid file.
typegen
It exports the resources fine with a dollar sign preceding the numbers
namespace Responses { export type $200 = Components.Schemas.HospitalUtilization; export type $422 = Components.Schemas.HTTPValidationError; }
But then the generated response does not have the preceding dollarsign, which is invalid typescript and doesn't reference the generated code properly
get( parameters?: Parameters<Paths.<MY_PATH>.PathParameters>, data?: any, config?: AxiosRequestConfig ): OperationResponse<Paths.<MY_PATH>.Responses.200 | Paths.<MY_PATH>.Responses.422> }
Does anyone else run into this issue? If I find and replace all of these with the preceding dollar sign it seems to work fine.
The other method of generating a client- directly from my openapi.json works as well but I was hoping to switch to the typegen method.
Seems like this bug was introduced from updating dtsgenerator to the latest version.
This is fixed in openapi-client-axios-typegen@1.1.1
openapi-client-axios-typegen@1.1.1
I have an openapi json file with responses for operations defined like this:
When I run file.
typegen
on this client it seems to generate an invalidIt exports the resources fine with a dollar sign preceding the numbers
But then the generated response does not have the preceding dollarsign, which is invalid typescript and doesn't reference the generated code properly
Does anyone else run into this issue? If I find and replace all of these with the preceding dollar sign it seems to work fine.
The other method of generating a client- directly from my openapi.json works as well but I was hoping to switch to the
typegen
method.