[BUG] java-micronaut-server generator issues with datetime
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What’s the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
jackson have issue deserialising the field as its a localDateTime and have OffsetSeconds in the format.
Generated Field
@Nullable
@ApiModelProperty(value = "last updated datetime")
@JsonProperty(JSON_PROPERTY_LAST_UPDATED_DATE_TIME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX")
public LocaltDateTime getLastUpdatedDateTime() {
return lastUpdatedDateTime;
}
Expected Field
@Nullable
@ApiModelProperty(value = "last updated datetime")
@JsonProperty(JSON_PROPERTY_LAST_UPDATED_DATE_TIME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXX")
public OffsettDateTime getLastUpdatedDateTime() {
return lastUpdatedDateTime;
}
Error :
JSON: Unsupported field: OffsetSeconds
Which originates from java.time.LocalDate
private int get0(TemporalField field) {
switch ((ChronoField) field) {
case DAY_OF_WEEK: return getDayOfWeek().getValue();
case ALIGNED_DAY_OF_WEEK_IN_MONTH: return ((day - 1) % 7) + 1;
case ALIGNED_DAY_OF_WEEK_IN_YEAR: return ((getDayOfYear() - 1) % 7) + 1;
case DAY_OF_MONTH: return day;
case DAY_OF_YEAR: return getDayOfYear();
case EPOCH_DAY: throw new UnsupportedTemporalTypeException("Invalid field 'EpochDay' for get() method, use getLong() instead");
case ALIGNED_WEEK_OF_MONTH: return ((day - 1) / 7) + 1;
case ALIGNED_WEEK_OF_YEAR: return ((getDayOfYear() - 1) / 7) + 1;
case MONTH_OF_YEAR: return month;
case PROLEPTIC_MONTH: throw new UnsupportedTemporalTypeException("Invalid field 'ProlepticMonth' for get() method, use getLong() instead");
case YEAR_OF_ERA: return (year >= 1 ? year : 1 - year);
case YEAR: return year;
case ERA: return (year >= 1 ? 1 : 0);
}
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
openapi-generator version
V 5.4.0
OpenAPI declaration file content or url
Generation Details
gradlePlugin = “org.openapi.generator”
generatorName = “java-micronaut-server”
Steps to reproduce
Add a date-time field to any swagger and generate the classes using the java-micronaut-server generator.
Related issues/PRs
This is recently released.
Suggest a fix
Change date-time from LocalDateTime to OffSetDateTime
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Documentation for the java-micronaut-server Generator
If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With...
Read more >Management & Monitoring - Micronaut Documentation
Micronaut is a modern, JVM-based, full stack Java framework designed for building modular, easily testable JVM applications with support for Java, Kotlin, and ......
Read more >Eager Initialization of Singletons - Micronaut Documentation
The solution is to annotate the interface with DefaultImplementation to indicate which implementation should be replaced if a user creates a bean that...
Read more >Configurations - Micronaut Documentation
Use the CLI to quickly create a GRPC application. mn create-app helloworld --profile grpc --lang java --build gradle. RabbitMQ Support.
Read more >Table of Contents - Micronaut Documentation
A low-level HTTP client is provided out of the box which you can use to test the HelloController created in the previous section....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mast7860 The PR was merged, so you can verify if it resolved your issue: https://github.com/OpenAPITools/openapi-generator/pull/11871
@mast7860 You think you can close this issue, since it seems to be resolved?