OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.76k stars 6.32k forks source link

[BUG][RUST] json parser expects quotes with integer enum #18840

Open ErikDaVinci opened 1 month ago

ErikDaVinci commented 1 month ago

Hello,

my swagger.yaml contains following lines:

TypesResponse:
type: object
properties:
Types:
format: int32
enum:
- 0
- 1
- 2
- 3
type: integer

I used the generator v7.6.0 to generate a rust client. The client throws an error when parsing the response. The response is like

{"Types":2}

. It seems serde_json throws - it expects a response like

{"Types":"2"}

. So the client expects the 2 be in quotes. But the yaml states "type:integer".

For me it seems like a bug in the generator - or do I misuse the generator? Thank you.

bertkdowns commented 4 days ago

Looks like there is an open pull request for this: https://github.com/OpenAPITools/openapi-generator/pull/9967