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
  • #2063
Closed
Open
Issue created Feb 05, 2019 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[bug][Kotlin] Default typeMapping for 'date' should be LocalDate

Created by: legzo

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

When a spec specifies a property as :

"type": "string",
"format": "date",

the Kotlin generator generates the corresponding field as a LocalDateTime and later, the parsing fails when Jackson is used (Gson too) saying it cannot find a converter for this type.

As I understand the spec, "format":"date" should result in a LocalDate and "format":"date-time" in a LocalDateTime

openapi-generator version

I tried version 3.3.4, but I read the code of master and the problem is still present.

Steps to reproduce

Use as an input any spec that has a property configured as :

"type": "string",
"format": "date",
Suggest a fix/enhancement

I think there is only one line to change at https://github.com/OpenAPITools/openapi-generator/blob/0b66fa5c8214e2907a326fa8684cb2adcfa438a6/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java#L175

it should be

 typeMapping.put("Date", "java.time.LocalDate");

I can provide a PR if you think it is really a bug.

Cheers.

Assignee
Assign to
Time tracking