@@ -75,8 +75,6 @@ func patchExpression(doc *openapi3.T) {
7575}
7676
7777func patchConditions (doc * openapi3.T ) {
78- patchConditionBase (doc )
79- patchConditionParams (doc )
8078 doc .Components .Schemas ["ConditionType" ] = & openapi3.SchemaRef {
8179 Value : & openapi3.Schema {
8280 Type : "string" ,
@@ -99,88 +97,47 @@ func patchConditions(doc *openapi3.T) {
9997 },
10098 },
10199 }
102- doc .Components .Schemas ["Condition " ] = & openapi3.SchemaRef {
100+ doc .Components .Schemas ["DRef " ] = & openapi3.SchemaRef {
103101 Value : & openapi3.Schema {
104102 Type : "object" ,
105103 Properties : map [string ]* openapi3.SchemaRef {
106- "condition" : {
107- Value : & openapi3.Schema {
108- Properties : map [string ]* openapi3.SchemaRef {
109- "base" : {Ref : "#/components/schemas/ConditionBase" },
110- "type" : {Ref : "#/components/schemas/ConditionType" },
111- "parameter" : {Ref : "#/components/schemas/ConditionParameter" },
112- },
113- },
114- },
115- },
116- },
117- }
118- }
119-
120- func patchConditionParams (doc * openapi3.T ) {
121- doc .Components .Schemas ["ConditionParameterString" ] = & openapi3.SchemaRef {
122- Value : & openapi3.Schema {
123- Properties : map [string ]* openapi3.SchemaRef {
124- "stringValue" : {Value : openapi3 .NewStringSchema ()},
125- },
126- },
127- }
128- doc .Components .Schemas ["ConditionParameterBoolean" ] = & openapi3.SchemaRef {
129- Value : & openapi3.Schema {
130- Properties : map [string ]* openapi3.SchemaRef {
131- "boolValue" : {Value : openapi3 .NewBoolSchema ()},
132- },
133- },
134- }
135- doc .Components .Schemas ["ConditionParameterInt" ] = & openapi3.SchemaRef {
136- Value : & openapi3.Schema {
137- Properties : map [string ]* openapi3.SchemaRef {
138- "intValue" : {Value : openapi3 .NewIntegerSchema ()},
104+ "src" : {Value : openapi3 .NewStringSchema ()},
105+ "dst" : {Value : openapi3 .NewStringSchema ()},
139106 },
140107 },
141108 }
142- doc .Components .Schemas ["ConditionParameterBytes " ] = & openapi3.SchemaRef {
109+ doc .Components .Schemas ["ConditionRef " ] = & openapi3.SchemaRef {
143110 Value : & openapi3.Schema {
111+ Type : "object" ,
144112 Properties : map [string ]* openapi3.SchemaRef {
145- "byteValue" : {Value : openapi3 .NewBytesSchema ()},
146- },
147- },
148- }
149- doc .Components .Schemas ["ConditionParameter" ] = & openapi3.SchemaRef {
150- Value : & openapi3.Schema {
151- OneOf : []* openapi3.SchemaRef {
152- {Ref : "#/components/schemas/ConditionParameterString" },
153- {Ref : "#/components/schemas/ConditionParameterBoolean" },
154- {Ref : "#/components/schemas/ConditionParameterInt" },
155- {Ref : "#/components/schemas/ConditionParameterBytes" },
113+ "ref" : {Ref : "#/components/schemas/DRef" },
114+ "type" : {Ref : "#/components/schemas/ConditionType" },
115+ "value" : {Value : openapi3 .NewBytesSchema ()},
156116 },
157117 },
158118 }
159- }
160-
161- func patchConditionBase (doc * openapi3.T ) {
162- doc .Components .Schemas ["ConditionBaseRef" ] = & openapi3.SchemaRef {
119+ doc .Components .Schemas ["ConditionKey" ] = & openapi3.SchemaRef {
163120 Value : & openapi3.Schema {
164121 Type : "object" ,
165122 Properties : map [string ]* openapi3.SchemaRef {
166- "src" : {Value : openapi3 .NewStringSchema ()},
167- "dst" : {Value : openapi3 .NewStringSchema ()},
123+ "key" : {Value : openapi3 .NewStringSchema ()},
124+ "type" : {Ref : "#/components/schemas/ConditionType" },
125+ "value" : {Value : openapi3 .NewBytesSchema ()},
168126 },
169127 },
170128 }
171- doc .Components .Schemas ["ConditionBaseKey " ] = & openapi3.SchemaRef {
129+ doc .Components .Schemas ["Condition " ] = & openapi3.SchemaRef {
172130 Value : & openapi3.Schema {
173131 Type : "object" ,
174132 Properties : map [string ]* openapi3.SchemaRef {
175- "key" : {Value : openapi3 .NewStringSchema ()},
176- },
177- },
178- }
179- doc .Components .Schemas ["ConditionBase" ] = & openapi3.SchemaRef {
180- Value : & openapi3.Schema {
181- OneOf : []* openapi3.SchemaRef {
182- {Ref : "#/components/schemas/ConditionBaseKey" },
183- {Ref : "#/components/schemas/ConditionBaseRef" },
133+ "condition" : {
134+ Value : & openapi3.Schema {
135+ OneOf : []* openapi3.SchemaRef {
136+ {Ref : "#/components/schemas/ConditionKey" },
137+ {Ref : "#/components/schemas/ConditionRef" },
138+ },
139+ },
140+ },
184141 },
185142 },
186143 }
0 commit comments