Azure / Azure/azure-functions-openapi-extension
Question about multiple possible response Objects for single endpoint
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the issue**
I have a function app that returns different objects based on a value provided in the `Accept` header.
To document the response, by hand we would add:
```
"207": {
"description": "`Multi-Status`"
"content": {
"application/json; operation=update": {
"schema": {
"$ref": "#/components/schemas/UpdateOperationResponse"
},
},
"application/json; operation=read": {
"schema": {
"$ref": "#/components/schemas/ReadOperationResponse"
},
},
```
Is there a way to generate this kind of output from the existing library? I see that https://github.com/Azure/azure-functions-openapi-extension/pull/480 will add multiple content types, but if I understand the library correctly, the `schema` is being generated by the `Type` parameter on the `OpenApiResponseWithBody` attribute and I see no way to provide multiple inputs to match the different content-types
Contributor guide
Research direction
Start with the OpenApiResponseWithBody attribute and its Type parameter, then review pull request #480 for the existing multiple-content-type work. Determine whether the library can represent distinct schemas for the requested Accept-header variants, and document or implement the supported approach if the scope is agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100