Skip to content

Fix generation enum numbers as strings one #534

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

Closed
sanyaches opened this issue May 24, 2023 · 1 comment
Closed

Fix generation enum numbers as strings one #534

sanyaches opened this issue May 24, 2023 · 1 comment

Comments

@sanyaches
Copy link

sanyaches commented May 24, 2023

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;

Actual behavior: 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
@sanyaches
Copy link
Author

sanyaches commented Jul 16, 2024

Just checked this, doesn't reproduce anymore

"swagger-typescript-api": "^13.0.13",

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