Not sure what is going wrong here. I followed the documentation for adding path parameters and json body information. I then noticed there was no example for headers, but I just made the same as the path.
class AuthHeader(BaseModel): api_key: str = Field(..., description="API Key")
and added it to the function as header: AuthHeader.
Checked the swagger UI and sure enough it showed up as a required field under parameters, and the generated curl command looks logical enough, adding it as expected -H "api_key: supersecretapikey". But it keep getting the following back if I keep the api_key field required.
Environment:
Not sure what is going wrong here. I followed the documentation for adding path parameters and json body information. I then noticed there was no example for headers, but I just made the same as the path.
class AuthHeader(BaseModel): api_key: str = Field(..., description="API Key")
and added it to the function as
header: AuthHeader
.Checked the swagger UI and sure enough it showed up as a required field under parameters, and the generated curl command looks logical enough, adding it as expected
-H "api_key: supersecretapikey"
. But it keep getting the following back if I keep the api_key field required.[ { "loc": [ "api_key" ], "msg": "field required", "type": "value_error.missing" } ]
I get it from the "Try it out" on swagger UI, and from the curl command as well.