Add DevCenter.getSpec() returning a versioned JSON description#76
Merged
Conversation
The Moderne CLI bundles `rewrite-devcenter` in its fat jar so it can construct a `DevCenter` from a recipe and walk its cards/measures to render dashboards. That bundling causes class-identity splits across the CLI's recipe classloader boundary (e.g. `SemverRowBuilder$ParserHolder` fails to initialize because the parent loader can't see `VersionParser` from `rewrite-java-dependencies`) and shadows whatever `rewrite-devcenter` version customer custom devcenters bring in. `getSpec()` lets the CLI consume DevCenter structure as JSON instead of walking the Java API across classloaders. The CLI reflectively constructs `DevCenter`, calls `getSpec()`, and parses the result into CLI-owned DTOs - no shared class identity needed. Schema (v1): - `apiVersion`: stable wire-format discriminator - `upgradesAndMigrations`: ordered cards, each with name, fixRecipeId, measure names - `security`: nullable security card with the same shape
c23b85d to
ffda974
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.
Summary
String getSpec()toio.moderne.devcenter.DevCenter, returning a versioned JSON description of the devcenter's cards and measures.DevCenterinto parent classpath; that bundling causes class-identity splits and shadows customer-providedrewrite-devcenterversions. JSON-over-reflection is the contract that lets the CLI unbundle.Schema (v1)
{ "apiVersion": "v1", "upgradesAndMigrations": [ {"name": "...", "fixRecipeId": "...", "measures": ["...", ...]}, ... ], "security": {"name": "...", "fixRecipeId": "...", "measures": [...]} | null }Card and measure ordering is preserved.
fixRecipeIdmay be null.securityis null when no security card is defined.Test plan
getSpecMatchesStarterDevCenter— full structure round-trip againstDevCenterStarter, including security card + measure orderinggetSpecOmitsSecurityWhenAbsent— nullable security handling./gradlew compileJavapassesFollow-up
The Moderne CLI side that consumes
getSpec()is a separate PR inmoderne-cli(depends on this artifact being released).