File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
modules/swagger-parser/src/test Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -209,4 +209,24 @@ public void testIssue421() {
209
209
assertTrue (swagger .getDefinitions ().get ("Order" ) instanceof ModelImpl );
210
210
assertTrue (swagger .getDefinitions ().get ("Order" ).getProperties ().size () == 6 );
211
211
}
212
+
213
+ @ Test
214
+ public void testRelativeRefIssue421 () {
215
+ SwaggerDeserializationResult result = new SwaggerParser ().readWithInfo ("./src/test/resources/main.yaml" , null , true );
216
+ assertNotNull (result .getSwagger ());
217
+
218
+ Swagger swagger = result .getSwagger ();
219
+ assertNotNull (swagger );
220
+ assertNotNull (swagger .getPath ("pets" ));
221
+ assertNotNull (swagger .getPath ("pets" ).getGet ());
222
+ assertNotNull (swagger .getPath ("pets" ).getGet ().getResponses ());
223
+ assertNotNull (swagger .getPath ("pets" ).getGet ().getResponses ().get ("200" ));
224
+ assertNotNull (swagger .getPath ("pets" ).getGet ().getResponses ().get ("200" ).getSchema ());
225
+ assertTrue (swagger .getPath ("pets" ).getGet ().getResponses ().get ("200" ).getSchema () instanceof RefProperty );
226
+
227
+ assertEquals (((RefProperty )swagger .getPath ("pets" ).getGet ().getResponses ().get ("200" ).getSchema ()).get$ref (), "#/definitions/Pet" );
228
+
229
+ assertTrue (swagger .getDefinitions ().get ("Pet" ) instanceof ModelImpl );
230
+ assertTrue (swagger .getDefinitions ().get ("Pet" ).getProperties ().size () == 2 );
231
+ }
212
232
}
Original file line number Diff line number Diff line change
1
+ Pet :
2
+ type : object
3
+ properties :
4
+ name :
5
+ type : string
6
+ id :
7
+ type : integer
8
+ format : int64
Original file line number Diff line number Diff line change
1
+ swagger : ' 2.0'
2
+ info :
3
+ title : Tests
4
+ description : Tests
5
+ version : beta
6
+ host : ' myhost.com'
7
+ basePath : /testpath
8
+ schemes :
9
+ - http
10
+ paths :
11
+ pets :
12
+ get :
13
+ summary : null
14
+ description : null
15
+ operationId : list
16
+ responses :
17
+ ' 200 ' :
18
+ description : OK
19
+ schema :
20
+ $ref : ' Pet.yaml#/Pet'
You can’t perform that action at this time.
0 commit comments