modelina
modelina copied to clipboard
[DART] We need a flag to generate models with json annotation
Reason/Context
Why we need this improvement?
A very common use-case when generating model is the serialization/deserialization to/from json. Currently this is not covered by the cli even tough modelina supports it.
How will this change help?
With this change we save time on several points:
- Right now we have to edit model by hand to add json annotations
- Code written by hand is lost on subsequent model generation
Description
What changes have to be introduced?
From a quick look at src/commands/generate/models.ts
:
- we would need a new flag to indicate if we want to generate the model with the serialization annotations ex: --dart-json-annotations
- the case handling the dart generation would need to handle the new flag. This example seems to show how to apply the right configuration when instantiating the model generator
Will this be a breaking change?
No, this would add an optional flag. Old script would still work.
How could it be implemented/designed?
See example mentioned previously