File tree 2 files changed +40
-0
lines changed
modules/swagger-parser/src/test/java/io/swagger/parser/util 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -1419,4 +1419,39 @@ public void testIssue360() {
1419
1419
Swagger rebuilt = result .getSwagger ();
1420
1420
assertNotNull (rebuilt );
1421
1421
}
1422
+
1423
+ @ Test (description = "it should deserialize untyped additionalProperties" )
1424
+ public void testUntypedAdditionalProperties () {
1425
+ String json = "{\n " +
1426
+ " \" paths\" : {\n " +
1427
+ " \" /store/inventory\" : {\n " +
1428
+ " \" get\" : {\n " +
1429
+ " \" responses\" : {\n " +
1430
+ " \" 200\" : {\n " +
1431
+ " \" description\" : \" successful operation\" ,\n " +
1432
+ " \" schema\" : {\n " +
1433
+ " \" type\" : \" object\" ,\n " +
1434
+ " \" description\" : \" map of anything\" ,\n " +
1435
+ " \" additionalProperties\" : {}\n " +
1436
+ " }\n " +
1437
+ " }\n " +
1438
+ " }\n " +
1439
+ " }\n " +
1440
+ " }\n " +
1441
+ " }\n " +
1442
+ "}" ;
1443
+
1444
+ SwaggerParser parser = new SwaggerParser ();
1445
+
1446
+ SwaggerDeserializationResult result = parser .readWithInfo (json );
1447
+ List <String > messageList = result .getMessages ();
1448
+ Set <String > messages = new HashSet <String >(messageList );
1449
+ Swagger swagger = result .getSwagger ();
1450
+
1451
+ Property response = swagger .getPath ("/store/inventory" ).getGet ().getResponses ().get ("200" ).getSchema ();
1452
+ assertTrue (response instanceof MapProperty );
1453
+ Property additionalProperties = ((MapProperty ) response ).getAdditionalProperties ();
1454
+ assertTrue (additionalProperties instanceof UntypedProperty );
1455
+ assertEquals (additionalProperties .getType (), null );
1456
+ }
1422
1457
}
Original file line number Diff line number Diff line change 197
197
<artifactId >swagger-core</artifactId >
198
198
<version >${swagger-core-version} </version >
199
199
</dependency >
200
+ <dependency >
201
+ <groupId >io.swagger</groupId >
202
+ <artifactId >swagger-models</artifactId >
203
+ <version >${swagger-core-version} </version >
204
+ </dependency >
200
205
<dependency >
201
206
<groupId >org.testng</groupId >
202
207
<artifactId >testng</artifactId >
You can’t perform that action at this time.
0 commit comments