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
Having body causes duplicate log entries #144
Comments
That's not body, that's a query param of a type that can't be handled. If you change the key from value to data what happens? The issue here is that the errors are swollen, no? |
I've been looking too @Goldziher I've repro'd with fresh environment and just starlite and uvicorn installed. Repro with: import logging
from pydantic import BaseModel
from starlite import Starlite, post, Provide
class RouteData(BaseModel):
id: str
@post(path="/")
def route(data: RouteData) -> RouteData:
return data
app = Starlite(route_handlers=[route], openapi_config=None) It happens even with the correct |
Seems to occur irrespective of handler method, e.g., from pydantic import BaseModel
from starlite import Starlite, get
class RouteData(BaseModel):
id: str
@get()
def route(value: RouteData) -> RouteData:
return value
app = Starlite(route_handlers=[route]) |
When I commented out all logging statements in https://github.com/kuimono/openapi-schema-pydantic/search?q=logging |
Ah OK, good spot @vrslev. I've just had a look and they use the module level logging handlers like From logging docs:
By letting it call So if you configure a handler to the root logger before calling |
I opened kuimono/openapi-schema-pydantic#19 We may as well leave this open as a reminder to track that. |
I've PR'd upstream for this so it is out of our hands now. |
Take the example and run it with
uvicorn
:You will notice that all log entries are duplicated:
If you change
value
type to string i. e. it would change to be query parameter:then duplicate entires disappear:
The text was updated successfully, but these errors were encountered: