Azure / Azure/azure-functions-openapi-extension

Question about multiple possible response Objects for single endpoint

Open
#511 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.