Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5080
Closed
Open
Issue created Jan 22, 2020 by Administrator@rootContributor

In php, date type query parameters formatted as date-time

Created by: paul-utley

Description

When using a parameter with the format 'date', it is incorectly formatted as a date-time. In my situation, we're passing 2 dates in the query parameters, and our api is receiving the parameters formatted as date-time and rejecting the request.

openapi-generator version

Version 4.2.0

OpenAPI declaration file content or url
"parameters": [{
                        "type": "string",
                        "format": "date",
                        "in": "query",
                        "name": "start_date"
                    },
                    {
                        "type": "string",
                        "format": "date",
                        "in": "query",
                        "name": "end_date"
                    }
                ]
Command line used for generation

openapi-generator generate -i test.json -g php -o .

Steps to reproduce
  1. Use the parameters array from above to generate a simple api definition to do a get request.

If you look at where the query parameters are serialized, you can see that the object serializer formats the datetime object as a ISO8601 date regardless if the query parameter is defined as a date or datetime type in the api definition.

Related issues/PRs

This following issue in TypeScript is exactly what I am experiencing. I just wanted to see that it was reported in php as well. https://github.com/OpenAPITools/openapi-generator/issues/4763

Suggest a fix/enhancement

Need a way to pass the format from the query parameter to the object serializer so it can format it correctly as a date i.e. 2020-01-01 vs a datetime i.e. 2020-01-01T00:00:00Z

Assignee
Assign to
Time tracking