-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
SeaORM CLI not adding serde derives to Enums #461
Comments
Just by looking at the source code, seems like enums are not treating imports the same way as entities. Enums (https://github.com/SeaQL/sea-orm/blob/master/sea-orm-codegen/src/entity/writer.rs#L156) don't seem to care about serde whereas entities are using this function for generating imports (https://github.com/SeaQL/sea-orm/blob/master/sea-orm-codegen/src/entity/writer.rs#L231). And as for the derives, entities take care of this here https://github.com/SeaQL/sea-orm/blob/master/sea-orm-codegen/src/entity/writer.rs#L509, whereas enums are not https://github.com/SeaQL/sea-orm/blob/master/sea-orm-codegen/src/entity/active_enum.rs#L21. Seems like it has been forgotten unless it was intentional? I can look into creating a PR adding serde derives to enums if it is wanted in this crate. |
I forgot to do so :(
Definitely wanted |
I'm currently playing with
sea-orm
coming fromdiesel-rs
and I love it! But I ran into this error while using enums and serde, the enums do not contain any serde derives.Reproduction
With a simple PostgreSQL schema
Running the following command (same behaviour with either
serialize
,deserialize
,both
):Creates the following file with Enums that does not contain the serde derives, where the errors propagates to the users model's
kind
column.Expected Result
I would expect enums, just like models, to contain the derive.
The text was updated successfully, but these errors were encountered: