-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Labels
Description
From what I could understand the request body is limited to the use of application/json content-type. I believe that the use of custom content type should be supported e.g.:
OAS:
paths:
/pet:
put:
tags:
- pet
summary: Update an existing pet
description: Update an existing pet by Id
operationId: updatePet
requestBody:
description: Update an existent pet in the store
content:
application/vnd.dog+json:
schema:
$ref: '#/components/schemas/Dog'
application/vnd.cat+json:
schema:
$ref: '#/components/schemas/Cat'Code:
class Dog(BaseModel):
class Config:
content_type = "application/vnd.dog+json"
class Cat(BaseModel):
class Config:
content_type = "application/vnd.cat+json"
@app.put('/pet')
def update_pet(body: Union[Dog, Cat]):
if isinstance(body, Dog):
...
else:
...