Skip to content

Broken OpenAPI with entries as property name #1493

Closed

Description

@paulrinckens

Describe the bug

Error in OpenAPI generation when a model property is named with entries. If property is renamed (e.g. entry) generation is successful.

To Reproduce

  1. Create a file with:
from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):
    entries: str


@app.post("/demo")
def read_root(e: Item):
    return e
  1. Open the browser and call the docs http://localhost:8000/docs.
  2. Schema is not rendered (see screenshot)

Expected behavior

Schema is correctly rendered.

Screenshots

image

Environment

  • OS: macOS
  • FastAPI Version 0.55.1
  • Python 3.7.1

Additional context

Related swagger UI issue fixed in this PR: swagger-api/swagger-ui#6025

Activity

  1. phy25 commented on May 30, 2020

    @phy25

    https://github.com/swagger-api/swagger-ui/releases/tag/v3.25.5

    The latest swagger-ui release should have fixed this - this has nothing to do with fastapi.

  2. tiangolo commented on Jun 6, 2020

    @tiangolo
    Member

    Thanks for the help here @phy25 ! 👏 🙇

    Yeah, that wouldn't be an issue with FastAPI but Swagger UI.

  3. github-actions commented on Jun 17, 2020

    @github-actions
    Contributor

    Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

  4. added
    questionQuestion or problem
    and removed
    bugSomething isn't working
    on Feb 22, 2023
  5. changed the title [-][BUG] Broken OpenAPI with `entries` as property name[/-] [+]Broken OpenAPI with `entries` as property name[/+] on Feb 24, 2023
  6. locked and limited conversation to collaborators on Feb 28, 2023
  7. converted this issue into a discussion #7447 on Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions