Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

bug(openapi): Incorrect schema for health endpoint #236

Open
gazorby opened this issue Jan 12, 2023 · 1 comment
Open

bug(openapi): Incorrect schema for health endpoint #236

gazorby opened this issue Jan 12, 2023 · 1 comment

Comments

@gazorby
Copy link
Collaborator

gazorby commented Jan 12, 2023

The generated schema for the health endpoint seems to be null while it should follows settings.AppSetting model.

@peterschutt
Copy link
Member

I've been noticing this sort of thing too:

image

Notice the body schema seems fine, but the return is typed Any. This is generated from:

@post()
async def receive_push(
    data: WriteDTO,
    service: Service,
    provider_id: UUID = Parameter(header="X-PROVIDER-ID"),
) -> ReadDTO:
    """Push an object to this route, with a `"data"` key that contains your data.

    Example:
        {"data": [{"your": "valid"}, ["json"]}
    """
    return ReadDTO.from_orm(await service.create(Push(provider_id=provider_id, data=data.data)))

At first I was wondering if the use of the generic syntax in FromMapped was causing it, but in the above example, the dto instances are both plain pydantic models:

class ReadDTO(BaseModel):
    """The representation of a push that we send back."""

    class Config:
        """Blah."""

        orm_mode = True

    provider_id: UUID


class WriteDTO(BaseModel):
    """The representation of the push that we require."""

    data: Any

I'm also getting this from an application that is using the FromMapped for type annotations:

image

I just haven't been able to prioritize the time to look at either of these things yet, as the issue seems to be contained to docs.

Good to know you are experiencing also, I'll up the urgency on looking into it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants