Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #849 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 335 335
Lines 13281 13309 +28
Branches 414 416 +2
=========================================
+ Hits 13281 13309 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sobolevn
reviewed
Apr 8, 2026
| if isinstance( | ||
| method, | ||
| types.FunctionType, | ||
| ) and inspect.isasyncgenfunction(method): |
Member
There was a problem hiding this comment.
While we are at it: let's all check for sync generators. Because they also won't work.
| class _NoOpOptimizer(PydanticEndpointOptimizer): | ||
| @override | ||
| @classmethod | ||
| def optimize_endpoint(cls, metadata: Any) -> None: # noqa: WPS324 |
Member
There was a problem hiding this comment.
Sorry, why do you need this type?
Collaborator
Author
There was a problem hiding this comment.
If i use controller like this
with pytest.raises(
EndpointMetadataError,
match='is an async generator',
):
class _BadController(Controller[PydanticSerializer]):
async def get(self) -> AsyncIterator[int]:
yield 1 # pragma: no coverI have pydantic error =(
.venv/lib/python3.13/site-packages/pydantic/_internal/_generate_schema.py:659: in _unknown_type_schema
raise PydanticSchemaGenerationError(
E pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for collections.abc.AsyncIterator[int]. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.
E
E If you got this error by calling handler(<some type>) within `__get_pydantic_core_schema__` then you likely need to call `handler.generate_schema(<some type>)` since we do not call `__get_pydantic_core_schema__` on `<some type>` otherwise to avoid infinite recursion.
E
E For further information visit https://errors.pydantic.dev/2.12/u/schema-for-unknown-type
Member
There was a problem hiding this comment.
Got it!
Please, then also test that SSEController an JsonLinesController do not need this.
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.
I have made things!
AI Policy
Checklist
Related issues
Closes #843