Redocly/redocly-cli

Redocly removing string for enums if there's non-numbers mixed in

sthilaire1 opened this issue · 3 comments

Describe the bug
In my yaml file I have a list of enums of type string. When I bundle my common file using redocly-cli, which outputs the enums onto my common file, it is removing the string if there's non-numbers like "B" mixed in.

Example of my yaml file: type string
Example from my common file: type string

To Reproduce

Create a yaml file of mixed integers, like shown in the picture. For instance, "01", "6B".
redocly bundle -o common-api.yaml api-spec.yaml
git add common-api.yaml

Expected behavior
I expect my enum to still be of type string. It should not be turning into an enum or integer?

Logs

OpenAPI description

Redocly Version(s)

1.12.2

Node.js Version(s)

v20.9.0

Additional context

Hi @sthilaire1, your enum is still of type string as 6B is not an integer 🙂. In fact, it's a valid string representation in yaml format (you can omit quotes if a scalar is not a number, boolean, null &c.).
I'm closing this, but feel free to ping me if you think I'm missing something here.

will it still be of string type?

@sthilaire1 yes it will. You can try converting that yaml into json in any converter to verify the type.