fix(kotlin-spring): use correct Jackson 3 property path for WRITE_DATES_AS_TIMESTAMPS#23384
Open
takkiraz wants to merge 2 commits intoOpenAPITools:masterfrom
Open
Conversation
…ES_AS_TIMESTAMPS When using Spring Boot 4 with Jackson 3, the property path for WRITE_DATES_AS_TIMESTAMPS changed from: spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS to: spring.jackson.datatype.datetime.WRITE_DATES_AS_TIMESTAMPS This fix adds conditional logic to the kotlin-spring generator template to use the correct property path based on useSpringBoot4 flag, matching the behavior already implemented in the JavaSpring generator. Fixes binding error: 'Failed to bind properties under spring.jackson.serialization to java.util.Map<tools.jackson.databind.SerializationFeature, java.lang.Boolean>: No enum constant tools.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS'
Add tests to verify that: - Spring Boot 4 generates application.yaml with spring.jackson.datatype.datetime.WRITE_DATES_AS_TIMESTAMPS - Spring Boot 3 generates application.yaml with spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS
9fc0641 to
68a77f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR checklist
masterFixes #23383
Summary
When using Spring Boot 4 with Jackson 3, the generated
application.yamlcontains an invalid property path that causes the application to fail at startup:Root cause: In Jackson 3.x,
WRITE_DATES_AS_TIMESTAMPSwas moved fromSerializationFeaturetoDateTimeFeature. The Spring Boot property path changed from:spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPSspring.jackson.datatype.datetime.WRITE_DATES_AS_TIMESTAMPSChanges
kotlin-springtemplate to use conditional logic based onuseSpringBoot4flagkotlin-springboot-4sample with correct property pathThis aligns the
kotlin-springgenerator with the existing behavior in theJavaSpringgenerator.How to validate
Generate a kotlin-spring server with Spring Boot 4:
Check
out/src/main/resources/application.yamlcontains:Run the server:
Server should start successfully
Technical Committee
@cachescrubber @DKoyama @jmini @shibasis0801 @welshm @Zomzog
Summary by cubic
Fixes a startup failure in
kotlin-springSpring Boot 4 projects by generating the correct Jackson 3 path for WRITE_DATES_AS_TIMESTAMPS. Aligns behavior withJavaSpring. Fixes #23383.spring.jackson.datatype.datetime.WRITE_DATES_AS_TIMESTAMPSwhenuseSpringBoot4=true(Jackson 3).spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPSfor Spring Boot 3 (Jackson 2).application.mustache, sampleapplication.yaml, and added tests to verify the correct path and ensure the other path is absent.Written for commit 68a77f1. Summary will update on new commits.