Bug Report Checklist
Description
When an Api Spec uses a Date as path parameter like /pets/{date} and enabling useCustomDateWithoutTime,
the method generated is something like open class func updateDate(date: OpenAPIDateWithoutTime) async throws {(which is correct).
However, the method fails to convert the date to a string correctly ("https:///pets/2024-03-11"), instead it calls the API like this:
https://<api-url>/pets/OpenAPIDateWithoutTime(wrappedDate%3A%202024-02-29%2023%3A00%3A00%20+0000,%20timezone%3A%20Europe/Berlin%20(fixed))"
openapi-generator version
Tested with version 7.3.0
OpenAPI declaration file content or url
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"license": {
"name": "MIT"
}
},
"servers": [
{
"url": "http://petstore.swagger.io/v1"
}
],
"paths": {
"/pets/{date}": {
"put": {
"tags": [
"date"
],
"summary": "put date",
"operationId": "updateDate",
"parameters": [
{
"name": "date",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "date",
"example": "2022-12-06"
},
"example": "2022-12-06"
}
],
"responses": {
"204": {
"description": "Successful Operation"
}
}
}
}
},
"components": {
"schemas": {
}
}
}
Generation Details
config.json:
{
"mapFileBinaryToData": "false",
"responseAs": "AsyncAwait",
"useCustomDateWithoutTime": "true"
}
Steps to reproduce
Generate API:
openapi-generator-cli.jar generate -g swift5 -i sample.json -o out -c config.json
Use Api
Suggest a fix
I will post a PR with a suggestion
Bug Report Checklist
Description
When an Api Spec uses a Date as path parameter like
/pets/{date}and enablinguseCustomDateWithoutTime,the method generated is something like
open class func updateDate(date: OpenAPIDateWithoutTime) async throws {(which is correct).However, the method fails to convert the date to a string correctly ("https:///pets/2024-03-11"), instead it calls the API like this:
https://<api-url>/pets/OpenAPIDateWithoutTime(wrappedDate%3A%202024-02-29%2023%3A00%3A00%20+0000,%20timezone%3A%20Europe/Berlin%20(fixed))"openapi-generator version
Tested with version 7.3.0
OpenAPI declaration file content or url
{ "openapi": "3.0.0", "info": { "version": "1.0.0", "title": "Swagger Petstore", "license": { "name": "MIT" } }, "servers": [ { "url": "http://petstore.swagger.io/v1" } ], "paths": { "/pets/{date}": { "put": { "tags": [ "date" ], "summary": "put date", "operationId": "updateDate", "parameters": [ { "name": "date", "in": "path", "required": true, "schema": { "type": "string", "format": "date", "example": "2022-12-06" }, "example": "2022-12-06" } ], "responses": { "204": { "description": "Successful Operation" } } } } }, "components": { "schemas": { } } }Generation Details
config.json:
Steps to reproduce
Generate API:
openapi-generator-cli.jar generate -g swift5 -i sample.json -o out -c config.json
Use Api
Suggest a fix
I will post a PR with a suggestion