OpenAPI-Specification icon indicating copy to clipboard operation
OpenAPI-Specification copied to clipboard

Allow required as sibling of $ref (like summary/description)

Open radicarl opened this issue 3 years ago • 5 comments

Hello,

it would be great for reusability if I could overwrite the required field of parameter and header objects, like I can overwritesummary and description in OpenAPI 3.1.

paths:
  /my-resource:
    parameters:
      - $ref: '#/components/parameters/Accept'
        required: true
    get:
      # some definition

components:
  parameters:
    Accept:
      name: Accept
      in: header
      required: false
      schema:
        type: string

radicarl avatar Mar 10 '21 15:03 radicarl

Thanks for this. We deliberately started small with the scope of this feature with the hope of collecting more data points about what properties people would find it useful to override. In this example we would currently have to say you could not override required: true of an in: path parameter with a false value, but otherwise, I can see how this would be useful.

MikeRalphson avatar Mar 12 '21 12:03 MikeRalphson

maybe similar to #2089, PR to v3.1 in #2181

PixnBits avatar Jun 15 '21 20:06 PixnBits

similar to #2026

JameelKhan9 avatar Jun 30 '22 01:06 JameelKhan9

Folks interested in this topic will likely be interested in the general referencing discussion that has recently started. Keywords adjacent to $ref outside of JSON Schema make for a very tricky topic.

handrews avatar Nov 07 '22 00:11 handrews