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

Should Feed Escape work in Pydantic Models #3024

Closed
killswitch-GUI opened this issue Mar 31, 2021 · 9 comments
Closed

Should Feed Escape work in Pydantic Models #3024

killswitch-GUI opened this issue Mar 31, 2021 · 9 comments
Labels
answered feature New feature or request reviewed

Comments

@killswitch-GUI
Copy link

I'm not seeing \f affecting the output of pydantic models in my OpenAPI spec as described here: https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/ is this a bug I should open or just a limitation?

@killswitch-GUI killswitch-GUI added the question Question or problem label Mar 31, 2021
@insomnes
Copy link

@killswitch-GUI doc at link, that you have provided, explicitly says:
You can limit the lines used from the docstring of a path operation function for OpenAPI.

@killswitch-GUI
Copy link
Author

@insomnes I clearly asked if this would affect Pydantic models in my OpenAPI spec.. you neither answered my question or provided context to the question I'm asking. Also, I'm well aware of what the docs have... I searched over the Pydantic & FastAPI documentation carefully to make sure I wasn't coming here to piss people like @Kludex off...

Simply put I want to maintain my development docs and keep my linters happy while excluding those nasty bits to my JSON schema like such:

class Item(ModelWeOwn, SomeOtherModel):
    """Some nice model
    \f
    VERY Long internal description, use case etc.

    Args:
        ModelWeOwn (Type): Somthing

    Return:
        (Type): somthing
    """
    name: str
    description: Optional[str] = None
    price: float
    tax: Optional[float] = None
    tags: Set[str] = []


@app.post("/items/", response_model=Item, summary="Create an item")
async def create_item(item: Item):
    """
    Create an item with all the information:

    - **name**: each item must have a name
    - **description**: a long description
    - **price**: required
    - **tax**: if the item doesn't have tax, you can omit this
    - **tags**: a set of unique tag strings for this item
    \f
    :param item: User input.
    """
    return item

@insomnes
Copy link

insomnes commented Apr 2, 2021

@killswitch-GUI sorry, for some reason my brain omitted

is this a bug I should open or just a limitation?

part when i was answering your question.
Anyway, doc clearly says that it works only for path operation function, and it work as intended.
It is good enhancement proposal and as i can see @Kludex created PR for it.

@killswitch-GUI
Copy link
Author

@insomnes no issue at all I appreciate your help and attention. and @Kludex LOL.... idk what to say other than add documentation to your PR so more people don't come here to ask questions...

@Kludex
Copy link
Sponsor Collaborator

Kludex commented Apr 12, 2021

@killswitch-GUI There's no need to close the issue. That PR was not accepted yet.

@killswitch-GUI
Copy link
Author

ok @Kludex

@killswitch-GUI killswitch-GUI reopened this May 6, 2021
@tiangolo
Copy link
Owner

tiangolo commented Sep 2, 2022

This was handled by @Kludex in #3032, it will be available in the next version, FastAPI 0.82.0. 🎉

@tiangolo tiangolo added answered feature New feature or request and removed question Question or problem labels Sep 2, 2022
@github-actions
Copy link
Contributor

Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs.

@amacfie
Copy link
Contributor

amacfie commented Jun 23, 2023

Note that there is a bug in the implementation but there is a PR to fix it: #6039

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered feature New feature or request reviewed
Projects
None yet
Development

No branches or pull requests

5 participants