Skip to content

Missing usage of examples ExampleObject[] in @Header annotation #697

@vietk

Description

@vietk

Hello

I wanted to generate simple examples using OpenAPI annotations.
It's work well for API responses/Parameter/RequestBody examples.

However there's another place where @ExampleOjbect seems to be allowed in OAS 3.1, it would be in the @Header annotation mapping an OAS header object.

It's written that :

The Header Object follows the structure of the Parameter Object

Then, to me it's acceptable to have a way to provide ExampleObject[] inside a @Header, however I don't see any property to allow me mapping ExampleObject[] to a specific header.

I already tried what has been provided in this change but the corresponding generation is an array of example which is not valid OAS is waiting for a dictionnary :

valid:

  headers:
    Location:
      schema:
        type: string
        format: uri
      examples:
        valid_example:
          value: "/object/1"

not valid:

  headers:
    Location:
      schema:
        type: string
        format: uri
      examples:
       - not_valid_example:
            value: "/object/1"

What maintainer's view on that?

Regards
Kevin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions