github.com/rzurga/go-swagger@v0.28.1-0.20211109195225-5d1f453ffa3a/fixtures/bugs/1487/fixture-polymorphism.yaml (about) 1 swagger: '2.0' 2 3 info: 4 version: "1.0.0" 5 title: check validation codegen on polymorphic types 6 description: various patterns of polymorphic types with or without validation 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 # TODO: map of polymorphic types 24 # TODO: tuple in base type 25 # TODO: marshal aliases of base type 26 # TODO: marshal additional properties in base type 27 MapOfNodes: 28 type: object 29 additionalProperties: 30 $ref: "#/definitions/Node" 31 # Issue: Validate() is empty 32 Graph: 33 type: object 34 properties: 35 Nodes: 36 type: array 37 items: 38 $ref: "#/definitions/Node" 39 SmallGraph: 40 type: object 41 properties: 42 Nodes: 43 maxItems: 10 44 type: array 45 items: 46 $ref: "#/definitions/Node" 47 # Issue: Validate() is empty instead of just return nil 48 Node: 49 type: object 50 discriminator: NodeType 51 required: 52 - NodeType 53 properties: 54 NodeType: 55 type: string 56 NodeSize: 57 type: integer 58 minimum: 0 59 SmallNode: 60 type: object 61 discriminator: NodeType 62 required: 63 - NodeType 64 properties: 65 NodeType: 66 # no validations are taken into account on discriminator property 67 # (purely documentary) 68 type: string 69 maxLength: 255 70 CodeBlockNode: 71 allOf: 72 - $ref: "#/definitions/Node" 73 - properties: 74 Code: 75 type: string 76 # Added an additional subtype 77 DocBlockNode: 78 allOf: 79 - $ref: "#/definitions/Node" 80 - properties: 81 Doc: 82 type: string 83 maxLength: 1000 84 # Issue: alias generated, without Validate() 85 arrayOfBaseTypes: 86 type: array 87 items: 88 $ref: '#/definitions/myBaseType' 89 smallArrayOfBaseTypes: 90 type: array 91 maxItems: 12 92 items: 93 $ref: '#/definitions/myBaseType' 94 # Issue: broken codegen 95 tupleOfBaseTypes: # OK 96 type: array 97 items: 98 - $ref: '#/definitions/mySubType1' 99 - $ref: '#/definitions/mySubType2' 100 - $ref: '#/definitions/myBaseType' # tuple element is a base type 101 # BROKEN - $ref: '#/definitions/smallArrayOfBaseTypes' # tuple element is an alias on base type (slice) 102 # BROKEN - $ref: '#/definitions/MapOfNodes' # tuple element is an alias on base type (map) 103 mapOfBaseTypes: 104 type: object 105 properties: 106 dummy: 107 type: integer 108 multipleOf: 10 109 additionalProperties: 110 $ref: "#/definitions/myBaseType" 111 tupleWithAdditionalBaseTypes: 112 type: array 113 items: 114 - type: integer 115 minimum: 100 116 - $ref: '#/definitions/mySubType1' 117 - $ref: '#/definitions/mySubType2' 118 additionalItems: 119 $ref: '#/definitions/myBaseType' # additionalItems are a base type 120 mySubType1: 121 allOf: 122 - $ref: "#/definitions/myBaseType" 123 - properties: 124 subprop1: 125 type: string 126 format: date 127 mySubType2: 128 allOf: 129 - $ref: "#/definitions/myBaseType" 130 - type: object 131 additionalProperties: 132 $ref: "#/definitions/myBaseType" 133 myBaseType: 134 type: object 135 discriminator: myObjectType 136 required: 137 - myObjectType 138 properties: 139 myObjectType: 140 type: string 141 myObjectPrice: 142 type: number 143 minimum: 0 144 myObjectResellers: 145 type: array 146 items: 147 type: object 148 required: [name] 149 properties: 150 name: 151 type: string 152 address: 153 type: string 154 additionalProperties: 155 type: array 156 items: 157 additionalProperties: true 158