Modify java generator to not use joda time anymore.#27
Open
Modify java generator to not use joda time anymore.#27
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Kill Bill Java code generator to migrate from Joda Time to Java Time API (JSR-310) for date and date-time types. The generator is part of a Swagger Codegen extension that produces client library code for Kill Bill.
Changes:
- Updated type mappings to use
java.time.ZonedDateTimeinstead oforg.joda.time.DateTimeandjava.time.LocalDateinstead oforg.joda.time.LocalDate - Updated import mappings to reference
java.timepackage instead oforg.joda.time - Added special handling for
ZonedDateTimearrays to use the existingDateTimeswrapper class
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary of Joda Removal Changes for Generator Update 1. Type Mapping Changes (the core generator change) The generator needs to update its type mappings for date/time types: Swagger Type Old Java Type New Java Type date-time org.joda.time.DateTime java.time.ZonedDateTime date org.joda.time.LocalDate java.time.LocalDate This is a global find-and-replace in the generator's type map. Every place the generator emits DateTime (from Joda), it should emit ZonedDateTime instead. LocalDate keeps the same class name but moves from org.joda.time to java.time. 2. Import Changes Old Import New Import import org.joda.time.DateTime; import java.time.ZonedDateTime; import org.joda.time.LocalDate; import java.time.LocalDate; 3. Affected Generated Code Locations Model classes (model/gen/) — 16 files affected. Every field, constructor parameter, getter, and setter that used DateTime now uses ZonedDateTime. Files using only LocalDate (Invoice, InvoiceDryRun) just had the import change. No behavioral/structural changes — it's purely a type substitution. API classes (api/gen/) — 6 files affected. Method parameter types changed from DateTime → ZonedDateTime and imports changed from org.joda.time.* → java.time.*. The method bodies (query parameter serialization via String.valueOf(...)) are unchanged. 4. Non-Generated (Manual) Changes — FYI only These are not generator concerns but relevant context: pom.xml: Replaced jackson-datatype-joda dependency with jackson-datatype-jsr310. Removed the joda-time dependency entirely. KillBillHttpClient.java: Changed JodaModule → JavaTimeModule, added mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS). CatalogVersions.java and DateTimes.java: Changed ArrayList<DateTime> → ArrayList<ZonedDateTime> (these are hand-maintained wrapper types). 5. Generator Change Checklist In the type mapping configuration, change the mapping for the date-time swagger format from org.joda.time.DateTime to java.time.ZonedDateTime In the type mapping configuration, change the mapping for the date swagger format from org.joda.time.LocalDate to java.time.LocalDate In the import mapping configuration, replace org.joda.time.DateTime → java.time.ZonedDateTime and org.joda.time.LocalDate → java.time.LocalDate No template/mustache changes needed — the transformation is purely at the type/import mapping level
d0f12c6 to
1972fdc
Compare
pierre
approved these changes
Feb 19, 2026
8 tasks
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.
Summary of Joda Removal Changes for Generator Update:
Swagger Type Old Java Type New Java Type
date-time org.joda.time.DateTime java.time.ZonedDateTime date org.joda.time.LocalDate java.time.LocalDate
This is a global find-and-replace in the generator's type map. Every place the generator emits DateTime (from Joda), it should emit ZonedDateTime instead. LocalDate keeps the same class name but moves from org.joda.time to java.time.
import org.joda.time.DateTime; import java.time.ZonedDateTime; import org.joda.time.LocalDate; import java.time.LocalDate;
API classes (api/gen/) — 6 files affected. Method parameter types changed from DateTime → ZonedDateTime and imports changed from org.joda.time.* → java.time.*. The method bodies (query parameter serialization via String.valueOf(...)) are unchanged.
pom.xml: Replaced jackson-datatype-joda dependency with jackson-datatype-jsr310. Removed the joda-time dependency entirely. KillBillHttpClient.java: Changed JodaModule → JavaTimeModule, added mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS). CatalogVersions.java and DateTimes.java: Changed ArrayList → ArrayList (these are hand-maintained wrapper types).
5. Generator Change Checklist In the type mapping configuration, change the mapping for the date-time swagger format from org.joda.time.DateTime to java.time.ZonedDateTime In the type mapping configuration, change the mapping for the date swagger format from org.joda.time.LocalDate to java.time.LocalDate In the import mapping configuration, replace org.joda.time.DateTime → java.time.ZonedDateTime and org.joda.time.LocalDate → java.time.LocalDate No template/mustache changes needed — the transformation is purely at the type/import mapping level