File tree Expand file tree Collapse file tree 3 files changed +73
-0
lines changed
modules/swagger-parser-v3/src/test
java/io/swagger/v3/parser/test Expand file tree Collapse file tree 3 files changed +73
-0
lines changed Original file line number Diff line number Diff line change @@ -1323,6 +1323,17 @@ public void testIssue360() {
1323
1323
assertEquals (refModel .get$ref (), "#/components/schemas/Pet" );
1324
1324
}
1325
1325
1326
+ @ Test
1327
+ public void testRelativePath () {
1328
+ OpenAPIV3Parser parser = new OpenAPIV3Parser ();
1329
+ ParseOptions options = new ParseOptions ();
1330
+ options .setResolve (true );
1331
+ SwaggerParseResult readResult = parser .readLocation ("src/test/resources/relative-issue/api.yaml" , null , options );
1332
+ if (readResult .getMessages ().size () > 0 ) {
1333
+ fail (Json .pretty (readResult .getMessages ()));
1334
+ }
1335
+ }
1336
+
1326
1337
private OpenAPI doRelativeFileTest (String location ) {
1327
1338
OpenAPIV3Parser parser = new OpenAPIV3Parser ();
1328
1339
ParseOptions options = new ParseOptions ();
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.0
2
+ info :
3
+ version : ' 0.0.1'
4
+ title : ' Parser debug'
5
+ description : ' Parser debug'
6
+ paths :
7
+ /scans :
8
+ get :
9
+ responses :
10
+ 200 :
11
+ description : Yay
12
+ 500 :
13
+ $ref : ' ./subfolder/domain.yaml#/components/responses/ErrorResponse'
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.0
2
+
3
+ info :
4
+ title : My domain
5
+ description : My domain
6
+ version : ' 0.0.1'
7
+
8
+ paths : {}
9
+
10
+ components :
11
+ responses :
12
+ ErrorResponse :
13
+ description : An error has occurred
14
+ content :
15
+ application/json :
16
+ schema :
17
+ $ref : ' #/components/schemas/ErrorMessage'
18
+ schemas :
19
+ ErrorMessage :
20
+ type : object
21
+ required :
22
+ - timestamp
23
+ - path
24
+ - status
25
+ properties :
26
+ timestamp :
27
+ description : The timestamp of when the error occurred
28
+ type : string
29
+ format : date-time
30
+ path :
31
+ description : Requested path
32
+ type : string
33
+ status :
34
+ description : HTTP status code
35
+ type : integer
36
+ error :
37
+ description : HTTP response phrase
38
+ type : string
39
+ message :
40
+ description : Error message
41
+ type : string
42
+ requestId :
43
+ description : Internal request id
44
+ type : string
45
+ errors :
46
+ description : Detailed error descriptions
47
+ type : array
48
+ items :
49
+ type : object
You can’t perform that action at this time.
0 commit comments