swagger-api / swagger-api/swagger-codegen

[JAVA]referenced date time object is replaced by OffsetDateTime

Open
#9,143 0 comments 0 reactions 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

Custom DateTime definition defined in the open API definition is not handled and instead OffsetDateTime object is used.

Swagger-codegen version

latest from swagger editor ( http://editor.swagger.io/ )

Swagger declaration file content or url

https://app.swaggerhub.com/apis/myapi37/DateTimeBug/1

Command line used for generation

No, generated from swagger editor

Steps to reproduce

Use the provided open API definition and generate java client SDK for it.
Date Time model won't get generated and DateTimePayload contains list of OffsetDateTime instead of what is referenced in the definition (DateTime).

But if DateTime definition name is changed to DateTimeCommon, generated SDK contains DateTimeCommon model class and DateTimePayload class will have list of type DateTimeCommon class.

Looks like the problem is with the name "DateTime" in the below definition
"DateTime": {
"allOf": [
{
"$ref": "#/definitions/DateTimeCommonData"
},
{
"type": "object",
"properties": {}
}
]
}

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 with the SwaggerHub definition linked in the report and generate the Java client SDK from it. Compare the generated DateTimePayload and model classes with the DateTime and DateTimeCommonData definitions; done means the referenced DateTime model is generated and used instead of OffsetDateTime.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.