@@ -193,6 +193,87 @@ func TestConvOpenAPIV2ToV3WithNestedAdditionalPropertiesSchemaRef(t *testing.T)
193193 require .Equal (t , "#/components/schemas/Foo" , responseSchema .AdditionalProperties .Schema .Value .AdditionalProperties .Schema .Ref )
194194}
195195
196+ func TestConvOpenAPIV2ToV3WithAllOfInsideAdditionalProperties (t * testing.T ) {
197+ v2 := []byte (`
198+ {
199+ "basePath": "/v2",
200+ "host": "test.example.com",
201+ "info": {
202+ "title": "MyAPI",
203+ "version": "0.1"
204+ },
205+ "paths": {
206+ "/v1/objStatus": {
207+ "get": {
208+ "produces": [
209+ "application/json"
210+ ],
211+ "responses": {
212+ "200": {
213+ "schema": {
214+ "type": "object",
215+ "properties": {
216+ "result": {
217+ "type": "object",
218+ "additionalProperties": {
219+ "type": "object",
220+ "allOf": [
221+ {
222+ "$ref": "#/definitions/ObjectInfo"
223+ }
224+ ],
225+ "additionalProperties": {
226+ "allOf": [
227+ {
228+ "$ref": "#/definitions/ObjectInfo"
229+ }
230+ ]
231+ }
232+ }
233+ }
234+ }
235+ },
236+ "description": "Success"
237+ }
238+ }
239+ }
240+ }
241+ },
242+ "definitions": {
243+ "ObjectInfo": {
244+ "type": "object",
245+ "properties": {
246+ "object_id": {
247+ "type": "string",
248+ "format": "uuid"
249+ }
250+ }
251+ }
252+ },
253+ "schemes": [
254+ "http"
255+ ],
256+ "swagger": "2.0"
257+ }
258+ ` )
259+
260+ var doc2 openapi2.T
261+ err := json .Unmarshal (v2 , & doc2 )
262+ require .NoError (t , err )
263+
264+ doc3 , err := ToV3 (& doc2 )
265+ require .NoError (t , err )
266+ err = doc3 .Validate (context .Background ())
267+ require .NoError (t , err )
268+
269+ responseSchema := doc3 .Paths .Value ("/v1/objStatus" ).Get .Responses .Value ("200" ).Value .Content .Get ("application/json" ).Schema .Value
270+ require .Equal (t , & openapi3.Types {"object" }, responseSchema .Type )
271+ resultSchema := responseSchema .Properties ["result" ].Value
272+ require .Equal (t , & openapi3.Types {"object" }, resultSchema .Type )
273+ require .Equal (t , "#/components/schemas/ObjectInfo" , resultSchema .AdditionalProperties .Schema .Value .AllOf [0 ].Ref )
274+ require .Equal (t , "#/components/schemas/ObjectInfo" , resultSchema .AdditionalProperties .Schema .Value .AdditionalProperties .Schema .Value .AllOf [0 ].Ref )
275+ }
276+
196277const exampleV2 = `
197278{
198279 "basePath": "/v2",
0 commit comments