We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
When updating to NSwag v14 from v13, I've found that segmented URLs where the last segment is optional are generated incorrectly.
var urlBuilder_ = new System.Text.StringBuilder(); // Operation Path: "views/searchinstruments/{type}/{query}" urlBuilder_.Append("views/searchinstruments/"); urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Append('/'); if (query != null) { urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))); } else if (urlBuilder_.Length > 0) urlBuilder_.Length--; urlBuilder_.Append("{query}"); PrepareRequest(client_, request_, urlBuilder_);
Version used
v14.0.0 and v14.2.0
To Reproduce
No small reproducer yet, but this is a snippet of the OpenAPI V3 JSON from which the code above is generated:
"/views/searchinstruments/{type}/{query}": { "get": { "tags": [ "Searches" ], "operationId": "GetSearchInstrumentsEndpoint_Get", "parameters": [ { "name": "x-actor-id", "in": "header", "required": true, "schema": { "type": "string" }, "examples": { "No Netwealth data": { "value": "5df23838-73eb-41e8-893f-b6cfd019ade3" } } }, { "name": "type", "in": "path", "required": true, "schema": { "type": "string" }, "examples": { "All": { "value": "All" }, "Cash": { "value": "Cash" }, "Common Stock": { "value": "Common Stock" }, "ETF": { "value": "ETF" }, "Fund": { "value": "Fund" }, "Investment Trust": { "value": "Investment Trust" } } }, { "name": "query", "in": "path", "schema": { "type": "string" } } ], "responses": { "200": { "description": "A success response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/getSearchInstrumentsEndpointResponse" }, "examples": { "Single Instrument": { "value": "{\"instruments\":[{\"name\":\"Apple\",\"code\":\"AAPL\",\"currency\":\"USD\",\"isGBX\":false,\"isin\":\"US12345\",\"assetClassType\":\"Common Stock\",\"exchange\":\"US\",\"ticker\":\"AAPL\",\"isStatic\":false}],\"totalFoundInstruments\":1}" } } } } }, "400": { "description": "A bad request response" } }, "security": [ { "function_key": [ ] } ] } },
Expected behavior
The URL does not contain the string "{query}" at the end.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
When updating to NSwag v14 from v13, I've found that segmented URLs where the last segment is optional are generated incorrectly.
Version used
v14.0.0 and v14.2.0
To Reproduce
No small reproducer yet, but this is a snippet of the OpenAPI V3 JSON from which the code above is generated:
Expected behavior
The URL does not contain the string "{query}" at the end.
The text was updated successfully, but these errors were encountered: