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
  • Merge requests
  • !4750

[Kotlin][Client] Request date converter

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/AlexanderEggers/feature/request-date-converter into master Dec 10, 2019
  • Overview 0
  • Commits 13
  • Pipelines 0
  • Changes 53

Created by: AlexanderEggers

I have noticed an issue with the Kotlin client that was using the LocalDate or LocalDateTime toString method. Generally that will work for people, but I actually got a use-case where I want to send up a specific date-string format. The toString generally is using the format "yyyy-MM-dd'T'HH:mm:ss" but I want to send up "yyyy-MM-dd'T'HH:mm:ssZ".

I have done a few changes to the existing templates and added a new option for the generator called "requestDateConverter". This option can take the values "toJson" or "toString". "toString" is the default value and ensures not to break any existing code. "toJson" is using the gson/moshi converter to parse the date object. Because the converter is converting the date into a json value I am stripping the quotation marks from the value at the end. Using the json converter, the solution is much simpler and generic.

Changelog:

  • Added new samples for showing the date converter stuff
  • Updated samples
  • Added new generator option via the Kotlin codegen
  • Updated jvm templates to use the new "requestDateConverter" option

These changes are for jvm only at the moment. I can take care of the multiplatform part in a different PR.

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/AlexanderEggers/feature/request-date-converter