Tuukka Mustonen
Tuukka Mustonen
The code seems to work so that defaults from a configuration file are loaded before initializing the argument parser, and then using the loaded values as defaults. However, `exclude` variable...
I started up a test project, created one single app there with a testcase extending from UnitTestCase. I can successfully run tests through nosetests. However, picking specific testcase type's usting...
There are two ways to define middleware: 1. [Decorator-based](https://fastapi.tiangolo.com/tutorial/middleware/) via `@app.middleware()` 2. [Starlette's class-based]() via constructor or `app.add_middleware()` While decorator-based middleware get FastAPI's `Request` object: ```python @app.middleware("http") async def my_middleware(request:...
- [x] I am on the [latest](https://github.com/sdispater/pendulum/releases/latest) Pendulum version. - [x] I have searched the [issues](https://github.com/sdispater/pendulum/issues) of this repo and believe that this is not a duplicate. - **OS version...
### Bug description Following: ```py import psycopg with psycopg.connect('...') as conn: pass ``` ...raises E1129 (not-context-manager) violation. But the code works fine and sources look ok as [psycopg.connect()](https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L522-L556) returns [Connection](https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L502)...
### Summary Update: Turned out the seed is already static, but that elements might be generated in random order. Let's fix that. --- The `generate_examples` is nice but the examples...
### Summary ```py @get(raises=[NotFoundException]) def endpoint(): ... ``` ...seems to inject each declared `raises` entry as duplication into the generated OpenAPI spec: ```json "404": { "description": "Nothing matches the given...
### Summary How `HTTPException`s get into OpenAPI spec is done is in https://github.com/litestar-org/litestar/blob/14759558cf231c61049fdd5b65a39eccb8841616/litestar/_openapi/responses.py#L280-L285 The fields written (`status_code`, `detail`, `extra`) is hard-coded there. Allow generating the schema from a callable, that...
### Summary Pydantic provides `Field(json_schema_extra=...)` which allows to do something like: ```py def forbid_internal_labels(value): if re.match(r"^reserved-for-internal-use:.*$", value): raise ValueError(...) class Foo(BaseModel): label: Annotated[str, AfterValidator(forbid_internal_labels), Field(json_schema_extra={ "not": { { "type": "string",...
### Description Explained below. ### MCVE ```python import json from litestar import Litestar, post from litestar.openapi.spec import Example from litestar.params import Parameter @post("/{path_arg:str}") def endpoint( path_arg: str = Parameter(examples=[Example(value="EXAMPLE_VALUE")]), )...