File tree 16 files changed +466
-1
lines changed
modules/swagger-parser-v3/src/test
java/io/swagger/v3/parser/test
connections/connection_id
16 files changed +466
-1
lines changed Original file line number Diff line number Diff line change @@ -1953,6 +1953,21 @@ public void testRelativePath2() {
1953
1953
Assert .assertEquals (readResult .getOpenAPI ().getPaths ().get ("/pet/findByTags" ).getGet ().getResponses ().get ("default" ).getContent ().get ("application/json" ).getSchema ().get$ref (), "#/components/schemas/ErrorModel" );
1954
1954
}
1955
1955
1956
+ @ Test
1957
+ public void testExternalRefsNormalization () throws Exception {
1958
+ ParseOptions options = new ParseOptions ();
1959
+ options .setResolve (true );
1960
+ SwaggerParseResult result = new OpenAPIV3Parser ()
1961
+ .readLocation ("src/test/resources/oas3.fetched/openapi3.yaml" , null , options );
1962
+
1963
+ OpenAPI openAPI = result .getOpenAPI ();
1964
+ Schema originalModel = openAPI .getComponents ().getSchemas ().get ("Event" );
1965
+ Schema duplicateModel = openAPI .getComponents ().getSchemas ().get ("Event_1" );
1966
+ System .out .println ("component schemas found: " + openAPI .getComponents ().getSchemas ().keySet ());
1967
+ assertNull (duplicateModel );
1968
+ assertNotNull (originalModel );
1969
+ }
1970
+
1956
1971
private OpenAPI doRelativeFileTest (String location ) {
1957
1972
OpenAPIV3Parser parser = new OpenAPIV3Parser ();
1958
1973
ParseOptions options = new ParseOptions ();
@@ -3298,4 +3313,4 @@ public void testIssue2081() {
3298
3313
assertEquals (openAPI .getComponents ().getSchemas ().get ("PetCreate" ).getRequired ().size (), 1 );
3299
3314
assertEquals (openAPI .getComponents ().getSchemas ().get ("PetCreate" ).getProperties ().size (), 2 );
3300
3315
}
3301
- }
3316
+ }
Original file line number Diff line number Diff line change
1
+ description : Error responses are included with 4xx and 5xx HTTP responses from the
2
+ API service. Either "error" or "errors" will be set.
3
+ properties :
4
+ error :
5
+ description : A description of the error that caused the request to fail.
6
+ type : string
7
+ errors :
8
+ description : A list of errors that contributed to the request failing.
9
+ items :
10
+ description : An error message that contributed to the request failing.
11
+ type : string
12
+ type : array
13
+ type : object
Original file line number Diff line number Diff line change
1
+ properties :
2
+ body :
3
+ type : string
4
+ created_at :
5
+ format : date-time
6
+ type : string
7
+ href :
8
+ type : string
9
+ id :
10
+ format : uuid
11
+ type : string
12
+ interpolated :
13
+ type : string
14
+ relationships :
15
+ items :
16
+ $ref : ' ./Href.yaml'
17
+ type : array
18
+ state :
19
+ type : string
20
+ type :
21
+ type : string
22
+ modified_by :
23
+ type : object
24
+ ip :
25
+ type : string
26
+ type : object
Original file line number Diff line number Diff line change
1
+ properties :
2
+ events :
3
+ items :
4
+ $ref : ' ./Event.yaml'
5
+ type : array
6
+ meta :
7
+ $ref : ' ./Meta.yaml'
8
+ type : object
Original file line number Diff line number Diff line change
1
+ properties :
2
+ href :
3
+ type : string
4
+ required :
5
+ - href
6
+ type : object
Original file line number Diff line number Diff line change
1
+ properties :
2
+ first :
3
+ $ref : ' ./Href.yaml'
4
+ last :
5
+ $ref : ' ./Href.yaml'
6
+ next :
7
+ $ref : ' ./Href.yaml'
8
+ previous :
9
+ $ref : ' ./Href.yaml'
10
+ self :
11
+ $ref : ' ./Href.yaml'
12
+ total :
13
+ type : integer
14
+ current_page :
15
+ type : integer
16
+ last_page :
17
+ type : integer
18
+ type : object
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.0
2
+ info :
3
+ version : 1.0.0
4
+ title : Example Duplicate Refs API
5
+ contact :
6
+
7
+ name : Example API Team
8
+ description : |
9
+ Sample API spec to validate handling of different file paths that reference the same file
10
+ license :
11
+ name : Equinix Metal
12
+ url : https://metal.equinix.com/legal/
13
+ termsOfService : https://metal.equinix.com/legal/
14
+ servers :
15
+ - url : https://api.example.com/duplicateRefs
16
+ components :
17
+ schemas :
18
+ Error :
19
+ $ref : " ./components/schemas/Error.yaml"
20
+ Event :
21
+ $ref : " ./components/schemas/Event.yaml"
22
+ EventList :
23
+ $ref : " ./components/schemas/EventList.yaml"
24
+ paths :
25
+ /connections/{connection_id}/ports/{id}/events :
26
+ $ref : ./paths/connections/connection_id/ports/id/events.yaml
27
+ /devices/{id}/events :
28
+ $ref : ./paths/devices/id/events.yaml
29
+ /events :
30
+ $ref : ./paths/events.yaml
31
+ /events/{id} :
32
+ $ref : ./paths/events/id.yaml
33
+ /organizations/{id}/events :
34
+ $ref : ./paths/organizations/id/events.yaml
35
+ /projects/{id}/events :
36
+ $ref : ./paths/projects/id/events.yaml
37
+ /routes/{id}/events :
38
+ $ref : ./paths/routes/id/events.yaml
39
+ /virtual-circuits/{id}/events :
40
+ $ref : ./paths/virtual-circuits/id/events.yaml
Original file line number Diff line number Diff line change
1
+ get :
2
+ description : Returns a list of the interconnection events
3
+ operationId : findInterconnectionEvents
4
+ parameters :
5
+ - description : Interconnection UUID
6
+ in : path
7
+ name : connection_id
8
+ required : true
9
+ schema :
10
+ format : uuid
11
+ type : string
12
+ responses :
13
+ " 200 " :
14
+ content :
15
+ application/json :
16
+ schema :
17
+ $ref : " ../../../components/schemas/EventList.yaml"
18
+ description : ok
19
+ " 401 " :
20
+ content :
21
+ application/json :
22
+ schema :
23
+ $ref : " ../../../components/schemas/Error.yaml"
24
+ description : unauthorized
25
+ " 403 " :
26
+ content :
27
+ application/json :
28
+ schema :
29
+ $ref : " ../../../components/schemas/Error.yaml"
30
+ description : forbidden
31
+ " 404 " :
32
+ content :
33
+ application/json :
34
+ schema :
35
+ $ref : " ../../../components/schemas/Error.yaml"
36
+ description : not found
37
+ summary : Retrieve interconnection events
38
+ tags :
39
+ - Events
Original file line number Diff line number Diff line change
1
+ get :
2
+ description : Returns a list of the interconnection port events
3
+ operationId : findInterconnectionPortEvents
4
+ parameters :
5
+ - description : Interconnection UUID
6
+ in : path
7
+ name : connection_id
8
+ required : true
9
+ schema :
10
+ format : uuid
11
+ type : string
12
+ - description : Interconnection Port UUID
13
+ in : path
14
+ name : id
15
+ required : true
16
+ schema :
17
+ format : uuid
18
+ type : string
19
+ responses :
20
+ " 200 " :
21
+ content :
22
+ application/json :
23
+ schema :
24
+ $ref : " ../../../../../components/schemas/Event.yaml"
25
+ description : ok
26
+ " 401 " :
27
+ content :
28
+ application/json :
29
+ schema :
30
+ $ref : " ../../../../../components/schemas/Error.yaml"
31
+ description : unauthorized
32
+ " 403 " :
33
+ content :
34
+ application/json :
35
+ schema :
36
+ $ref : " ../../../../../components/schemas/Error.yaml"
37
+ description : forbidden
38
+ " 404 " :
39
+ content :
40
+ application/json :
41
+ schema :
42
+ $ref : " ../../../../../components/schemas/Error.yaml"
43
+ description : not found
44
+ summary : Retrieve interconnection port events
45
+ tags :
46
+ - Events
Original file line number Diff line number Diff line change
1
+ get :
2
+ description : Returns a list of events pertaining to a specific device
3
+ operationId : findDeviceEvents
4
+ parameters :
5
+ - description : Device UUID
6
+ in : path
7
+ name : id
8
+ required : true
9
+ schema :
10
+ format : uuid
11
+ type : string
12
+ responses :
13
+ " 200 " :
14
+ content :
15
+ application/json :
16
+ schema :
17
+ $ref : " ../../../components/schemas/EventList.yaml"
18
+ description : ok
19
+ " 401 " :
20
+ content :
21
+ application/json :
22
+ schema :
23
+ $ref : " ../../../components/schemas/Error.yaml"
24
+ description : unauthorized
25
+ " 403 " :
26
+ content :
27
+ application/json :
28
+ schema :
29
+ $ref : " ../../../components/schemas/Error.yaml"
30
+ description : forbidden
31
+ " 404 " :
32
+ content :
33
+ application/json :
34
+ schema :
35
+ $ref : " ../../../components/schemas/Error.yaml"
36
+ description : not found
37
+ summary : Retrieve device's events
38
+ tags :
39
+ - Events
Original file line number Diff line number Diff line change
1
+ get :
2
+ description : Returns a list of the current user’s events
3
+ operationId : findEvents
4
+ parameters :
5
+ responses :
6
+ " 200 " :
7
+ content :
8
+ application/json :
9
+ schema :
10
+ $ref : " ../components/schemas/EventList.yaml"
11
+ description : ok
12
+ " 401 " :
13
+ content :
14
+ application/json :
15
+ schema :
16
+ $ref : " ../components/schemas/Error.yaml"
17
+ description : unauthorized
18
+ summary : Retrieve current user's events
19
+ tags :
20
+ - Events
Original file line number Diff line number Diff line change
1
+ get :
2
+ description : Returns a single event if the user has access
3
+ operationId : findEventById
4
+ parameters :
5
+ - description : Event UUID
6
+ in : path
7
+ name : id
8
+ required : true
9
+ schema :
10
+ format : uuid
11
+ type : string
12
+ responses :
13
+ " 200 " :
14
+ content :
15
+ application/json :
16
+ schema :
17
+ $ref : " ../../components/schemas/Event.yaml"
18
+ description : ok
19
+ " 401 " :
20
+ content :
21
+ application/json :
22
+ schema :
23
+ $ref : " ../../components/schemas/Error.yaml"
24
+ description : unauthorized
25
+ " 403 " :
26
+ content :
27
+ application/json :
28
+ schema :
29
+ $ref : " ../../components/schemas/Error.yaml"
30
+ description : forbidden
31
+ " 404 " :
32
+ content :
33
+ application/json :
34
+ schema :
35
+ $ref : " ../../components/schemas/Error.yaml"
36
+ description : not found
37
+ summary : Retrieve an event
38
+ tags :
39
+ - Events
Original file line number Diff line number Diff line change
1
+ get :
2
+ description : Returns a list of events for a single organization
3
+ operationId : findOrganizationEvents
4
+ parameters :
5
+ - description : Organization UUID
6
+ in : path
7
+ name : id
8
+ required : true
9
+ schema :
10
+ format : uuid
11
+ type : string
12
+ responses :
13
+ " 200 " :
14
+ content :
15
+ application/json :
16
+ schema :
17
+ $ref : " ../../../components/schemas/EventList.yaml"
18
+ description : ok
19
+ " 401 " :
20
+ content :
21
+ application/json :
22
+ schema :
23
+ $ref : " ../../../components/schemas/Error.yaml"
24
+ description : unauthorized
25
+ " 403 " :
26
+ content :
27
+ application/json :
28
+ schema :
29
+ $ref : " ../../../components/schemas/Error.yaml"
30
+ description : forbidden
31
+ " 404 " :
32
+ content :
33
+ application/json :
34
+ schema :
35
+ $ref : " ../../../components/schemas/Error.yaml"
36
+ description : not found
37
+ summary : Retrieve organization's events
38
+ tags :
39
+ - Events
You can’t perform that action at this time.
0 commit comments