Skip to content

Commit f797e46

Browse files
zalito12wing328
authored andcommitted
Add date time format annotation on pojo for model query parameters (OpenAPITools#5437)
* Add date time format annotation on pojo for model query parameters * Regenetare samples * update spring samples Co-authored-by: William Cheng <[email protected]>
1 parent 0215372 commit f797e46

File tree

39 files changed

+131
-0
lines changed

39 files changed

+131
-0
lines changed

modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}}{{^parent}}
3131
private {{>nullableDataType}} {{name}} = {{#isNullable}}JsonNullable.undefined(){{/isNullable}}{{^isNullable}}{{#required}}{{{defaultValue}}}{{/required}}{{^required}}null{{/required}}{{/isNullable}};
3232
{{/isContainer}}
3333
{{^isContainer}}
34+
{{#isDate}}
35+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
36+
{{/isDate}}
37+
{{#isDateTime}}
38+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
39+
{{/isDateTime}}
3440
private {{>nullableDataType}} {{name}}{{#isNullable}} = JsonNullable.undefined(){{/isNullable}}{{^isNullable}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isNullable}};
3541
{{/isContainer}}
3642

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,4 +544,31 @@ public void doGenerateCookieParams() throws IOException {
544544
checkFileContains(generator, outputPath + "/src/main/java/org/openapitools/api/ZebrasApi.java", "@CookieValue");
545545
checkFileNotContains(generator, outputPath + "/src/main/java/org/openapitools/api/BirdsApi.java", "@CookieValue");
546546
}
547+
548+
@Test
549+
public void doAnnotateDatesOnModelParameters() throws IOException {
550+
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
551+
output.deleteOnExit();
552+
String outputPath = output.getAbsolutePath().replace('\\', '/');
553+
554+
OpenAPI openAPI = new OpenAPIParser()
555+
.readLocation("src/test/resources/3_0/issue_5436.yml", null, new ParseOptions()).getOpenAPI();
556+
557+
SpringCodegen codegen = new SpringCodegen();
558+
codegen.setOutputDir(output.getAbsolutePath());
559+
codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");
560+
561+
ClientOptInput input = new ClientOptInput();
562+
input.openAPI(openAPI);
563+
input.config(codegen);
564+
565+
MockDefaultGenerator generator = new MockDefaultGenerator();
566+
generator.opts(input).generate();
567+
568+
checkFileContains(generator, outputPath + "/src/main/java/org/openapitools/api/ZebrasApi.java",
569+
"AnimalParams");
570+
checkFileContains(generator, outputPath + "/src/main/java/org/openapitools/model/AnimalParams.java",
571+
"@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)",
572+
"@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)");
573+
}
547574
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
openapi: 3.0.0
2+
servers:
3+
- url: 'localhost:8080'
4+
info:
5+
version: 1.0.0
6+
title: OpenAPI Zoo
7+
license:
8+
name: Apache-2.0
9+
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
10+
paths:
11+
/zebras:
12+
get:
13+
operationId: getZebras
14+
parameters:
15+
- in: query
16+
name: limit
17+
schema:
18+
type: number
19+
- $ref: '#/components/parameters/SearchParams'
20+
components:
21+
parameters:
22+
SearchParams:
23+
name: animalParams
24+
description: Search animal grouped parameters
25+
in: query
26+
style: form
27+
explode: true
28+
schema:
29+
$ref: '#/components/schemas/AnimalParams'
30+
schemas:
31+
AnimalParams:
32+
type: object
33+
properties:
34+
born:
35+
type: string
36+
format: date
37+
example: '2019-12-01'
38+
lastSeen:
39+
type: string
40+
format: date-time
41+
example: '2020-02-22T10:30:00.000'
42+
status:
43+
type: integer
44+
enum: [0,1]
45+
default: 0
46+
name:
47+
type: string
48+
example: 'Marty'
49+
age:
50+
type: integer
51+
example: 15

samples/client/petstore/spring-cloud-async/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class Order {
2727
private Integer quantity;
2828

2929
@JsonProperty("shipDate")
30+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
3031
private OffsetDateTime shipDate;
3132

3233
/**

samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class Order {
2727
private Integer quantity;
2828

2929
@JsonProperty("shipDate")
30+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
3031
private OffsetDateTime shipDate;
3132

3233
/**

samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class Order {
2727
private Integer quantity;
2828

2929
@JsonProperty("shipDate")
30+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
3031
private OffsetDateTime shipDate;
3132

3233
/**

samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private LocalDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private LocalDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private LocalDateTime shipDate;
3031

3132
/**

samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class Order {
2626
private Integer quantity;
2727

2828
@JsonProperty("shipDate")
29+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2930
private OffsetDateTime shipDate;
3031

3132
/**

samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ public class FormatTest {
4747
private Resource binary;
4848

4949
@JsonProperty("date")
50+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
5051
private LocalDate date;
5152

5253
@JsonProperty("dateTime")
54+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
5355
private OffsetDateTime dateTime;
5456

5557
@JsonProperty("uuid")

samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/MixedPropertiesAndAdditionalPropertiesClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
2424
private UUID uuid;
2525

2626
@JsonProperty("dateTime")
27+
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)
2728
private OffsetDateTime dateTime;
2829

2930
@JsonProperty("map")

0 commit comments

Comments
 (0)