Skip to content

Are wildcard media types supported in content? #1290

@hkosova

Description

@hkosova

The 3.0 Specification contains examples where the request and response content includes wildcard media types, e.g. here:
https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#request-body-examples
https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#path-item-object-example

description: user to add to the system
content: 
  'application/json':
    schema:
      $ref: '#/components/schemas/User'
  ...
  '*/*':
    examples:
      user: 
        summary: User example in other format
        externalValue: 'http://foo.bar/examples/user-example.whatever'

Are these examples valid and wildcard types actually supported?

The description of content says just this (emphasis mine):

content
Map[string, Media Type Object]
REQUIRED. The content of the request body. The key is the media type and the value describes it.

For comparison, the Encoding Object explicitly states that wildcard types are allowed:

contentType
... The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.

If wildcard types are supported in content, how does this work? Do more specific types have preference over wildcard ones, e.g. image/png > image/* > */*?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions