Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this change, const generic parameters were ignored when generating a title for a type's schema.
I propose we treat const generic parameters similar to generic type parameters. Since const generics are simple expressions that fit into the format macro arguments, we can use the literal value in the name of the type. This parameterizes the unique permutations of a type and it's const generics as separate definitions, in case those const generics are used as properties of the schema.
Tests were added to ensure naming works, including templating the overwritten with the
rename
attribute.Note: Since the MSRV is 1.45, I added a check around the test cases involving const generics. Since this change doesn't actually use const generics (landed in 1.51), we can still support if the user's rust version supports the feature. I was looking to use const generics for the JsonSchema array impls ([T; SIZE]), but we cannot do that with the current MSRV :)