github.com/kaisawind/go-swagger@v0.19.0/fixtures/bugs/1487/fixture-basetypes.yaml (about)

     1  swagger: '2.0'
     2  
     3  info:
     4    version: "1.0.0"
     5    title: 'tests on polymorphic types: part I base types'
     6    description: different types of base types and types based upon base types (by aliasing or composition)
     7  produces:
     8    - application/json
     9  consumes:
    10    - application/json
    11  paths:
    12    /models:
    13      get:
    14        operationId: modelOp
    15        summary: many model variations
    16        description: no description
    17        tags:
    18          - testcgen
    19        responses:
    20          default:
    21            description: Generic Out
    22  definitions:
    23    # different sorts of base types, from trivial to rich
    24    trivialBase:
    25      type: object
    26      description: 'do not expect validations on this trivialBase: validation should be empty'
    27      discriminator: trivialType
    28      required:  
    29        - trivialType
    30      properties:
    31        trivialType: 
    32          type: string
    33    trivialBaseWithValidation:
    34      type: object
    35      description: 'do not expect validation on the discriminator: they are documentary only'
    36      discriminator: trivialTypeWithValidation
    37      required: 
    38        - trivialTypeWithValidation
    39      properties:
    40        trivialTypeWithValidation: 
    41          description: 'not actually validated. This is documentary only'
    42          type: string
    43          maxLength: 255
    44    baseWithProperty:
    45      type: object
    46      discriminator: baseWithPropertyType
    47      required:
    48        - baseWithPropertyType
    49      properties:
    50        baseWithPropertyType:
    51          type: string
    52        baseSize:
    53          description: this one for sanity check simple validations
    54          type: integer
    55          minimum: 0
    56    baseWithAddProps:
    57      type: object
    58      description: 'BREAKS'
    59      discriminator: baseWithAddPropsType
    60      required:
    61        - baseWithAddPropsType
    62      properties:
    63        baseWithAddPropsType: 
    64          description: this one for sanity check simple validations
    65          type: string
    66          format: hostname
    67      additionalProperties:
    68        type: object
    69        properties:
    70          baseAddProp:
    71            type: integer
    72            minimum: 0
    73    baseWithMap:
    74      description: 'PASS'
    75      type: object
    76      discriminator: baseWithMapType
    77      required:
    78        - baseWithMapType
    79      properties:
    80        baseWithMapType:
    81          type: string
    82      additionalProperties: true
    83    baseWithTuple:
    84      description: 'BREAKS'
    85      type: object
    86      discriminator: baseWithTupleType
    87      required:
    88        - baseWithTupleType
    89      properties:
    90        baseWithTupleType:
    91          type: string
    92        baseTuple: 
    93          type: array
    94          items:
    95            - type: integer
    96              minimum: 0
    97            - type: string
    98              format: date
    99          additionalItems:
   100            type: string
   101            format: uuid
   102    baseWithAllOf:
   103      type: object
   104      discriminator: baseWithAllOfType
   105      required:
   106        - baseWithAllOfType
   107      properties:
   108        baseWithAllOfType:
   109          type: string
   110        baseComposition:
   111          type: object 
   112          allOf: 
   113            - properties:
   114                baseProp1:
   115                  type: string
   116              additionalProperties:
   117                type: object
   118                properties:
   119                  extendedProp1:
   120                    type: string
   121            - properties:
   122                baseProp2:
   123                  type: string
   124              additionalProperties:
   125                type: object
   126                properties:
   127                  extendedProp1:
   128                    type: string
   129    #
   130    # Composition patterns on base types
   131    #
   132    # Aliases on 'trivialBase'
   133    trivialSliceAlias:
   134      type: array 
   135      items: 
   136        $ref: '#/definitions/trivialBase'
   137    trivialSliceAliasWithValidation:
   138      type: array 
   139      maxItems: 15
   140      items: 
   141        $ref: '#/definitions/trivialBase'
   142    trivialMapAlias:
   143      type: object 
   144      additionalProperties: 
   145        $ref: '#/definitions/trivialBase'
   146    # Aliases on trivialBaseWithValidation
   147    trivialWithValidationSliceAlias:
   148      type: array 
   149      items: 
   150        $ref: '#/definitions/trivialBaseWithValidation'
   151    trivialWithValidationSliceAliasWithValidation:
   152      type: array 
   153      maxItems: 15
   154      items: 
   155        $ref: '#/definitions/trivialBaseWithValidation'
   156    trivialWithValidationMapAlias:
   157      type: object 
   158      additionalProperties: 
   159        $ref: '#/definitions/trivialBaseWithValidation'
   160    # Aliases on ...
   161    # TODO
   162    # Compositions of base type 'trivialBase'
   163    # As properties
   164    trivialInProps:
   165      type: object 
   166      properties:
   167        genericTrivialProp:
   168          $ref: '#/definitions/trivialBase'
   169    # As items
   170    trivialInItems:
   171      type: array
   172      maxItems: 10
   173      items:
   174        $ref: '#/definitions/trivialBase'
   175    # As additional properties
   176    trivialInAddProps:
   177      type: object 
   178      properties:
   179        prop1:
   180          type: integer 
   181          minimum: 10
   182      additionalProperties:
   183        $ref: '#/definitions/trivialBase'
   184    # As tuple elements, with additionalItems
   185    trivialInTuple:
   186      type: array
   187      items:
   188        - type: integer       # sanity check element
   189          minimum: 10
   190        - $ref: '#/definitions/trivialBase'
   191      additionalItems:
   192       $ref: '#/definitions/trivialBase'
   193  
   194    # As allOf: means creating a new subtype. 
   195    # This is multiple inehritance and this story shall also be told...