JsonApiX: First Stable Release
Enhancements:
- Upgraded Kotlin to 1.9.20.
- Updated Gradle to 8.2.0.
- Migrated to JDK 17.
Bug Fixes:
- Issue with HasOne/HasMany Annotations: Resolved a serialization issue where fields using HasOne or HasMany annotations were serialized by their field names, ignoring the @SerialName annotation. This previously forced users to match response property names with their casing (like snake case) as defined in the response. Now, fields are correctly serialized respecting the @SerialName annotation, allowing for more flexible and consistent naming conventions.
New Features:
- Support for Nullable Primary Data.
- Meta Support for relationships and resource objects.
Breaking Changes:
-
Introduction:
The latest updates to JsonApiX tackle the issue of losing access to root information in list scenarios, such asList<Person>
. This problem arose from using the samePerson
class for both single objects and lists, leading to confusion, especially in accessing meta information. To improve this, we have implemented significant changes. -
For Single Objects:
The previous direct use ofPerson
in single object scenarios did not effectively encapsulate JSON API data.Don't 🚫 (Old Way):
val person: Person = getPerson() // Direct use of Person class without clear JSON API data encapsulation.
Do ✅ (New Approach):
val personModel: PersonModel = getPerson() // Using PersonModel provides better structure and clarity.
-
For Lists:
Previously, usingList<Person>
led to ambiguity in meta access, making it difficult to determine whether operations likeperson.first().meta
were accessing root or resource meta.Don't 🚫 (Old Way):
val person: List<Person> = getPersons() val meta = person.first().meta // Ambiguity in meta access.
Do ✅ (New Approach):
val persons: PersonList = getPersonList() val rootMeta = persons.rootMeta // Clear access to root meta. val resourceMeta = persons.first().resourceObjectMeta // Specific resource meta access.