Skip to content

update the content type for /openapi.json and /openapi.yaml #1089

@jannyHou

Description

@jannyHou

Description

Good suggestion from @bajtos, original discussion: #1067 (comment)

Copied here:

Ideally, /openapi.json should be returning application/json content type.

Eventually, when OpenAPI spec working group decides on the content type for OAI documents (see OAI/OpenAPI-Specification#110), we should switch to that one instead.

Their latest proposal (21 days old, see OAI/OpenAPI-Specification#110 (comment)):

application/vnd.oai.openapi (YAML variant)
application/vnd.oai.openapi+json (JSON only variant) 

With an optional version parameter:

application/vnd.oai.openapi;version=3.0.0

As for /openapi.yaml endpoint, it looks like there is no official IANA-registered content type yet :( Looks like text/yaml may be the best option, even if it's not entirely spec-conforming. Alternatively, application/x-yaml and test/x-yaml are spec-conforming options we can use instead. See https://www.ietf.org/mail-archive/web/media-types/current/msg00693.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    RESTIssues related to @loopback/rest package and REST transport in generalfeaturestale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions