-
-
Notifications
You must be signed in to change notification settings - Fork 140
Description
Suggestion
There has been use cases where validation is not always wanted for input but having the input schema in the docs is. It would be nice if there was a way to optionally disable validation for a given input schema and just have APIFlask pass the unaltered JSON to the endpoint while still keeping the input documented in the schema.
Something like:
@some_blueprint.post("/foos/bulk")
@some_blueprint.input(SomeSchema, validate=False)
def create_foos(json_data: dict):
...or
@some_blueprint.post("/foos/bulk")
@some_blueprint.doc(input=SomeSchema)
def create_foos(json_data: dict):
...This solves the problem as a lot of the times, bulk endpoints for things like bulk create, bulk edit can do a "best effort" processing. ie. Create/edit all valid entries and ignore invalid entries. Endpoints like POST /foos/bulk or PUT /foos/bulk.
I can't seem to find a way of doing it with subclassing or some other method of overriding.
I'm more than happy to help and contribute with an MR if this feature is deemed useful.