Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

external $ref without / caused exception #1542

Merged
merged 6 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2754,6 +2754,21 @@ public void testDiscriminatorSeparateFileExternalMapping() throws Exception {
Assert.assertNotNull(cat);
}


// Relative external refs failed on windows due to \ issue
@Test
public void testRelativePathIssue1543() {
OpenAPIV3Parser parser = new OpenAPIV3Parser();
ParseOptions options = new ParseOptions();
options.setResolveFully(true);
options.setResolve(true);
SwaggerParseResult readResult = parser.readLocation("src/test/resources/issue-1543/openapi.yaml", null, options);

if (readResult.getMessages().size() > 0) {
Assert.assertFalse(readResult.getMessages().get(0).contains("end -1"));
}
}

@Test
public void testIssue1540() throws Exception{
OpenAPI openAPI = new OpenAPIV3Parser().read("./issue-1540/a.json");
Expand All @@ -2768,5 +2783,4 @@ public void testIssue1540() throws Exception{
Assert.assertNotNull(testPutExtensions.get("x-order"));
Assert.assertEquals((String)testPutExtensions.get("x-order"),"2147483647");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
openapi: 3.0.1
info:
title: Innotech API backend
description: >
API for the Innotech backend
version: 1.0.0

paths:

## Miscellaneous ###################################################################
"/misc/ping":
get:
tags:
- Ping
operationId: getPing
parameters:
- in: query
name: param
schema:
type: string
maxLength: 255
required: true
responses:
"200":
description: Ping response
content:
application/json:
schema:
$ref: "schemas/_index.yaml#/pingResponse"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# schemas/PingResponse.yaml
type: object
properties:
answer:
type: string
maxLength: 255
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# schemas/_index.yaml
pingResponse:
$ref: 'PingResponse.yaml'