Skip to content
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 sea-orm-cli flag to skip deserialization of primary keys for entities #841

Closed
Witcher01 opened this issue Jul 6, 2022 · 1 comment · Fixed by #1186 or #1318
Closed

Add sea-orm-cli flag to skip deserialization of primary keys for entities #841

Witcher01 opened this issue Jul 6, 2022 · 1 comment · Fixed by #1186 or #1318
Assignees
Milestone

Comments

@Witcher01
Copy link
Contributor

Motivation

Expecting a JSON value with a web framework usually makes it return the correct status codes etc. if an entity cannot be deserialized from the request, but currently this is hard to do as the entities by default required the primary key to be present in the JSON, which is not what a POST request tends to accept.

Proposed Solutions

Add a flag to sea-orm-cli that enables #[serde(skip_deserializing)] for primary keys of entities.

@Witcher01
Copy link
Contributor Author

I'd love to work on this, but I'm not sure when that will be. If someone else wants to implement this, feel free to do so.

Since I'm a first time contributor to sea-orm I'd love some hints where this would roughly be implemented and what to look out for, if anything.

Witcher01 added a commit to Witcher01/sea-orm that referenced this issue Jul 6, 2022
@billy1624 billy1624 moved this to Triage in SeaQL Dev Tracker Jul 12, 2022
@billy1624 billy1624 moved this from Triage to Next Up in SeaQL Dev Tracker Aug 3, 2022
@billy1624 billy1624 moved this from Next Up to Changes / Comments Requested in SeaQL Dev Tracker Aug 10, 2022
@billy1624 billy1624 linked a pull request Dec 19, 2022 that will close this issue
2 tasks
billy1624 pushed a commit that referenced this issue Dec 19, 2022
* Add CLI option to skip primary keys with serde

Implements: #841

* Codegen: fix tests

* complete skip_deserialize cli feature

* run fmt

* fix tests

Co-authored-by: witcher <[email protected]>
billy1624 added a commit that referenced this issue Dec 19, 2022
* Cli serde skip deserialize for primary key option (#1186)

* Add CLI option to skip primary keys with serde

Implements: #841

* Codegen: fix tests

* complete skip_deserialize cli feature

* run fmt

* fix tests

Co-authored-by: witcher <[email protected]>

* [cli] should be `#[serde(skip_deserializing)]`

* [CLI] code refactor

* [cli] rename

Co-authored-by: Isaiah Gamble <[email protected]>
Co-authored-by: witcher <[email protected]>
@billy1624 billy1624 moved this from Changes / Comments Requested to Done in SeaQL Dev Tracker Jan 13, 2023
@billy1624 billy1624 added this to the 0.11.x milestone Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment