Giter Site home page Giter Site logo

Comments (7)

peterschutt avatar peterschutt commented on May 12, 2024 2

I opened kuimono/openapi-schema-pydantic#19

We may as well leave this open as a reminder to track that.

from litestar.

Goldziher avatar Goldziher commented on May 12, 2024

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?

from litestar.

peterschutt avatar peterschutt commented on May 12, 2024

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 data kwarg. Seems to be comming from openapi generation. If you set openapi_config=None to app like I have in the script above it stops.

from litestar.

peterschutt avatar peterschutt commented on May 12, 2024

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])

from litestar.

vrslev avatar vrslev commented on May 12, 2024

@peterschutt

Seems to be comming from openapi generation

When I commented out all logging statements in openapi-schema-pydantic package it started working fine.

https://github.com/kuimono/openapi-schema-pydantic/search?q=logging

from litestar.

peterschutt avatar peterschutt commented on May 12, 2024

Ah OK, good spot @vrslev.

I've just had a look and they use the module level logging handlers like logging.info() rather than setting up a library scoped logger.

From logging docs:

This function (as well as info(), warning(), error() and critical()) will call basicConfig() if the root logger doesnโ€™t have any handler attached.

By letting it call basicConfig() another handler gets added to root logger and hence the duplicated messages.

So if you configure a handler to the root logger before calling Starlite() then this would be avoidable I think, but you shouldn't have to. They should be instantiating named loggers for their lib and have a null handler attached to the root logger of their namespace so it doesn't affect downstream.

from litestar.

peterschutt avatar peterschutt commented on May 12, 2024

I've PR'd upstream for this so it is out of our hands now.

from litestar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.