Repository navigation
ci: add an API compatibility gate; refactor: replace JsonUtil with ModelObjects - #485
Closed
dargmuesli wants to merge 5 commits into
Closed
dargmuesli wants to merge 5 commits into
dargmuesli wants to merge 5 commits into
Conversation
Runs japicmp after the build against the newest non-RC tag before HEAD and fails on binary or source incompatible changes, unless the major version went up, as on beta. The report is written to the job summary. Refs #461 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSXwvJcGsHkEQQs7VNmYpR
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #485 +/- ##
============================================
+ Coverage 46.70% 47.23% +0.52%
- Complexity 692 721 +29
============================================
Files 209 212 +3
Lines 6276 6195 -81
Branches 759 574 -185
============================================
- Hits 2931 2926 -5
- Misses 2783 2890 +107
+ Partials 562 379 -183 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…il classes Requests now call a shared helper in a new, unexported internal package instead of instantiating a model's JsonUtil only to reach the shared Gson. The custom readers for Disallows, ExternalId, ExternalUrl and PlaybackQueue move into Gson adapters, so those JsonUtil overrides only delegate and are kept solely for binary compatibility. The parsing steps are unchanged, all tests pass, and japicmp reports no API change against 10.1.0. The internal package is excluded from the API gate. Refs #461 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSXwvJcGsHkEQQs7VNmYpR
Replaces 92 inline "assert (x != null); assert (!x.isEmpty());" pairs in the request builders with Preconditions.assertNotEmpty in the internal package. It is still a Java assertion, so it is a no-op unless assertions are enabled, exactly like the statements it replaces. Refs #461 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSXwvJcGsHkEQQs7VNmYpR
Nothing in the library calls them any more, since responses are read through the shared Gson instance. They are deprecated for removal in the next major version. Plain @deprecated rather than forRemoval, because removal warnings are not suppressed inside deprecated code and every model JsonUtil extends the deprecated base class. Refs #461 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSXwvJcGsHkEQQs7VNmYpR
Gives callers who parse JSON they obtained outside a request (cached or stored responses) a public replacement for the deprecated JsonUtil classes: fromJson, arrayFromJson, pagingFromJson and pagingCursorbasedFromJson. The signatures take a String, not Gson types, so they survive Gson leaving the public API. The JsonUtil deprecation notes now point here. Refs #461 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSXwvJcGsHkEQQs7VNmYpR
This was referenced Nov 3, 2026
Member
Author
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.
Steps 1 and 2 of the alternative plan discussed in #461. The commits are separate and each one builds and passes on its own.
1.
ci:API compatibility gatejapicmp-maven-plugintopom.xml. It isn't bound to any build phase, so a plain local build doesn't need network access.HEAD^.pom.xmlwith a higher major number than the baseline, as onbeta; there the report is for information only.pom.xmlstill carries the last released version, and in that state the mode rejects even additive changes.CONTRIBUTING.mdandAGENTS.md.2. Internal boilerplate, without changing the public API
JsonUtiljust to reach the shared Gson. They callModelObjectJsonin a newse.michaelthelin.spotify.internalpackage.ModelObjectGsonmoved there too. The parsing steps are the same, so empty or malformed bodies fail exactly as before.Disallows,ExternalId,ExternalUrlandPlaybackQueueare now Gson adapters.JsonUtil.createModelObjectoverrides now only callsuper.assert (x != null); assert (!x.isEmpty());pairs in request builders are replaced byPreconditions.assertNotEmpty(x).AssertionErrorunder-ea, as before (checked both ways).JsonUtil. New classse.michaelthelin.spotify.model_objects.ModelObjects, for callers who read JSON they got outside a request, such as cached responses. It has four methods:fromJson,arrayFromJson,pagingFromJsonandpagingCursorbasedFromJson.Stringrather than Gson types, so they won't be affected if Gson later stops being part of the public API.keyoverloads: adding them later is compatible, removing them wouldn't be.JsonUtilclasses andIModelObject.IJsonUtilare marked deprecated, point toModelObjects, and are to be removed in the next major version.@Deprecatedrather thanforRemoval. Removal warnings aren't suppressed inside deprecated code, so every modelJsonUtilextending the deprecated base class would add a warning to the build.ModelObjectMappingTestnow usesModelObjects.Verification (local)
mvn install: 420 tests, all passing, including 6 new ones forModelObjects.javadoc-checkprofile), the examples module compile, andci/check-docs.py: all pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01KSXwvJcGsHkEQQs7VNmYpR