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

Improper parsing of uint enums #2961

Open
pgtherrien opened this issue Aug 15, 2023 · 0 comments
Open

Improper parsing of uint enums #2961

pgtherrien opened this issue Aug 15, 2023 · 0 comments
Labels
generate spec Related to spec generation from code scanner

Comments

@pgtherrien
Copy link

pgtherrien commented Aug 15, 2023

Problem statement

When generating spec from source code, enum fields with a value type of uint are incorrectly parsed and have their resulting spec values defined as strings.
This is due to any uint type (uint, uint8 , uint16 , uint32 , uint64) not being handled within parseValueFromSchema.

Steps to reproduce

Define a struct field as an enum with a value type of uint:

// enum:1,2,3
Example uint

Generate spec from the source code and look for the enum field and verify that it has its values defined like so:

"enum": [
  "1",
  "2",
  "3"
]

Environment

go-swagger version: latest
go version: 1.20.4

@fredbi fredbi added scanner generate spec Related to spec generation from code labels Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generate spec Related to spec generation from code scanner
Projects
None yet
Development

No branches or pull requests

2 participants