Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'formatDates' config option to add JsonFormat annotation on format "date" fields #699

Closed
CheeseE opened this issue Mar 6, 2017 · 1 comment
Milestone

Comments

@CheeseE
Copy link

CheeseE commented Mar 6, 2017

I have some date fields defined as following:

        "effectiveDate": {
          "type": "string",
          "format": "date",
          "customDateTimePattern": "yyyy-MM-dd"
        }

In my maven plugin I've configured the plugin to use java.time.* for date fields as following:

    <configuration>
      <dateTimeType>java.time.LocalDateTime</dateTimeType>
      <dateType>java.time.LocalDate</dateType>
     </configuration>

After generating the classes the jsonFormat annotation is not applied to the classes:

    @JsonProperty("effectiveDate")
    private LocalDate effectiveDate;

Because of this all the date fields are serialized as array of integers.

@joelittlejohn
Copy link
Owner

I think the new customDateTimePattern only applies for fields that have "format": "date-time":

We should add some further support for "format": "date" fields I think.

@joelittlejohn joelittlejohn changed the title jsonFormat ignored when using Java 8 date & time Add 'formatDates' config option to add JsonFormat annotation on format "date" fields Mar 27, 2017
@joelittlejohn joelittlejohn added this to the 0.4.33 milestone Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants