swagger-api / swagger-api/swagger-codegen

[JAVA] Client can't deserialize date-time

Open
#8,158 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I'm generating a Java client from my swagger definition created from my ASP .Net Core backend. When I call my Java client API to downloading a list of objects I get an exception as it fails to deserialize a field that is a date-time. This works for my generated TypeScript client but not for the Java client.

Downloaded data: https://gist.github.com/syeager/db93f1611ebd3b556a5e8ece76c60de4
Exception: https://gist.github.com/syeager/7436db72946dcf0baa2c7487faaed2e3

Swagger-codegen version

2.3.1

Swagger declaration file content or url

https://gist.github.com/syeager/e4ba6f52663d5f7d548db9bbf02a1785

Command line used for generation

java -jar swagger-codegen-cli.jar generate -i http://localhost:45455/swagger/v1/swagger.json --model-package Climb.Models --api-package Climb.API --invoker-package Climb -l android --library=volley -o .\tmp\

Steps to reproduce

Call my client API to download a list of objects with date-time as a field.

Related issues/PRs
Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the listed swagger-codegen command and Swagger declaration. Compare the downloaded data and exception from the linked gists with the generated Android/Volley client’s date-time handling. Done means the generated Java client can deserialize the date-time field when downloading the object list.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.