Skip to content

primaryData attribute in Media Type Object #2454

@K-Adam

Description

@K-Adam

Media Type Object should have an optional primaryData attribute, to specify the name of the property, where the primary data is located in the schema.

It is very common to return the response object wrapped in a top level property. This way, it is possible to provide additional metadata as well. Example:

responses:
  '200':
    description: successful operation
    content:
      application/json:
        schema:
          type: object
          properties:
            data:
              $ref: '#/components/schemas/User'
            meta:
              $ref: '#/components/schemas/Metadata'
          required: ['data']
        primaryData: data

The OpenApi tools could better understand these type of responses. It would be possible to express, that the data attribute is not really part of any schemas/objects. It is just a wrapper.

The SDK Generators could benefit from this primaryData attribute as well. At the moment, these kind of responses usually have to be manually unwrapped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs attentionThe author has replied and people with triage rights should take action.media and encodingIssues regarding media type support and how to encode data (outside of query/path params)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions