schema response per content type
- Dominant language
- No language data
- Stars
- 68
- Forks
- 8
- Avg merge
- 11h 2m
- Merged PRs (30d)
- 2
Description
## 💬 Question here
Would you consider updating the schema response config to also support a response per the request "accept" header?
```js
const schema = {
response: {
// Augment the current mapping (status code -> response schema) to support
// status code -> accept header -> response schema
200: {
"application/vnd.bla.v1+json": ...
"*/*": ...
}
}
}
fastify.get("/apples/:id", { schema } , (request, reply) => {
switch (request.header["accept"]) {
case "application/json":
reply.send(...);
break;
case "application/vnd.bla.v1+json":
reply.send(...);
break;
}
});
````
This would also be beneficial when fastify-swagger dynamically generates an OAS v3 definition.
https://github.com/fastify/fastify-swagger/issues/117
Contributor guide
Assessment
This issue has not been assessed yet.