Repository navigation
fix: stop boat:bundle writing default: null and value: null - #1321
Merged
Merged
Conversation
Example.setValue(null) marks the value as set in swagger-models 2.2.x, so bundled and exploded specs carried a value: null next to every example $ref. Clear the flag wherever the value is replaced by a $ref. Co-authored-by: Cursor <[email protected]>
openapi-diff-core brings swagger-parser-v3 2.1.31 closer to the plugin than boat-engine's 2.1.48, so Maven picked the older parser. That parser calls setDefault(null) on every schema, and swagger-models 2.2.54+ (boat 0.18.4 and later) then serializes default: null. Manage all swagger-parser modules at one version and fail the plugin build when the swagger-parser or swagger-core modules diverge again. Co-authored-by: Cursor <[email protected]>
Generators reject a default: null on a schema that does not allow null. The rule reads the document as written, because Zally's model merges allOf schemas and its document tree drops null values. Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
|
jjjasper
approved these changes
Nov 9, 2026
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
From 0.18.4 to 0.19.1,
boat:bundle(andboat:generatewithbundleSpecs) writesdefault: nullon every schema. Generators then reject the spec on non-nullable schemas. For example, iam-auth-server fails generating from the publishedconsent-service-api1.4.0, which has 158 of them. Bundling also writesvalue: nullnext to every example$ref.This PR fixes both, guards the build against the cause coming back, and adds lint rule
B025so specs that were already published with the problem get flagged.Root cause
The plugin realm runs two swagger-parser versions side by side:
The root POM only managed the
swagger-parseraggregator, not the modules under it.setDefault(null)on schemas that have no default.defaultSetFlagand serializes it asdefault: null.value: nullis the same flag mechanism:Example.setValue(null)marks the value as set.Bundling the consent service sources with each boat version:
default: nullvalue: nullApart from those removed lines, the output on this branch is identical to 0.19.1.
Changes
pom.xml): manageswagger-parser-v3,swagger-parser-core,swagger-parser-v2-converterandswagger-parser-safe-url-resolverat${swagger-parser.version}. They keep the same exclusions as the aggregator.boat-maven-plugin/pom.xml): amaven-enforcerdependencyConvergencerule limited toio.swagger.parser.v3:*andio.swagger.core.v3:*. Without the alignment above it fails and points at the openapi-diff-core path.value: null: callsetValueSetFlag(false)aftersetValue(null)inExamplesProcessor,ExampleHolderandDirectoryExploder.B025(MUST): reportsdefault: nullon a schema that does not allow null. In OpenAPI 3.0 that means nonullable: true; in 3.1, nonullintype.allOfschemas, which drops theirdefault, and reports shared schemas at the wrong location. Zally's document tree drops null values altogether.Consumer impact
default: nulluntil they are re-bundled with this version and republished.object".B025only fails a build whenfailOnWarningis enabled. AddB025toignoreRulesto opt out.Test plan
BundleMojoTest.testBundleDoesNotAddNullDefaultsOrValues: a new spec with path and query parameters, an object schema with several property types, and an external example$ref. Without the fixes the bundle has 10default: nulland 1value: nulland the test fails. With them it passes.BundlerTests.testBundleApi: assertsgetValueSetFlag()is false on the cleaned-up example and that the serialized spec has novalue: null. It fails without the engine change.NoNullDefaultRuleTesthas 8 cases:allOf, reported where the schema is declarednullintypemvn verify -pl boat-engine,boat-quay/boat-quay-rules,boat-maven-plugin -ampasses, including the invoker ITs. The enforcer rule passes.0.19.2-SNAPSHOTinstalled, bundling the consent service sources writes nodefault: nullorvalue: null, and its 11 example$refs are kept.