File tree Expand file tree Collapse file tree 2 files changed +49
-2
lines changed
modules/swagger-parser/src
main/java/io/swagger/parser/util
test/java/io/swagger/parser/util Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -831,8 +831,6 @@ else if(!SCHEMA_KEYS.contains(key)) {
831831 result .extra (location , key , node .get (key ));
832832 }
833833 }
834- if ("{ }" .equals (Json .pretty (impl )))
835- return null ;
836834 model = impl ;
837835 }
838836 JsonNode exampleNode = node .get ("example" );
Original file line number Diff line number Diff line change 2424import static org .junit .Assert .*;
2525
2626public class SwaggerDeserializerTest {
27+
28+
29+ @ Test
30+ public void testEmptyDefinitions () throws Exception {
31+ String yaml = "swagger: \" 2.0\" \n " +
32+ "info:\n " +
33+ " version: \" 1.0\" \n " +
34+ " title: \" dd\" \n " +
35+ "host: \" abc:5555\" \n " +
36+ "basePath: \" /mypath\" \n " +
37+ "schemes:\n " +
38+ "- \" http\" \n " +
39+ "consumes:\n " +
40+ "- \" application/json\" \n " +
41+ "produces:\n " +
42+ "- \" application/json\" \n " +
43+ "paths:\n " +
44+ " /resource1/Id:\n " +
45+ " post:\n " +
46+ " description: \" \" \n " +
47+ " operationId: \" postOp\" \n " +
48+ " parameters:\n " +
49+ " - in: \" body\" \n " +
50+ " name: \" input3\" \n " +
51+ " description: \" \" \n " +
52+ " required: true\n " +
53+ " schema:\n " +
54+ " $ref: \" #/definitions/mydefinition\" \n " +
55+ " responses:\n " +
56+ " 200:\n " +
57+ " description: \" Successful\" \n " +
58+ " 401:\n " +
59+ " description: \" Access Denied\" \n " +
60+ "definitions:\n " +
61+ " mydefinition: {}" ;
62+
63+ SwaggerParser parser = new SwaggerParser ();
64+
65+ SwaggerDeserializationResult result = parser .readWithInfo (yaml );
66+ List <String > messageList = result .getMessages ();
67+ Set <String > messages = new HashSet <String >(messageList );
68+ Swagger swagger = result .getSwagger ();
69+ assertNotNull (swagger );
70+ assertNotNull (swagger .getDefinitions ().get ("mydefinition" ));
71+
72+
73+ }
74+
75+
2776 @ Test
2877 public void testSecurityDeserialization () throws Exception {
2978 String json = "{\n " +
You can’t perform that action at this time.
0 commit comments