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

Allow transform function to access the SchemaGenerator #369

Open
DavidBM opened this issue Jan 29, 2025 · 1 comment · May be fixed by #370
Open

Allow transform function to access the SchemaGenerator #369

DavidBM opened this issue Jan 29, 2025 · 1 comment · May be fixed by #370

Comments

@DavidBM
Copy link

DavidBM commented Jan 29, 2025

I want to add a very long list of conditionals (if/then/else) that I'm inserting in a #[schemars(transform = "...")].

I would like to add that as a $def in the schema, as they will repeat for several structs and I don't want to duplicate them.

Could the transform function, rather than raking the &mut Schema only, takes the schema and the &mut SchemaGenerator? In that way I can add schemas to the defs, and then inject the reference into the final schema

@DavidBM DavidBM linked a pull request Jan 30, 2025 that will close this issue
@DavidBM
Copy link
Author

DavidBM commented Jan 30, 2025

Added PR in #370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant