Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generation enum numbers as strings one #534

Open
sanyaches opened this issue May 24, 2023 · 0 comments
Open

Fix generation enum numbers as strings one #534

sanyaches opened this issue May 24, 2023 · 0 comments

Comments

@sanyaches
Copy link

Hi there! I face the problem that enum of numbers generates well in request params with extractRequestParams: true option, but for usual schemas library generates the same enum like enum of strings.

Library version: 12.0.4

Spec file example:
in requestBody - "someTypeId":{"type":"integer","enum":[1,2]} => export type SomeTypeId = "1" | "2"
in parameters -> query "someTypeId":{"type":"integer","enum":[1,2]} (1:1 as above) => export type SomeTypeId = 1 | 2;

script

generateApi({
    output: path.resolve(
        process.cwd(),
        myCustomOutputPath,
    ),
    url: myCustomOpenapiYamlUrl,
    generateClient: false,
    extractRequestParams: true,
    extractRequestBody: true,
    extractResponseBody: true,
    extractResponseError: true,
    extractEnums: true,
    disableStrictSSL: true,
    modular: true,
    cleanOutput: true,
    patch: true,
    typePrefix: myCustomPrefix,
    generateUnionEnums: true,
});
@js2me js2me mentioned this issue Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant