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

Kebab-case $id fields break Python jschon parser #81

Open
gmlewis opened this issue Jun 28, 2023 · 2 comments · May be fixed by #82
Open

Kebab-case $id fields break Python jschon parser #81

gmlewis opened this issue Jun 28, 2023 · 2 comments · May be fixed by #82
Labels
question Further information is requested

Comments

@gmlewis
Copy link
Contributor

gmlewis commented Jun 28, 2023

Structs are currently rendered as kebab-case in the "$id" field.
For example, TestUser becomes:

"$id": "https://github.com/invopop/jsonschema/test-user"

When another field attempts to reference this struct, the Python3.10 "jschon" package resports this error:

jschon.exc.CatalogError: A source is not available for "https://github.com/invopop/jsonschema/TestUser"

but if the "$id" line is changed from test-user to TestUser, then the "jschon" package parses the file successfully.

I will work on a PR for this issue.

@gmlewis gmlewis linked a pull request Jun 28, 2023 that will close this issue
@samlown
Copy link
Contributor

samlown commented Sep 6, 2023

Hi @gmlewis, surely this is an issue with the Python "jschon" package making assumptions about definition names? Generally speaking, snake-case is the preferred option for URLs as they avoid potential issues with file system case sensitivity and maintain coherence with the domain name. I'd be reluctant to make such a massive change without a rock-solid reason!

I would however be in favour of flexibility. If someone would like to override the default snake-case in the reflector configuration, then it makes sense to allow that. This may be a better approach for your PR.

@samlown samlown added the question Further information is requested label Sep 6, 2023
@gmlewis
Copy link
Contributor Author

gmlewis commented Sep 6, 2023

I would however be in favour of flexibility. If someone would like to override the default snake-case in the reflector configuration, then it makes sense to allow that. This may be a better approach for your PR.

Thank you for the feedback, @samlown !
I've attempted to do this. PTAL.

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

Successfully merging a pull request may close this issue.

2 participants