fix: import breaks types (?) #2076#2201
Closed
Prthmsh7 wants to merge 2 commits intoasyncapi:masterfrom
Closed
Conversation
[BUG] from . import AnonymousSchemaX breaks types (?)
Contributor
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
✅ Deploy Preview for modelina canceled.
|
|
jonaslagoni
requested changes
Mar 6, 2025
Member
jonaslagoni
left a comment
There was a problem hiding this comment.
Please revert your package changes as this fix should not require it 🙂
Pull Request Test Coverage Report for Build 13701869542Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
I tried fixing this issue #2076 by correcting how nested anonymous schemas are imported when using the --pyDantic flag. Previously, the generator produced code like:
which led to runtime type errors. With this fix, the import is now explicit:
This change ensures that Pydantic can properly evaluate the type hints.
Related Issue
(ref. asyncapi/cli#1485)
Checklist
npm run lint).npm run test).Additional Notes
This is my first time working with the tests and on such a large scale, so please review the changes thoroughly