Skip to content
New issue

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

[PHP] Date isn't correctly formatted #10915

Closed
a4blue opened this issue Feb 19, 2021 · 1 comment
Closed

[PHP] Date isn't correctly formatted #10915

a4blue opened this issue Feb 19, 2021 · 1 comment

Comments

@a4blue
Copy link

a4blue commented Feb 19, 2021

Description

Date is not correctly formatted from a DateTime Object in a generated PHP-Client
Expected was 'Y-m-d' instead 'Y-m-d\TH:i:sP' was generated

Swagger-codegen version
Swagger declaration file content or url

https://gist.github.com/a4blue/db06f076317ac6150a65b682e971039b

Command line used for generation

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i ../test.yml -l php -o ../test_api

Steps to reproduce
<?php
include_once "vendor/autoload.php";

$model = new \Swagger\Client\Model\Model();
$model->setSampleDate(new DateTime());
var_dump((string)$model);
Related issues/PRs

#6533
#6474
#5607

Suggest a fix/enhancement

In lib/ObjectSerializer.php:
Line 74

- $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]);
+ $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $formats[$property], $swaggerType);
@a4blue
Copy link
Author

a4blue commented Feb 19, 2021

Just now realized, that the Code Generation Part is now handled by https://github.com/swagger-api/swagger-codegen-generators
Closing it

@a4blue a4blue closed this as completed Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant