Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9905
Closed
Open
Issue created Jul 06, 2021 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][dart-dio] wrong value sent for integer enums in query parameters

Created by: bmxbandita

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue? https://gist.github.com/bmxbandita/5c162d525a82c769e3329d09d23d40ff
  • Have you validated the input using an OpenAPI validator (example)? valid
  • Have you tested with the latest master to confirm the issue still exists? yes, and still exists
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

My spec has an integer type enum schema, and the generator generates an enumClass, with the following: @BuiltValueEnumConst(wireName: r'36') static const Country n36 = _$n36;

If there is an endpoint with this integer enum model as query parameter, it will send 'n36', not '36' what the server would accept. It seems that the serialization is completely ignored for Enum query parameters, and the literal field name is sent.

openapi-generator version

5.1.1 and latest master branch

OpenAPI declaration file content or url

https://gist.github.com/bmxbandita/5c162d525a82c769e3329d09d23d40ff

Generation Details

java -jar openapi-generator-cli.jar generate -i spec_sample.yml --additional-properties generateAliasAsModel=true,nullableFields=true -g dart-dio-next

I tried with dart-dio and dart dio-next generators as well, all the same results.

Steps to reproduce

Generate a dart-dio or dart-dio-next client with the provided spec. Call the '/user/invoice_address' endpoint that has an integer type enum as query parameter like so: getUserAccountApi().invoiceAddressUserInvoiceAddressPut(country: Country.n36, currency: Currency.HUF); The 'currency' param has the correct value 'HUF', but the 'country' param has the wrong 'n36' value, instead of the correct '36'.

Suggest a fix

Serialize EnumClasses for query parameters as well.

cc: @kuhnroyal

Assignee
Assign to
Time tracking