Skip to content
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

Missing array description that is nested under under anyOf #2639

Open
R2RT opened this issue Jan 3, 2025 · 0 comments
Open

Missing array description that is nested under under anyOf #2639

R2RT opened this issue Jan 3, 2025 · 0 comments

Comments

@R2RT
Copy link

R2RT commented Jan 3, 2025

Describe the bug

When array type is nested under anyOf it is rendered in quite a raw state, no description is shown at all.

Expected behavior

Description of currently selected array should be visible.

Minimal reproducible OpenAPI snippet(if possible)

Api file:
api.json

Generated with Python script
from fastapi import FastAPI
import json
from typing import Annotated
from pydantic import RootModel, Field


class Euler3(RootModel[Annotated[list[float], Field(min_length=3, max_length=3)]]):
    """Euler angles in degrees"""


class Quaternion(RootModel[Annotated[list[float], Field(min_length=4, max_length=4)]]):
    """Orientation defined by quaternion XYZW. It should be normalized."""


class Rotation(RootModel[Euler3 | Quaternion]):
    """Rotation in 3D world"""


app = FastAPI(
    title="Test",
)


@app.post("/rotation")
async def rotation(r: Rotation) -> Rotation:
    return Rotation


schema = app.openapi()


if __name__ == "__main__":
    import sys

    json.dump(app.openapi(), sys.stdout)

Screenshots

ReDoc view generated by https://redocly.github.io/redoc/:

Image

For reference, view generated with swagger keeps the descriptions: https://editor.swagger.io/

Image

Additional context

I've tried with explicit hideOneOfDescription = false, no change.

@R2RT R2RT added the Type: Bug label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant