OpenAPITools / OpenAPITools/openapi-generator

[BUG] Field declare as Date is not Recognize as isDate is mustache

Open
#18,038 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Field declare as Date is not Recognize as isDate is mustache.

  1. Spec has field of type Date .
  2. we have written our own converter by extends SpringCodegen implements CodegenConfig
  3. Once we run generator we are noticing that the model json is not update isDate property as true for "openApiType" : "Date",

yaml

        generatorTime:
          deprecated: true
          format: date-time
          type: string

model json

      "openApiType" : "Date",
      "baseName" : "generatorTime",
      "isDate" : false,
      "isDateTime" : false,
      

Mustache

{{#isDate}}
  @JsonProperty("{{baseName}}")
 {{/isDate}}

now above mustache condition failed since isDate is false. right now i am using openapi-generator-5.4.0 version .

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 custom SpringCodegen implementation and the supplied YAML field, then run openapi-generator 5.4.0 and inspect the model JSON metadata. Compare how the generator classifies date and date-time fields before the Mustache template is rendered. Done means the documented Date field produces the expected isDate value and the template condition behaves accordingly.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.