-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[dart][dart-dio] More enum fixes for inner types #8174
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
Conversation
* correctly generate enums from `mostInnerItems` * use `datatypeWithEnum` which should always be he correct type * dart generators prefix inner enums with the classname of the containing class, ensure datatypeWithEnum always matches
|
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
| const EnumArraysArrayEnumEnum._(this.value); | ||
|
|
||
| /// The underlying value of this enum member. | ||
| final List<String> value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agilob This commit also fixes the wrong value type that was appearrent in the other PR.
| {{/allowableValues}} | ||
| {{/isContainer}} | ||
| {{/isEnum}} | ||
| {{{datatypeWithEnum}}} {{{name}}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about all of this change, especially the enum default value. Currently all default values are set in the constructor. As far as I can tell in that case a wrong constructor default value would be generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default value should stay as null, unless field is marked as non-nullable, required or has default value provided, this looks good to me. Dart generator doesn't support non-nullable so it's fine. It will get more complex.
|
Took me long time to understand from class name whether this is correct or not... Do we need dart.dev doesn't recommend it https://dart.dev/guides/language/language-tour#enumerated-types No other generator does it. It was even difficult to reverse engineer to find original spec from the names. |
|
The This is already this way in the dart generator and has always been. (hence no changes to dart output, only dart-dio) I am not particularly fond of the naming, I was actually thinking about removing it. Removing it will be a breaking change in the dart generator instead of dart-dio. Would be good to get some some more opinions on this. |
PR checklist
./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.masterCC @swipesight (2018/09) @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12)