...

Text file src/github.com/go-openapi/validate/fixtures/validation/fixture-1171.yaml

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

     1# In this one we make sure arrays without items are detected by validation
     2# Conversely, objects with items are detected with fixture for issue #1238
     3swagger: '2.0'
     4info:
     5  title: issue-1171
     6  version: 0.0.1
     7  license:
     8    name: MIT
     9host: localhost:8081
    10basePath: /api/v1
    11schemes:
    12  - http
    13consumes:
    14  - application/json
    15produces:
    16  - application/json
    17paths:
    18  '/servers/{server_id}/zones':
    19    get:
    20      operationId: listZones
    21      tags:
    22        - zones
    23      parameters:
    24        - name: server_id
    25          in: path
    26          required: true
    27          type: string
    28        - name: other_server_id
    29          in: path
    30          schema:
    31            # Invalid array definition
    32            type: array
    33            properties:
    34              other:  
    35                type: string
    36      responses:
    37        '200':
    38          description: An array of Zones
    39          schema:
    40            $ref: '#/definitions/Zones'
    41
    42  '/server/getBody':
    43    get:
    44      operationId: getBody
    45      parameters:
    46        - name: yet_other_server_id
    47          in: body
    48          schema:
    49            # Invalid array definition
    50            type: array
    51            properties:
    52              other:  
    53                type: string
    54        # param should be named?
    55        - thestreetwithnoname: storyOfTheStreetsAreMine
    56          in: body
    57          type: integer
    58      responses:
    59        '200':
    60          schema:
    61            $ref: '#/definitions/Zones'
    62
    63  '/servers/{server_id}/zones/{zone_id}':
    64    get:
    65      operationId: listZone
    66      tags:
    67        - zones
    68      parameters:
    69        - name: server_id
    70          in: path
    71          required: true
    72          type: string
    73        - name: zone_id
    74          type: string
    75          in: path
    76          required: true
    77      responses:
    78        '200':
    79          description: A Zone
    80          schema:
    81            $ref: '#/definitions/Zone'
    82        '201':
    83          description: An invalid Zone
    84          schema:
    85            $ref: '#/definitions/InvalidZone'
    86        '203':
    87          description: An empty Zone
    88          schema:
    89            $ref: '#/definitions/EmptyZone'
    90
    91
    92definitions:
    93  # An array must have an  items definition
    94  Zones:
    95    type: array
    96    properties:
    97      name:
    98        type: string
    99  Zone:
   100    type: array
   101    items:
   102      type: string
   103  InvalidZone:
   104    type: array
   105    items:
   106      # This is a forbidden property
   107      name:
   108        type: string
   109  EmptyZone:
   110    type: array
   111    # Empty description: no error
   112    items:

View as plain text