Skip to content

Feature Request: Automatically Generate Accept Headers #938

@Daniel-Vetter-Coverwhale

Description

Description

It would be really awesome if ogen would automatically generate an Accept header parameter and enum options for it based on the content-types in the response for a given operation. That way we can avoid specifying an Accept header ourselves (which I think openapi doesn't want us to do) and we can automatically deal with new content types as they are added to the spec without having to manually keep the enum in the header parameter in sync.

          "200": {
            "description": "200 OK",
            "content": {
              "application/vnd.sambasafety.json;version=2.0.4": {
                "schema": {
                  "$ref": "#/components/schemas/IntelligentMvrJson2_04Response"
                }
              },
              "application/vnd.sambasafety.json;version=3.0.0": {
                "schema": {
                  "$ref": "#/components/schemas/IntelligentMvrJson3_00Response"
                }
              },
              "application/vnd.sambasafety.xml;version=2.0.0": {
                "schema": {
                  "$ref": "#/components/schemas/IntelligentMvrXml2_00Response"
                }
              },
              "application/vnd.sambasafety.xml;version=2.0.2": {
                "schema": {
                  "$ref": "#/components/schemas/IntelligentMvrXml2_02Response"
                }
              },
              "application/vnd.sambasafety.xml;version=2.0.3": {
                "schema": {
                  "$ref": "#/components/schemas/IntelligentMvrXml2_03Response"
                }
              },
              "application/vnd.sambasafety.html": {
                "schema": {
                  "$ref": "#/components/schemas/IntelligentMvrHtmlResponse"
                }
              },
              "application/vnd.sambasafety.pdf": {
                "schema": {
                  "$ref": "#/components/schemas/IntelligentMvrPdfResponse"
                }
              }
            }
          },

References

https://swagger.io/docs/specification/describing-parameters/
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions