Skip to content

[PHP] date format is "Y-m-d\TH:i:sP" #5607

Closed
@gipeshka

Description

@gipeshka
Description

format: date field is sent with Y-m-d\TH:i:sP format, but according to specification it should be just Y-m-d

Swagger-codegen version

2.2.2

Swagger declaration file content or url
  SpecialDay:
    required:
      - date
      - opening_type
    properties:
      date:
        type: string
        format: date
      opening_type:
        type: string
        enum:
          - delivering
          - opened
          - closed
          - unavailable

results in:

{"date":"2017-05-11T00:00:00+08:00","opening_type":"closed"}
Command line used for generation

swagger-codegen generate -i swagger.yml -l php --config php-sdk-config.json -o .

Config:

{
  "modelPackage": "Model",
  "apiPackage": "Api",
  "invokerPackage": "Sdk",
  "variableNamingConvention": "camelCase",
  "gitUserId": "user",
  "gitRepoId": "repo"
}
Suggest a Fix

As I checked the generated code it currently checks only type of object, so currently the code cannot distinguish between date and date-time. I suppose some metadata information should be passed together with the $data in ObjectSerializer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions