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

refactor(schema_derive): use a smarter algorithm for auto-generated trait bounds #5132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DCNick3
Copy link
Contributor

@DCNick3 DCNick3 commented Oct 7, 2024

Context

Part of the solution for #5130.

Solution

This PR changes the way iroha_schema_derive generates trait bounds to the same algorithm that is used by parity-scale-codec.

In general, it adds a bound on IntoSchema for types of all the fields that use the generic parameters, with some special handling for #[codec(skip)], #[codec(compact)] and recursive types.

See docs for trait_bounds::add for more details.

All of the #[schema(bounds = ...)] attributes are removed now, as there's no need for them anymore.


Review notes

Checklist

  • I've read CONTRIBUTING.md.
  • (optional) I've written unit tests for the code changes.
  • All review comments have been resolved.
  • All CI checks pass.

@DCNick3 DCNick3 self-assigned this Oct 7, 2024
@DCNick3 DCNick3 changed the title Iroha schema derive smart bounds refactor(schema_derive): use a smarter algorithm for auto-generated trait bounds Oct 7, 2024
@DCNick3 DCNick3 force-pushed the iroha-schema-derive-smart-bounds branch from 7a1af34 to 931e4c1 Compare October 8, 2024 07:30
…rait bounds

Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
@DCNick3 DCNick3 force-pushed the iroha-schema-derive-smart-bounds branch from 931e4c1 to 6d5caad Compare October 8, 2024 07:34
@DCNick3 DCNick3 marked this pull request as ready for review October 8, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

1 participant