[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