Skip to content

Fix generation enum numbers as strings one #534

Description

@sanyaches

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,
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions