Closed kvnxiao closed 1 year ago
Hi @dvdsgl !
May I kindly also request for this to be reviewed and for a new build to be released so that we may use these fixes in production without having to run our local fork?
Thank you!
It should have been released immediately.
Thanks! Let me know if there's any changes needed for this PR to be merged.
Hi @dvdsgl , apologies for the ping again but would you have some time to review this PR for this to get merged?
Thank you!
Thank you!
Dart language enhancements:
@JsonKey()
for--use-freezed
option https://github.com/quicktype/quicktype/issues/2162 https://github.com/quicktype/quicktype/issues/2339--use-json-annotation
or--use-freezed
will respect therequired
keyword even if the type is considered nullable (we forgot to check if the prop was not optional!).!prop.isOptional
checks if the var has been explicitly defined as non-nullable--use-freezed
option always assuming everything is nullable and appending?
to the end of the type -- this should now be covered by therequired
check, plus the?
was already factored in by the Dart prop type to begin with.--coders-in-class
is being used, since these top-level functions do not apply anymorejson_annotation
import if--use-freezed
is being used, since the freeze annotations import already provides json_annotation annotations.Excerpts:
./script/quicktype --src-lang schema generated_freezed.json -l dart --use-json-annotation --use-freezed --coders-in-class
generated_freezed.json
Notice that
time_created
is nullable, but also specified as required in the JSON Schema, and this is properly reflected in the generated code.