4343public class OpenAPIV3ParserTest {
4444 List <AuthorizationValue > auths = new ArrayList <>();
4545
46+ @ Test (description = "Issue 2223: reading 3.1 spec from Windows file path location produces URISyntaxException" )
47+ public void testWindowsFilePathRead () {
48+ OpenAPIV3Parser openApiParser = new OpenAPIV3Parser ();
49+ OpenAPI openAPI = openApiParser .read ("\\ issue-2223\\ openapi.yaml" );
50+ assertNotNull (openAPI , "OpenAPI object should not be null (no errors during read())" );
51+ }
52+
4653 @ Test
4754 public void testFailedToResolveResponseReferences () {
4855 OpenAPIV3Parser openApiParser = new OpenAPIV3Parser ();
@@ -51,7 +58,7 @@ public void testFailedToResolveResponseReferences() {
5158 SwaggerParseResult parseResult = openApiParser .readLocation ("issue-2037/openapi.yaml" , null , options );
5259 OpenAPI openAPI = parseResult .getOpenAPI ();
5360
54- Assert . assertTrue (openAPI .getPaths ().get ("/get" ).get$ref () == null );
61+ assertNull (openAPI .getPaths ().get ("/get" ).get$ref ());
5562 Assert .assertEquals (openAPI .getPaths ().get ("/get" ).getGet ().getResponses ().get ("200" ).getContent ().get ("application/json" ).getSchema ().get$ref (), "#/components/schemas/ResponsesRef" );
5663 }
5764
@@ -64,13 +71,13 @@ public void testFailedToResolveExternalReferences() {
6471 SwaggerParseResult parseResult = openApiParser .readLocation ("resolve-external-ref/failedToResolveExternalRefs.yaml" , null , options );
6572 OpenAPI openAPI = parseResult .getOpenAPI ();
6673
67- Assert . assertTrue (openAPI .getPaths ().get ("/permAssignments" ).get$ref () == null );
68- Assert . assertEquals (openAPI .getPaths ().get ("/permAssignments" ).getGet ().getResponses ().get ("202" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/schemaResponseSuccess" );
69- Assert . assertTrue (openAPI .getPaths ().get ("/permAssignmentChangeRequests" ).get$ref () == null );
70- Assert . assertEquals (openAPI .getPaths ().get ("/permAssignmentChangeRequests" ).getGet ().getResponses ().get ("202" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/schemaResponseSuccess" );
71- Assert . assertTrue (openAPI .getPaths ().get ("/permAssignmentChange" ).get$ref () == null );
72- Assert . assertEquals (openAPI .getPaths ().get ("/permAssignmentChange" ).getGet ().getResponses ().get ("201" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/Error" );
73- Assert . assertEquals (openAPI .getPaths ().get ("/permAssignmentChange" ).getGet ().getResponses ().get ("404" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/RemoteError" );
74+ assertNull (openAPI .getPaths ().get ("/permAssignments" ).get$ref ());
75+ assertEquals (openAPI .getPaths ().get ("/permAssignments" ).getGet ().getResponses ().get ("202" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/schemaResponseSuccess" );
76+ assertNull (openAPI .getPaths ().get ("/permAssignmentChangeRequests" ).get$ref ());
77+ assertEquals (openAPI .getPaths ().get ("/permAssignmentChangeRequests" ).getGet ().getResponses ().get ("202" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/schemaResponseSuccess" );
78+ assertNull (openAPI .getPaths ().get ("/permAssignmentChange" ).get$ref ());
79+ assertEquals (openAPI .getPaths ().get ("/permAssignmentChange" ).getGet ().getResponses ().get ("201" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/Error" );
80+ assertEquals (openAPI .getPaths ().get ("/permAssignmentChange" ).getGet ().getResponses ().get ("404" ).getContent ().get ("application/vnd.api+json" ).getSchema ().get$ref (),"#/components/schemas/RemoteError" );
7481
7582 }
7683
@@ -2188,7 +2195,7 @@ public void testIssue393() {
21882195 }
21892196
21902197 @ Test
2191- public void testBadFormat () throws Exception {
2198+ public void testBadFormat () {
21922199 OpenAPIV3Parser parser = new OpenAPIV3Parser ();
21932200 final OpenAPI openAPI = parser .read ("src/test/resources/bad_format.yaml" );
21942201
@@ -3429,4 +3436,4 @@ public void testVersion(){
34293436 SwaggerParseResult parseResult = openApiParser .readLocation ("version-missing.yaml" , null , options );
34303437 assertEquals (parseResult .getMessages ().get (0 ), "attribute info.version is missing" );
34313438 }
3432- }
3439+ }
0 commit comments