We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A possible amelioration would be the usage of a as_form decorator to mark a schema as Form. See https://stackoverflow.com/questions/60127234/how-to-use-a-pydantic-model-with-form-data-in-fastapi/77113651#77113651
as_form
Form
We would need to require Python 3.11 to use this syntax
import inspect from typing import Annotated from fastapi import Form def as_form(cls): """ https://stackoverflow.com/questions/60127234/how-to-use-a-pydantic-model-with-form-data-in-fastapi/77113651#77113651 """ new_params = [ inspect.Parameter( field_name, inspect.Parameter.POSITIONAL_ONLY, default=model_field.default, annotation=Annotated[model_field.annotation, *model_field.metadata, Form()], ) for field_name, model_field in cls.model_fields.items() ] cls.__signature__ = cls.__signature__.replace(parameters=new_params) return cls
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Subject of the issue
A possible amelioration would be the usage of a
as_form
decorator to mark a schema asForm
.See https://stackoverflow.com/questions/60127234/how-to-use-a-pydantic-model-with-form-data-in-fastapi/77113651#77113651
We would need to require Python 3.11 to use this syntax
The text was updated successfully, but these errors were encountered: