Describe the bug
The OpenAPI contract for the Camunda BPMN engine defines a servers section that includes a custom server option with a {url} variable whose default is an empty string:
https://docs.camunda.org/manual/latest/reference/rest/
{
"url": "{url}",
"description": "The API server with a custom url",
"variables": {
"url": {
"default": ""
}
}
}
This causes an exception to be thrown by the OpenAPI.NET reader, which seems to expect that default values for variables must not be empty strings.
While this is may be a valid OpenAPI document according to the spec, the parser does not handle this edge case gracefully. Other interpreters like NSwagStudio does not have problem with that.
OpenApi File To Reproduce
{
"openapi": "3.0.2",
"info": {
"title": "Camunda Platform REST API",
"description": "OpenApi Spec for Camunda Platform REST API.",
"version": "7.22.0",
"license": {
"name": "Apache License 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"externalDocs": {
"description": "Find out more about Camunda Rest API",
"url": "https://docs.camunda.org/manual/7.22/reference/rest/overview/"
},
"servers": [
{
"url": "http://{host}:{port}/{contextPath}",
"description": "The API server for the default process engine",
"variables": {
"host": {
"default": "localhost"
},
"port": {
"default": "8080"
},
"contextPath": {
"default": "engine-rest"
}
}
},
{
"url": "http://{host}:{port}/{contextPath}/engine/{engineName}",
"description": "The API server for a named process engine",
"variables": {
"host": {
"default": "localhost"
},
"port": {
"default": "8080"
},
"contextPath": {
"default": "engine-rest"
},
"engineName": {
"default": "default"
}
}
},
{
"url": "{url}",
"description": "The API server with a custom url",
"variables": {
"url": {
"default": ""
}
}
}
],
"paths": {}
Expected behavior
The OpenAPI.NET reader should allow variables with empty string defaults, or at least fail with a meaningful validation message rather than an exception.
Screenshots/Code Snippets
Additional context
I'm building an OpenAPI client source generator for C#, and I'm using OpenAPI.NET as the foundation for parsing and modeling OpenAPI documents according to the spec. This issue blocks support for compliant but loosely structured documents such as Camunda’s.
Describe the bug
The OpenAPI contract for the Camunda BPMN engine defines a servers section that includes a custom server option with a
{url}variable whose default is an empty string:https://docs.camunda.org/manual/latest/reference/rest/
{ "url": "{url}", "description": "The API server with a custom url", "variables": { "url": { "default": "" } } }This causes an exception to be thrown by the OpenAPI.NET reader, which seems to expect that default values for variables must not be empty strings.
While this is may be a valid OpenAPI document according to the spec, the parser does not handle this edge case gracefully. Other interpreters like NSwagStudio does not have problem with that.
OpenApi File To Reproduce
{ "openapi": "3.0.2", "info": { "title": "Camunda Platform REST API", "description": "OpenApi Spec for Camunda Platform REST API.", "version": "7.22.0", "license": { "name": "Apache License 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, "externalDocs": { "description": "Find out more about Camunda Rest API", "url": "https://docs.camunda.org/manual/7.22/reference/rest/overview/" }, "servers": [ { "url": "http://{host}:{port}/{contextPath}", "description": "The API server for the default process engine", "variables": { "host": { "default": "localhost" }, "port": { "default": "8080" }, "contextPath": { "default": "engine-rest" } } }, { "url": "http://{host}:{port}/{contextPath}/engine/{engineName}", "description": "The API server for a named process engine", "variables": { "host": { "default": "localhost" }, "port": { "default": "8080" }, "contextPath": { "default": "engine-rest" }, "engineName": { "default": "default" } } }, { "url": "{url}", "description": "The API server with a custom url", "variables": { "url": { "default": "" } } } ], "paths": {}Expected behavior
The OpenAPI.NET reader should allow variables with empty string defaults, or at least fail with a meaningful validation message rather than an exception.
Screenshots/Code Snippets
Additional context
I'm building an OpenAPI client source generator for C#, and I'm using OpenAPI.NET as the foundation for parsing and modeling OpenAPI documents according to the spec. This issue blocks support for compliant but loosely structured documents such as Camunda’s.