-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Validation with body which is intended for plain-text #317
base: master
Are you sure you want to change the base?
Conversation
if hasattr(func, "body"): | ||
content_items["text/plain"] = { | ||
"schema": {"$ref": f"#/components/schemas/{func.body}"} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will the BaseModel look like? Can you provide an example? If possible, can you add some tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kemingy It is intended for text inputs like CSV etc. BaseModel is used to describe data in this model and it can be like this:
class FooBarPostBodyData(BaseModel):
"""
CSV body for example for some import
"""
__root__: str = Field(description="Data in CSV format - it consists of columns name, surname, ..., ..., ... .")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kemingy : ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late response.
I feel that if we need to create a special argument for each MIME type, there will be endless arguments. By the way, they all belong to the request body. I wonder if we can add an attribute to the request model, for example, spec_mime_type
or something else. This should be able to handle this kind of feature. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some old discussions here #176
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it could be useful to process on one place for multiple mime-types.
nice feature, I would also be interested in plain text / csv or also binary bodies. |
Yes. I think we can add the |
No description provided.