0

I am writing a openapi specification in YAML and I want to have this JSON code as a YAML file for a openAPI specification:

{
  "example": [
    {
      "example1":
       {
         "type": "string"
       } ,
      "example2": 
       {
         "type":"string"
       }
    },
    {
      "example1": 
       {
         "type": "string"
       },
       "example2": 
       {
         "type": "string"
       },
    }
  ]
}

I tried:

schema:
  type: object
  properties:
    example:
      type: array
      items:
        type: object
        properties:
          example1:
            type: string
          example2:
            type: string
        type: object
        properties:
          example1:
            type: string
          example2:
            type: string

But you cannot have properties again because every map key has to be unique.

  • Does this answer your question -- [How to add multiple array example values in OpenAPI?](https://stackoverflow.com/q/46578110/113116) – Helen May 25 '22 at 10:04
  • No unfortunately not. I want to have exactly the same schema as in the json code above. – Prof._Paul May 27 '22 at 09:51

0 Answers0