Json-to-Dart-Model
Json-to-Dart-Model copied to clipboard
enum support
would be nice to have enums support
@Miamoto-Musashi I thought about it a long time ago to implement it. String list convert to enum. Example:
{
"e@user_status": ["online", "offline" ]
}
rather than
{
"e@user_status": ["online", "offline" ]
}
I think is more consistent with rest of notation
{
"user_status.enum": ["online", "offline" ]
}
Would this be a simple task, I dont use typescript, but I would like to help add this.
@Prn-Ice It may be a little tricky, but anything is possible. This source code should be good rewrite to make it easy to implement :)
I'll play around with it, I'll let you know if I give up.
I'll play around with it, I'll let you know if I give up.
Then your tour will be begin in the constructor.ts
file, class TypeDefinition
;)
I think it will be enough to include the enum checker annotation and the generator do the rest. Then just add syntax.
I will join to when I will finish one project.
@Prn-Ice
Any Update on this one?
Sadly I haven't gotten up to this till now. And after finding this package, I'm not sure I'll need to.
Sadly I haven't gotten up to this till now. And after finding this package, I'm not sure I'll need to.
If you want to generate enum
only with any generator it easy implement. Just need generate a type and generator do the rest. I will look at that. For now I working on another extension as Data Class Generator. It will generate data equal to Freezed
by one click, and even regenerate by one click or update automatically on save. Also will be possible make functionality enums. Will be more fun 😁
@Prn-Ice