You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
When I parse an OpenAPI 3.0 document using new OpenAPIV3Parser().readContents(...), a default server with URL "/" is automatically added if no servers are defined. This causes issues when the document is later used in Swagger UI or serialized with Json.mapper().writeValueAsString(...), as the unwanted "/" base path appears in the output.
Steps to Reproduce:
Use the swagger-parser library to read an OpenAPI spec that has no servers section.
Parse using:
OpenAPI openApi = new OpenAPIV3Parser().readContents(openApiString).getOpenAPI();
String openApiJson = Json.mapper().writeValueAsString(openApi);
Observe that the resulting openApiJson includes:
"servers": [
{
"url": "/"
}
]
Expected Behavior:
If no servers are defined in the input OpenAPI spec, the parser should not add a default server URL, or there should be an option to disable it.
Actual Behavior:
A server with URL "/" is automatically inserted into the servers list.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Description:
When I parse an OpenAPI 3.0 document using new OpenAPIV3Parser().readContents(...), a default server with URL "/" is automatically added if no servers are defined. This causes issues when the document is later used in Swagger UI or serialized with Json.mapper().writeValueAsString(...), as the unwanted "/" base path appears in the output.
Steps to Reproduce:
Expected Behavior:
If no servers are defined in the input OpenAPI spec, the parser should not add a default server URL, or there should be an option to disable it.
Actual Behavior:
A server with URL "/" is automatically inserted into the servers list.
The text was updated successfully, but these errors were encountered: