I would to use content negotiation for proper JSON representation.
For example, I would like to have three types of HEADER ACCEPTANCE as follows
- Accept:application/vnd.api.summarized+json
- Accept:application/vnd.api.complete+json
- Accept:application/vnd.api.extended+json
At this time, I would like to set up a List for each of the models. How should I express List in schema?
@router.get("/",
summary="Get Items",
description="",
responses={
status.HTTP_200_OK: {
"description": "OK",
"content": {
"application/vnd.api.summarized+json": {
"schema": ItemSummarized.model_json_schema()
},
"application/vnd.api.complete+json": {
"schema": Item.model_json_schema()
},
"application/vnd.api.extended+json": {
"schema": {
"$ref": "#/components/schemas/Item"
}
},
},
"model": List[Item]
}
})
def read_items(
Could someone please help me?