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

Merged
merged 1 commit into from
Oct 10, 2024

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 2 times, most recently 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
@0x009922 0x009922 self-assigned this Oct 9, 2024
@mversic mversic self-assigned this Oct 10, 2024
@mversic mversic force-pushed the iroha-schema-derive-smart-bounds branch from 6d5caad to 5b3a941 Compare October 10, 2024 07:28
…rait bounds

Signed-off-by: ⭐️NINIKA⭐️ <dcnick3@users.noreply.github.com>
@mversic mversic force-pushed the iroha-schema-derive-smart-bounds branch from 5b3a941 to 3fe70b2 Compare October 10, 2024 07:55
@mversic mversic merged commit a5794ef into hyperledger:main Oct 10, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Testing & Verification
Development

Successfully merging this pull request may close these issues.

3 participants