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

Make it work to use $ref as an alias #6568

Merged
merged 2 commits into from Jul 12, 2023
Merged

Make it work to use $ref as an alias #6568

merged 2 commits into from Jul 12, 2023

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jul 10, 2023

Closes #6534

Note that while there are many references to the '$ref' key in the codebase that might otherwise appear to be subject to this issue, in most cases, there are not free-form user-specified keys in the values being handled. The exception to this are functions that are called recursively on dicts that happen to be JSON schemas. In these cases, I believe that is safe to assume that if the key is '$ref' and the value has type str (as opposed to dict etc.) then that should be a real JSON schema ref, as opposed to an incidental occurrence of the key '$ref'. This PR just starts checking the type of the value for the key '$ref' in those recursive functions.

skip change file check

Selected Reviewer: @lig

@cloudflare-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: d05aba4
Status: ✅  Deploy successful!
Preview URL: https://dbdb6016.pydantic-docs2.pages.dev
Branch Preview URL: https://allow-dollar-ref-alias.pydantic-docs2.pages.dev

View logs

@dmontagu
Copy link
Contributor Author

please review

@dmontagu dmontagu merged commit ed0171c into main Jul 12, 2023
48 checks passed
@dmontagu dmontagu deleted the allow-dollar-ref-alias branch July 12, 2023 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot get schema from model using string $ref as a field alias
2 participants