Skip to content

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-workers-and-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
@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

3 participants