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

Generated schemas are not valid when using rust style names in ref #799

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

waltronix
Copy link
Contributor

@waltronix waltronix force-pushed the create_valid_schemas branch 2 times, most recently from 0258443 to ec2a485 Compare November 4, 2024 11:45
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.54%. Comparing base (2d70b70) to head (98bcdb7).
Report is 19 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #799      +/-   ##
==========================================
+ Coverage   67.34%   67.54%   +0.20%     
==========================================
  Files          40       40              
  Lines        2468     2499      +31     
==========================================
+ Hits         1662     1688      +26     
- Misses        806      811       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@waltronix waltronix marked this pull request as ready for review November 4, 2024 11:52
@swlynch99
Copy link
Contributor

I'm not a maintainer of serde-with, just the person who originally wrote the schemars integration. So feel free to ignore this if you want.

With that said, it would be really helpful to document this on the schema_id and schema_name methods of the JsonSchemaAs trait. That the characters need to be valid as a URI path segment for refs to work is very much not apparent unless you are familiar with the json schema spec.

@jonasbb
Copy link
Owner

jonasbb commented Nov 4, 2024

Hi, thanks for the PR. The change looks fine overall. Adding the extra validation check to the test makes sense.
Do you have a reference which names are allowed? In #798 you listed the three characters <, >, and ,. The , is still used here and seems to pass the tests.

If the names are invalid anyway, then backwards compatability is not a problem.

@swlynch99
Copy link
Contributor

I think it needs to be a URI path segment, so it would be defined in RFC 3986 section 3.3. That refers back to section 2 and section 2.2 seems to indicate that all 3 of (, ,, and ) are valid.

@waltronix waltronix force-pushed the create_valid_schemas branch from 1956ef6 to 98bcdb7 Compare November 6, 2024 16:11
@waltronix
Copy link
Contributor Author

Thanks for your fast response!

I had a mistake in my bug report. There is no problem with the , itself, the problem arises from the space after it.

I also extended the doc comment for schema_name(). As schema_id() is not part of the generated schema according to current documentation I don't think have to require it to be a URI path segment.

@jonasbb jonasbb merged commit 2e2d4f0 into jonasbb:master Nov 6, 2024
23 checks passed
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 this pull request may close these issues.

3 participants