-
-
Notifications
You must be signed in to change notification settings - Fork 521
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
Add CLI option to sea-orm-cli
to skip primary keys with serde on generation of entities
#846
Conversation
sea-orm-cli
to skip primary keys with serde on generation of entities
Right, I didn't look at the tests. This might take a bit of time |
if skip_pk_deserialization { | ||
quote! { | ||
#[sea_orm(#ts)] | ||
#[serde(skip_deserialization)] | ||
} | ||
} else { | ||
quote! { | ||
#[sea_orm(#ts)] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Witcher01, sorry for the delay! Thanks for the great contributions!! Looks good overall :)
I have a minor nitpick. Please check if the refactoring make any sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries! I'm not sure what you mean, my commit looks good to me, tests run, and running it gives me the right results, too.
Could you elaborate? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to keep a mutable skip_pk_deserialization
and that's why refactored the code :P
I just noticed that skipping the primary key deserialization isn't added in the expanded formats. I'll fix that and push a new commit when I'm done. ETA this evening, hopefully. |
Thanks! @Witcher01 |
I'm not finding any time to implement this. If anyone else wants to have a go at this with my changes already there, feel free to keep working on this. |
PR Info
Adds
--skip-primary-key-deserialization
tosea-orm-cli
for the option to skip deserialization of primary keys with serde by adding#[serde(skip_deserialization)]
to the primary keyAs the comment says, this adds the option to skip serializing primary keys with serde in entities generated by
sea-orm-cli
.The command line flag name is a bit long, so feel free to suggest a different name for it.
The implementation could use some work to feel better, so I'll take suggestions for this as well.
As of now
clap
doesn't treat the new argument as only being allowed to be set when--with-serde
with a value other thannone
is used.