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

Create with POST: Helper for getting a model without id #133

Open
samedii opened this issue May 22, 2021 · 1 comment
Open

Create with POST: Helper for getting a model without id #133

samedii opened this issue May 22, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@samedii
Copy link

samedii commented May 22, 2021

Feature request

Context

I would like if it was easier to get correct documentation for POST without an id for creating items.

Solution

It would be nice if there was a helper named something like without_id available on Model that allowed something like:

@router.post(
    "/movies",
    response_model=Movie,
    status_code=status.HTTP_201_CREATED,
)
async def add_movie(movie: Movie.without_id):
    ...

So that id doesn't show up in the documentation for this endpoint and validation would raise if someone tried to provide it.

@samedii samedii added the enhancement New feature or request label May 22, 2021
@s724959099
Copy link

any update?
I want this feature too

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

No branches or pull requests

2 participants