So i need to add the authorization bearer model in the header part of a json request
can i validate it with the marshmallow schema?
If the headers structure inherits from the Mapping interface, marshmallow will consume it. If it doesn't, you will need to cast it to a dict first. You will probably need to set unknown=IGNOREunknown=EXCLUDE on the schema, since you probably don't want to declare the entire HTTP headers spec.
flask/werkzeug's Headers data structure does not inherit from Mapping, but casting it to a dict works fine.
s/IGNORE/EXCLUDE
Most helpful comment
If the headers structure inherits from the
Mappinginterface, marshmallow will consume it. If it doesn't, you will need to cast it to a dict first. You will probably need to setunknown=IGNOREunknown=EXCLUDEon the schema, since you probably don't want to declare the entire HTTP headers spec.flask/werkzeug's
Headersdata structure does not inherit fromMapping, but casting it to a dict works fine.