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

fix(python): handle non union self referencing schemas #4602

Merged

Conversation

dsinghvi
Copy link
Member

@dsinghvi dsinghvi commented Sep 10, 2024

This PR updates forward refs for non union self referencing schemas so that the Python SDK can appropriately build.

AI generated Summary

This pull request introduces a new method, get_non_union_circular_references, to the PydanticGeneratorContext and FernAwarePydanticModel classes. This method is used to identify non-union circular references within the context of type generation.

Changes

  • The get_non_union_circular_references method is added to the PydanticGeneratorContext class, which returns a set of type IDs that are non-union circular references.
  • The get_non_union_circular_references method is also added to the FernAwarePydanticModel class, which returns a set of type IDs that are non-union circular references.
  • The _must_import_after_current_declaration method in the FernAwarePydanticModel class is updated to check for non-union circular references using the new get_non_union_circular_references method.

@dsinghvi dsinghvi enabled auto-merge (squash) September 10, 2024 17:24
@dsinghvi dsinghvi force-pushed the dsinghvi/handle-non-union-references-from-pydantic-models branch from ffbf284 to b31473e Compare September 10, 2024 17:26
@dsinghvi dsinghvi disabled auto-merge September 10, 2024 17:29
@dsinghvi dsinghvi merged commit 4bbaadb into main Sep 10, 2024
42 checks passed
@dsinghvi dsinghvi deleted the dsinghvi/handle-non-union-references-from-pydantic-models branch September 10, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants