openapi-react-query-codegen
openapi-react-query-codegen copied to clipboard
Create a test and example using enums.
Is your feature request related to a problem? Please describe. There are consumers of this library that use enums, we have no tests or examples showing their generation/usage.
Describe the solution you'd like A unit test or snapshot showing their creation.
Describe alternatives you've considered None,
I also struggle to get back the behavior from version 0.5.3 which e.g. generated
export namespace CreateRepository {
export enum type {
GIT = 'GIT',
GIT_REPO = 'GIT_REPO',
MERCURIAL = 'MERCURIAL',
SUBVERSION = 'SUBVERSION',
CVS = 'CVS',
}
}
instead of version 1.3.0 now generating
export type CreateRepository = {
type: 'GIT' | 'GIT_REPO' | 'MERCURIAL' | 'SUBVERSION' | 'CVS';
url: string;
};
Using --enums typescript does not seems to have any effect.
Edit: Here's an excerpt from the used API spec:
"CreateRepository" : {
"required" : [ "type", "url" ],
"type" : "object",
"properties" : {
"type" : {
"type" : "string",
"enum" : [ "GIT", "GIT_REPO", "MERCURIAL", "SUBVERSION", "CVS" ]
},
"url" : {
"type" : "string"
}
}
},
Using
--enums typescriptdoes not seems to have any effect.
Maybe this could be related to https://github.com/hey-api/openapi-ts/issues/547?
Using
--enums typescriptdoes not seems to have any effect.Maybe this could be related to hey-api/openapi-ts#547?
That does seem related. When they patch @hey-api/openapi-ts, we will need to write some tests to determine whether it is safe to update in the future.
There are lots of moving parts. We would appreciate the help if you have time to write tests that satisfy your use case.
Maybe fallback to an old version of this library until the new release of @hey-api/openapi-ts
The new version 0.44.0 of openapi-ts fixes this problem and generates enums again.