...

Text file src/github.com/go-openapi/validate/fixtures/validation/fixture-additional-items-3.yaml

Documentation: github.com/go-openapi/validate/fixtures/validation

     1swagger: '2.0'
     2info:
     3  title: additionalItems-3
     4  version: '1.0'
     5  description: 'this spec exercise the additionalItems property on params and responses, with default and example values. This one is invalid.'
     6  license:
     7    name: MIT
     8host: localhost:8081
     9basePath: /api/v1
    10schemes:
    11  - http
    12consumes:
    13  - application/json
    14produces:
    15  - application/json
    16paths:
    17  /servers/getGood:
    18    get:
    19      operationId: getGoodOp
    20      parameters:
    21        - name: addItems
    22          in: query
    23          type: string
    24      responses:
    25        200:
    26          description: 'ok'
    27          schema:
    28            type: array
    29            # Unsupported keyword
    30            additionalItems:
    31              type: object
    32              properties:
    33                v: string
    34            items:
    35              # inline schema
    36              - type: object
    37                properties:
    38                  first:
    39                    type: string
    40              # ref simple schema
    41              - $ref: '#/definitions/itemsSchema0'
    42              # ref multiple complex schemas
    43              - $ref: '#/definitions/itemsSchema1'
    44              - $ref: '#/definitions/itemsSchema2'
    45              - $ref: '#/definitions/itemsSchema3'
    46            default: 
    47              - first: 'Default string'          #<-- validates inline schema
    48              - 'Default string'          #<-- validates scheme0
    49              - x: 'a'                    #<-- validates schema1
    50                c: 1
    51              - z: 1                      #<-- validate  schema2
    52            example: 
    53              - first: 'Default string'          #<-- validates inline schema
    54              - 'A string'                #<-- validates scheme0
    55              - x: 'a'                    #<-- validates schema1
    56                c: 1
    57              - z: 1
    58          examples:
    59            application/json:
    60              - first: 'Default string'          #<-- validates inline schema
    61              - 'A string'                #<-- validates scheme0
    62              - x: 'a'                    #<-- validates schema1
    63                c: 1
    64              - z: 1
    65              -
    66                - 
    67                  - a: 'a'
    68                  - b: 'b'
    69                - 
    70                  - a: 'c'
    71                  - b: 'd'
    72  /servers/edgeCase:
    73    get:
    74      operationId: getEdgeOp
    75      parameters:
    76        - name: addItems
    77          in: query
    78          type: string
    79      responses:
    80        200:
    81          description: 'ok'
    82          schema:
    83            type: array
    84            # unsupported
    85            additionalItems:
    86              type: array
    87              items:
    88                type: array
    89                items:
    90                  type: string
    91            items:
    92            - type: array
    93              additionalItems:
    94                type: string
    95              items:
    96              - type: integer
    97                format: int32
    98              - type: string
    99              - type: integer
   100              default:
   101              - 1
   102              - 'ABC'
   103              - 32
   104              - 'ABC'
   105              example:
   106              - 1
   107              - 'ABC'
   108              - 32
   109              - 'ABC'
   110              - 'DEF'
   111            default:
   112            - 
   113              - 1
   114              - 'ABC'
   115              - 32
   116              - 'ABC'
   117            - 
   118              - 
   119                - 'ABC'
   120              - 
   121                - 'ABCD'
   122              - 
   123                - 'ABCDE'
   124            example:
   125            - 
   126              - 1
   127              - 'ABC'
   128              - 32
   129            - 
   130              - 
   131                - 'ABC'
   132              - 
   133                - 'ABCD'
   134              - 
   135                - 'ABCDE'
   136          examples:
   137            application/json:
   138            - 
   139              - 1
   140              - 'ABC'
   141              - 32
   142              - 'XYZ'
   143            - 
   144              - 
   145                - 'ABC'
   146              - 
   147                - 'ABCD'
   148              - 
   149                - 'ABCDE'
   150            
   151definitions:
   152  itemsSchema0:
   153    type: string
   154  itemsSchema1:
   155    type: object
   156    required:
   157      - x
   158      - c
   159    properties:
   160      x:
   161        type: string
   162        enum:
   163          - 'a'
   164          - 'b'
   165          - 'c'
   166        default: 'a'
   167        example: 'b'
   168      c:
   169        type: number
   170        default: 1
   171        example: 9
   172    example:
   173      x: 'c'
   174      c: 12
   175  itemsSchema2:
   176    type: object
   177    required:
   178      - z
   179    properties:
   180      z:
   181        type: number
   182        default: 1
   183        example: 9
   184    example:
   185      z: 12
   186  itemsSchema3:
   187    type: array
   188    items:
   189      type: array
   190      items:
   191        type: object
   192        properties:
   193          a:
   194            type: string
   195            default: 'a'
   196            example: 'A'
   197          b:
   198            type: string
   199            default: 'b'
   200            example: 'B'
   201        required: [ a, b ]
   202        default:
   203          a: 'x'
   204          b: 'y'
   205        example:
   206          a: 'u'
   207          b: 'v'
   208      default:
   209        - a: 'u'
   210          b: 'v'
   211      example:
   212        - a: 'u'
   213          b: 'v'
   214    default:
   215      - 
   216        - a: 'a'
   217        - b: 'b'
   218      - 
   219        - a: 'c'
   220        - b: 'd'
   221    example:
   222      - 
   223        - a: 'a'
   224        - b: 'b'
   225      - 
   226        - a: 'c'
   227        - b: 'd'

View as plain text