Add features missing from #24286
Merged
NO
4mo ago+5+5+0123456789-4-4-0123456789
Add a couple of missing features that weren't merged in #24286:
- When class properties aren't required, the
finalkeyword wasn't added properly. - Addressed this comment to allow nullifying certain class properties when using
copyWith().
The Petstore samples didn't change at all, so this is a 1-file PR :)
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
Commit all changed files.
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*.
IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed. - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
@jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) @ahmednfwela (2021/08)
Summary by cubic
Fixes Dart model generation to mark non-required properties as final when useFinalProperties is enabled. In copyWith(), adds a fieldNameSetToNull flag for nullable fields (default false) that, when true, sets the field to null.