@@ -284,8 +284,6 @@ public void testIssue811_RefSchema_ToRefSchema() {
284284
285285 Assert .assertNotNull (openAPI );
286286 Assert .assertEquals (openAPI .getPaths ().get ("/" ).getGet ().getResponses ().get ("200" ).getContent ().get ("application/json" ).getSchema ().get$ref (),"#/components/schemas/schema-with-reference" );
287-
288-
289287 }
290288
291289 @ Test
@@ -295,7 +293,6 @@ public void testIssue811() {
295293 final OpenAPI openAPI = new OpenAPIV3Parser ().readLocation ("oapi-reference-test/index.yaml" , null , options ).getOpenAPI ();
296294
297295 Assert .assertNotNull (openAPI );
298-
299296 Assert .assertEquals (openAPI .getPaths ().get ("/" ).getGet ().getResponses ().get ("200" ).getContent ().get ("application/json" ).getSchema ().get$ref (),"#/components/schemas/schema-with-reference" );
300297
301298 }
@@ -305,7 +302,6 @@ public void testIssue719() {
305302 final OpenAPI openAPI = new OpenAPIV3Parser ().readLocation ("extensions-responses.yaml" , null , new ParseOptions ()).getOpenAPI ();
306303
307304 Assert .assertNotNull (openAPI );
308-
309305 Assert .assertNotNull (openAPI .getPaths ().getExtensions ());
310306 Assert .assertNotNull (openAPI .getPaths ().get ("/something" ).getGet ().getResponses ().getExtensions ());
311307
@@ -492,8 +488,6 @@ public void test30(@Injectable final List<AuthorizationValue> auths) throws Exce
492488
493489 @ Test
494490 public void testResolveFully () throws Exception {
495-
496-
497491 String pathFile = FileUtils .readFileToString (new File ("src/test/resources/oas3.yaml.template" ));
498492 pathFile = pathFile .replace ("${dynamicPort}" , String .valueOf (this .serverPort ));
499493 ParseOptions options = new ParseOptions ();
@@ -507,6 +501,8 @@ public void testResolveFully() throws Exception{
507501 assertEquals (result .getOpenAPI ().getComponents ().getSchemas ().get ("OrderRef" ).getType (),"object" );
508502 }
509503
504+
505+
510506 @ Test
511507 public void testResolveEmpty (@ Injectable final List <AuthorizationValue > auths ) throws Exception {
512508 String pathFile = FileUtils .readFileToString (new File ("src/test/resources/empty-oas.yaml" ));
@@ -521,12 +517,9 @@ public void testResolveEmpty(@Injectable final List<AuthorizationValue> auths) t
521517
522518 @ Test
523519 public void testResolveFullyExample () throws Exception {
524-
525-
526520 String pathFile = FileUtils .readFileToString (new File ("src/test/resources/oas3.yaml.template" ));
527521 pathFile = pathFile .replace ("${dynamicPort}" , String .valueOf (this .serverPort ));
528522 ParseOptions options = new ParseOptions ();
529- //options.setResolve(true);
530523 options .setResolveFully (true );
531524
532525 SwaggerParseResult result = new OpenAPIV3Parser ().readContents (pathFile , new ArrayList <>(), options );
@@ -567,10 +560,25 @@ public void testInlineModelResolver(@Injectable final List<AuthorizationValue> a
567560 }
568561
569562 @ Test
570- public void test30NoOptions (@ Injectable final List <AuthorizationValue > auths ) throws Exception {
563+ public void testRemotePathItemIssue1103 (@ Injectable final List <AuthorizationValue > auths ) throws Exception {
564+ OpenAPI result = new OpenAPIV3Parser ().read ("issue-1103/remote-pathItem-swagger.yaml" );
565+ Assert .assertNotNull (result );
566+ Assert .assertNotNull (result .getPaths ().get ("/Translation/{lang}" ));
567+ Assert .assertEquals (result .getPaths ().get ("/Translation/{lang}" ).getPut ().getParameters ().get (0 ).getName (), "lang" );
568+ }
569+
570+
571571
572+ @ Test
573+ public void testRemoteParameterIssue1103 (@ Injectable final List <AuthorizationValue > auths ) throws Exception {
574+ OpenAPI result = new OpenAPIV3Parser ().read ("issue-1103/remote-parameter-swagger.yaml" );
575+ Assert .assertNotNull (result );
576+ Assert .assertEquals (result .getPaths ().get ("/Translation/{lang}" ).getPut ().getParameters ().get (0 ).getName (), "lang" );
572577
578+ }
573579
580+ @ Test
581+ public void test30NoOptions (@ Injectable final List <AuthorizationValue > auths ) throws Exception {
574582 String pathFile = FileUtils .readFileToString (new File ("src/test/resources/oas3.yaml.template" ));
575583 pathFile = pathFile .replace ("${dynamicPort}" , String .valueOf (this .serverPort ));
576584
@@ -584,7 +592,6 @@ public void test30NoOptions(@Injectable final List<AuthorizationValue> auths) th
584592
585593 @ Test
586594 public void testShellMethod (@ Injectable final List <AuthorizationValue > auths ){
587-
588595 String url = "http://localhost:${dynamicPort}/remote/spec" ;
589596 url = url .replace ("${dynamicPort}" , String .valueOf (this .serverPort ));
590597
@@ -595,7 +602,6 @@ public void testShellMethod(@Injectable final List<AuthorizationValue> auths){
595602
596603 @ Test
597604 public void testInlineModelResolverByUrl (){
598-
599605 String url = "http://localhost:${dynamicPort}/remote/json" ;
600606 url = url .replace ("${dynamicPort}" , String .valueOf (this .serverPort ));
601607
@@ -619,6 +625,13 @@ public void testInlineModelResolverByUrl(){
619625 assertNotNull (userAddress .getProperties ().get ("street" ));
620626 }
621627
628+ @ Test
629+ public void testIssue1105 () throws Exception {
630+ OpenAPI openAPI = new OpenAPIV3Parser ().read ("issue-1105/swagger-api.yaml" );
631+ Assert .assertNotNull (openAPI );
632+ Assert .assertNotNull (openAPI .getComponents ().getSchemas ().get ("ErrorCodeDescription" ));
633+ }
634+
622635 @ Test
623636 public void testRefAdditionalProperties () throws Exception {
624637 OpenAPI openAPI = new OpenAPIV3Parser ().read ("src/test/resources/relative/additionalProperties.yaml" );
@@ -669,7 +682,6 @@ public void testComposedSchemaAdjacent(@Injectable final List<AuthorizationValue
669682 OpenAPI openAPI = new OpenAPIV3Parser ().read ("src/test/resources/composedSchemaRef.yaml" , auths , options );
670683
671684 Assert .assertNotNull (openAPI );
672-
673685 Assert .assertTrue (openAPI .getComponents ().getSchemas ().size () == 5 );
674686 Schema schema = openAPI .getPaths ().get ("/path" ).getGet ().getResponses ().get ("200" ).getContent ().get ("application/json" ).getSchema ();
675687 Assert .assertTrue (schema instanceof ComposedSchema );
@@ -712,9 +724,7 @@ public void testRefPaths() throws Exception {
712724 " $ref: '#/paths/~1foo'" ;
713725
714726 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
715-
716727 OpenAPI openAPI = (parser .readContents (yaml ,null ,null )).getOpenAPI ();
717-
718728 assertEquals (openAPI .getPaths ().get ("foo" ),openAPI .getPaths ().get ("foo2" ));
719729
720730
@@ -742,7 +752,6 @@ public void testModelParameters() throws Exception {
742752 " description: ok" ;
743753
744754 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
745-
746755 OpenAPI openAPI = (parser .readContents (yaml ,null ,null )).getOpenAPI ();
747756
748757 }
@@ -890,7 +899,6 @@ public void testUniqueParameters() throws Exception {
890899 @ Test
891900 public void testLoadRelativeFileTree_Json () throws Exception {
892901 final OpenAPI openAPI = doRelativeFileTest ("src/test/resources/relative-file-references/json/parent.json" );
893- //Json.mapper().writerWithDefaultPrettyPrinter().writeValue(new File("resolved.json"), openAPI);
894902 }
895903
896904 @ Test
@@ -1003,7 +1011,6 @@ public void testIssue75() {
10031011
10041012 assertNotNull (model );
10051013 assertTrue (model instanceof ArraySchema );
1006-
10071014 ArraySchema am = (ArraySchema ) model ;
10081015 assertTrue (am .getItems () instanceof ByteArraySchema );
10091016 assertEquals (am .getItems ().getFormat (), "byte" );
@@ -1013,7 +1020,6 @@ public void testIssue75() {
10131020 public void testIssue62 () {
10141021 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
10151022 final OpenAPI openAPI = parser .read ("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/fixtures/v2.0/json/resources/resourceWithLinkedDefinitions.json" );
1016-
10171023 assertNotNull (openAPI .getPaths ().get ("/pets/{petId}" ).getGet ());
10181024 }
10191025
@@ -1032,7 +1038,6 @@ public void testParameterRequired() {
10321038 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
10331039 final OpenAPI openAPI = parser .read ("src/test/resources/petstore.yaml" );
10341040 final List <Parameter > operationParams = openAPI .getPaths ().get ("/pet/{petId}" ).getPost ().getParameters ();
1035-
10361041 final PathParameter pathParameter = (PathParameter ) operationParams .get (0 );
10371042 Assert .assertTrue (pathParameter .getRequired ());
10381043 }
@@ -1041,7 +1046,6 @@ public void testParameterRequired() {
10411046 public void testIssue108 () {
10421047 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
10431048 final OpenAPI openAPI = parser .read ("src/test/resources/issue_108.yaml" );
1044-
10451049 assertNotNull (openAPI );
10461050 }
10471051
@@ -1110,15 +1114,13 @@ public void testIssue292WithCSVCollectionFormat() {
11101114 @ Test
11111115 public void testIssue255 () {
11121116 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
1113-
11141117 OpenAPI openAPI = parser .read ("objectExample.yaml" );
11151118 assertEquals (openAPI .getComponents ().getSchemas ().get ("SamplePayload" ).getExample ().toString (), "[{\" op\" :\" replace\" ,\" path\" :\" /s\" ,\" v\" :\" w\" }]" );
11161119 }
11171120
11181121 @ Test
11191122 public void testIssue286 () {
11201123 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
1121-
11221124 OpenAPI openAPI = parser .read ("issue_286.yaml" );
11231125 Schema response = openAPI .getPaths ().get ("/" ).getGet ().getResponses ().get ("200" ).getContent ().get ("*/*" ).getSchema ();
11241126 assertTrue (response .get$ref () != null );
@@ -1164,15 +1166,10 @@ public void testIssue360() {
11641166
11651167 assertEquals (sbpModel .getType (), "string" );
11661168 assertEquals (sbpModel .getFormat (), "uuid" );
1167-
11681169 RequestBody bodyParameter = openAPI .getPaths ().get ("/evenMorePets" ).getPost ().getRequestBody ();
1169-
11701170 assertTrue (bodyParameter .getRequired ());
1171-
11721171 Schema refModel = bodyParameter .getContent ().get ("application/json" ).getSchema ();
11731172 assertTrue (refModel .get$ref () != null );
1174-
1175-
11761173 assertEquals (refModel .get$ref (), "#/components/schemas/Pet" );
11771174 }
11781175
@@ -1186,10 +1183,7 @@ private OpenAPI doRelativeFileTest(String location) {
11861183 Json .prettyPrint (readResult .getMessages ());
11871184 }
11881185 final OpenAPI openAPI = readResult .getOpenAPI ();
1189-
1190-
11911186 final PathItem path = openAPI .getPaths ().get ("/health" );
1192-
11931187 assertEquals (path .getClass (), PathItem .class ); //we successfully converted the RefPath to a Path
11941188
11951189 final List <Parameter > parameters = path .getParameters ();
@@ -1201,7 +1195,6 @@ private OpenAPI doRelativeFileTest(String location) {
12011195 assertParamDetails (operationParams , 0 , PathParameter .class , "param3" , "path" );
12021196 assertParamDetails (operationParams , 1 , HeaderParameter .class , "param4" , "header" );
12031197
1204-
12051198 final Map <String , ApiResponse > responsesMap = operation .getResponses ();
12061199
12071200 assertResponse (openAPI , responsesMap , "200" ,"application/json" , "Health information from the server" , "#/components/schemas/health" );
0 commit comments