You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am using an OpenAPI declaration to generate Dart-code with Dio as the client. The API allows some text to be translated, so it uses a string dictionary for those. As fixed keys, it declares "de-DE", "en-US" and "default" (since those are the ones usually used), but since more languages should be supported when needed there is also "additionalProperties" set. This is described here:
(In the documentation the fixed keys are used to declare them as required, the API I'm using does not. But even if it did set these keys as required, the behaviour below would not change.)
When I generate my client, the generated model class only contains three fields (the fixed keys), but no way to set/get more languages. If the fixed keys were to be removed from the declaration, a string-map would be used, that way allowing all languages to be set/get.
Bug Report Checklist
Description
I am using an OpenAPI declaration to generate Dart-code with Dio as the client. The API allows some text to be translated, so it uses a string dictionary for those. As fixed keys, it declares "de-DE", "en-US" and "default" (since those are the ones usually used), but since more languages should be supported when needed there is also "additionalProperties" set. This is described here:
https://swagger.io/docs/specification/data-models/dictionaries/#fixed-keys
(In the documentation the fixed keys are used to declare them as required, the API I'm using does not. But even if it did set these keys as required, the behaviour below would not change.)
When I generate my client, the generated model class only contains three fields (the fixed keys), but no way to set/get more languages. If the fixed keys were to be removed from the declaration, a string-map would be used, that way allowing all languages to be set/get.
openapi-generator version
docker latest: openapi-generator-cli 7.1.0-SNAPSHOT commit : 7087b33
and docker latest-release: openapi-generator-cli 7.0.1 commit : 6745998
OpenAPI declaration file content or url
This is the condensed version containing the relevant part of a larger declaration: https://gist.github.com/czaefferer/a215fd8472cfaf14aa7a0416c30060f9
Generation Details / Steps to reproduce
I am using the docker based generator to generate a Dart client for the declaration above:
Ignoring all annotations and boilerplate code, this is the resulting class for the dictionary:
-> I cannot retrieve or set more languages than those a fixed key exists for.
I would expect to have an additional Map<String, String> containing all or all additional strings.
The text was updated successfully, but these errors were encountered: