Repository navigation
Add a Maven site report (report goal) to the Maven plugin - #935
Open
patpatpat123 wants to merge 2 commits into
Open
patpatpat123 wants to merge 2 commits into
patpatpat123 wants to merge 2 commits into
Conversation
The new `report` goal renders the openapi-diff result as an "OpenAPI Diff" page under Project Reports when running `mvn site`. It can also run on its own with `mvn org.openapitools.openapidiff:openapi-diff-maven:report`. - OpenApiDiffReport: an AbstractMavenReport with the same oldSpec, newSpec, configFiles, configProps and skip parameters as the diff goal. It documents changes and never fails the build. - OpenApiDiffReportRenderer: writes the summary, the What's New, Deleted and Deprecated tables, and the changes of each operation through the Doxia Sink API, explaining why changes break compatibility. - OpenApiDiffOptionsFactory: builds the options for both goals. - Uses Maven Reporting 4 / Doxia 2 (maven-site-plugin 3.21.0+). The minimum Maven version of the plugin stays 3.6.0. - Adds a README section and a reporting example to maven-example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 10 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
- What's Deprecated and its count now list only operations that the new specification deprecates. ChangedOpenApi#getDeprecatedEndpoints also returns operations that are no longer deprecated. Each changed operation now says whether it was deprecated or is no longer deprecated. - Added and deleted items that break compatibility on their own are now marked: deleted parameters, added required parameters, deleted media types, responses, headers and security requirements. The rules are the same as the core results. - displayLocation treats file: URIs like paths and drops user info, query and fragment from URLs, so credentials are never published. - README: a direct `:report` run needs -DoldSpec and -DnewSpec, because Maven only applies the <reporting> configuration during site generation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Hi! 👋
The
diffgoal is great for failing a build on breaking changes, but its result only ends up in the build log. Projects that publish a Maven site have no good place to show "what changed in our API since the last release". This PR adds areportgoal toopenapi-diff-maventhat renders the comparison as a page of the Maven site.What you get
Add the plugin to
<reporting>andmvn sitegets an OpenAPI Diff page under Project Reports. The goal also runs on its own:mvn -DoldSpec=<old spec> -DnewSpec=<new spec> org.openapitools.openapidiff:openapi-diff-maven:reportwritestarget/reports/openapi-diff.html. A direct run needs these properties because Maven only applies<reporting>configuration during site generation. The page has:maxLength).For example, from the new test fixtures:
The goal takes the same
oldSpec,newSpec,configFiles,configPropsandskipparameters asdiff, so both goals give the same verdict. It never fails the build; gating stays the job ofdiff.How it's built, and why
openapi-diff-core, the CLI and the Docker image don't get any new dependency.HtmlRender.HtmlRenderwrites a whole HTML document that links a remotehttp://stylesheet, so it can't sit inside a site page, and browsers would block that stylesheet on anhttpssite anyway. Writing through the sink gives the page the site's skin and menu, and every string coming from the specs is escaped.maven-reporting-impl4.0.0, built for Java 8). That's what maven-site-plugin 3.21.0+ uses, andmaven/pom.xmlalready pins 3.22.0. Older site plugins (Doxia 1) can't run reports built on it, so the README asks for 3.21.0 or newer.maven-plugin-apiandmaven-corestay at 3.6.0, and the generated descriptor still saysrequiredMavenVersion3.6.0. The reporting library itself needs Maven 3.6.3, but so does every maven-site-plugin able to run it, and thediffgoal is unaffected.file:URIs, are shown by name only. URLs are shown without user info, query or fragment, any of which can carry a token.ChangedOpenApi#getDeprecatedEndpoints()also returns operations whose deprecation was removed. The report filters those out and says "Operation no longer deprecated" for them instead.OpenApiDiffOptionsFactorynow builds the options for both goals, so their config handling can't drift apart.diffbehaves exactly as before.Testing
OpenApiDiffReportTest(13 tests) renders the report through a real Doxia XHTML5 sink. It covers:report-oldspec.yaml→report-newspec.yaml);skip, missing configuration, a missing spec;file:URIs and URLs with credentials../mvnw verifypasses on JDK 17: 270 core tests and 26 Maven plugin tests. The plugin also compiles with--release 8, andfmt:checkis clean.mvn siteonmaven-examplewith maven-site-plugin 3.22.0 and the Fluido skin puts the page under Project Reports, and the standalone goal works too.maven-examplenow has a<reporting>section, so you can try it with./mvnw install -DskipTests && ./mvnw -pl maven-example site.There's no issue for this yet. I'm happy to open one first, rename the goal, or slim the page down if you'd rather keep it smaller. Thanks for taking a look!
🤖 Generated with Claude Code