Repository navigation
Closed
Description
The OAS3 spec specifies:
This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served.
With a server that serves on http://localhost:8090/openapi.json:
{
"openapi": "3.0.1",
"servers": [
{
"url": "/rel"
}
],
"info": {
"description": "This is a sample server",
"version": "1.0.0",
"title": "OpenAPI Petstore",
"license": {
"name": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"paths": {
"/ping": {
"get": {
"summary": "Some ping operation",
"description": "Some ping operation",
"operationId": "doPing",
"responses": {
"200": {
"description": "OK",
"content" : {
"application/json" : {
"schema" : {
"type" : "object",
"properties" : {
"status": {
"type" : "string",
"example" : "ok",
}
}
}
}
}
}
}
}
}
}
}When you do:
String inputSpec = "http://localhost:8090/openapi.json";
OpenAPIParser openApiParser = new OpenAPIParser();
ParseOptions options = new ParseOptions();
options.setResolve(true);
options.setFlatten(true);
System.out.println(openAPI.getServers().get(0).getUrl()); //should be http://localhost:8090/relYou get /rel where the expected value is http://localhost:8090/rel
Tested with:
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<version>2.0.1</version>Metadata
Metadata
Assignees
Labels
No labels
Activity
Fix for swagger-api#742
Add test case for swagger-api#742
jmini commentedon Jul 20, 2018
Solved with merge of #773