OAI / OAI/OpenAPI-Specification

`primaryData` attribute in Media Type Object

Open
#2,454 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

media and encoding
Dominant language
Markdown
Stars
31.2k
Forks
9.2k
Avg merge
6h 37m
Merged PRs (30d)
27

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Media Type Object section in versions/3.1.0.md and review how specification changes are represented in this repository. Determine the scope of the proposed optional primaryData attribute and its effects on SDK generators; done requires an agreed specification change and corresponding tool considerations.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.