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.

2
  • Does this answer your question -- How to add multiple array example values in OpenAPI? Commented May 25, 2022 at 10:04
  • No unfortunately not. I want to have exactly the same schema as in the json code above. Commented May 27, 2022 at 9:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.