1

We want to have nested array of multiple type (string, integer, float).

Below is the yaml snippet that I want to have

definitions:
    A:
        type: object
        required:
            - data
            - fields
        properties:
            data:
            type: array
                items:
                    type: array
                    items:
                        # I want to support number & string in this array
                        type: number | string
            fields:
                type: array
                items:
                    type: string

so that it can be seen as below with data

{"data": [[1, "a", 3, 9],[2, "b", 5, 8]], fields: ["AV", "AS"]}

Elliot Blackburn
  • 3,759
  • 1
  • 23
  • 42
nishith
  • 1,223
  • 1
  • 12
  • 21

1 Answers1

-1

I referred this example https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

definitions:
Pet:
type: object
discriminator: petType
properties:
  name:
    type: string
  petType:
    type: string
required:
- name
- petType
Cat:
description: A representation of a cat
allOf:
- $ref: '#/definitions/Pet'
- type: object
  properties:
    huntingSkill:
      type: string
      description: The measured skill for hunting
      default: lazy
      enum:
      - clueless
      - lazy
      - adventurous
      - aggressive
  required:
  - huntingSkill
Dog:
description: A representation of a dog
allOf:
- $ref: '#/definitions/Pet'
- type: object
  properties:
    packSize:
      type: integer
      format: int32
      description: the size of the pack the dog is from
      default: 0
      minimum: 0
  required:
  - packSize
xs2bharat
  • 11
  • 4