This repository was archived by the owner on Nov 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
modules/swagger-parser-v3/src
main/java/io/swagger/v3/parser/util
java/io/swagger/v3/parser/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424import java .util .ArrayList ;
2525import java .util .HashMap ;
2626import java .util .HashSet ;
27+ import java .util .IdentityHashMap ;
2728import java .util .LinkedHashMap ;
2829import java .util .List ;
2930import java .util .Map ;
@@ -56,7 +57,7 @@ public ResolverFully(boolean aggregateCombinators) {
5657 private Map <String , RequestBody > requestBodies ;
5758 private Map <String , Header > headers ;
5859 private Map <String , Link > links ;
59- private Map <String , Schema > resolvedProperties = new HashMap <>();
60+ private Map <String , Schema > resolvedProperties = new IdentityHashMap <>();
6061
6162 public void resolveFully (OpenAPI openAPI ) {
6263 Components components = openAPI .getComponents ();
Original file line number Diff line number Diff line change 88import com .github .tomakehurst .wiremock .client .WireMock ;
99import com .github .tomakehurst .wiremock .core .WireMockConfiguration ;
1010import io .swagger .v3 .core .util .Json ;
11- import io .swagger .v3 .core .util .Yaml ;
1211import io .swagger .v3 .oas .models .Components ;
1312import io .swagger .v3 .oas .models .OpenAPI ;
1413import io .swagger .v3 .oas .models .Operation ;
@@ -1165,6 +1164,23 @@ public void recursiveResolving2() {
11651164 }
11661165 }
11671166
1167+ @ Test
1168+ public void recursiveIssue984 () {
1169+ ParseOptions parseOptions = new ParseOptions ();
1170+ parseOptions .setResolve (true );
1171+ parseOptions .setResolveFully (true );
1172+ OpenAPI openAPI = new OpenAPIV3Parser ().read ("issue-984-simple.yaml" , null , parseOptions );
1173+ if (openAPI == null ) fail ("failed parsing issue-984" );
1174+ try {
1175+ Json .pretty (openAPI );
1176+ //System.out.println(Json.pretty(openAPI));
1177+ }
1178+ catch (Exception e ) {
1179+ e .printStackTrace ();
1180+ fail ("Recursive loop found" );
1181+ }
1182+ }
1183+
11681184 @ Test
11691185 public void propertyNameMixup () {
11701186 ParseOptions parseOptions = new ParseOptions ();
Original file line number Diff line number Diff line change 1+ openapi : 3.0.0
2+ info :
3+ description : test
4+ version : " 1.0"
5+ title : test
6+ paths :
7+ /cu :
8+ post :
9+ operationId : savecu
10+ responses :
11+ " 200 " :
12+ description : successful operation
13+ content :
14+ application/json :
15+ schema :
16+ $ref : " #/components/schemas/AbTestFoo"
17+ " /bar " :
18+ put :
19+ operationId : updateBar
20+ responses :
21+ " 200 " :
22+ description : successful operation
23+ content :
24+ application/json :
25+ schema :
26+ $ref : " #/components/schemas/CoTestBar"
27+ servers :
28+ - url : /foo/bar
29+ components :
30+ schemas :
31+ Thing :
32+ type : object
33+ properties :
34+ moreThings :
35+ type : array
36+ uniqueItems : true
37+ items :
38+ $ref : " #/components/schemas/ThingAs"
39+ ThingAs :
40+ type : object
41+ properties :
42+ concept :
43+ $ref : " #/components/schemas/Thing"
44+ AbTestFoo :
45+ type : object
46+ properties :
47+ moreThings :
48+ type : array
49+ uniqueItems : true
50+ items :
51+ $ref : " #/components/schemas/ThingAs"
52+ readOnly : true
53+ CoTestBar :
54+ allOf :
55+ - $ref : " #/components/schemas/Thing"
You can’t perform that action at this time.
0 commit comments