fix(MergedSpecBuilder): merge path items by HTTP method instead of overwriting on path collision#24100
Draft
Picazsoo wants to merge 9 commits into
Draft
fix(MergedSpecBuilder): merge path items by HTTP method instead of overwriting on path collision#24100Picazsoo wants to merge 9 commits into
Picazsoo wants to merge 9 commits into
Conversation
…erwriting on path collision
…or reactive generators
… types for reactive generators" This reverts commit 8972528.
…lisions in open api merging test
…omponent and path+method conflicts
Contributor
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/ValidateMojo.java">
<violation number="1" location="modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/ValidateMojo.java:272">
P2: mergeConflictStrategy is parsed and applied unconditionally despite being documented as DEEP-only. A null or invalid value will crash a REF-mode build with an unwrapped IllegalArgumentException/NullPointerException, bypassing the MojoExecutionException handling in execute().</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| mergedSpec = Optional.of(new MergedSpecBuilder(inputSpecRootDirectory, mergedFileName, | ||
| mergedFileInfoName, mergedFileInfoDescription, mergedFileInfoVersion, auth) | ||
| .withMergeMode(MergedSpecBuilder.MergeMode.valueOf(mergeMode.toUpperCase(java.util.Locale.ROOT))) | ||
| .withConflictStrategy(MergedSpecBuilder.MergeConflictStrategy.valueOf(mergeConflictStrategy.toUpperCase(java.util.Locale.ROOT))) |
Contributor
There was a problem hiding this comment.
P2: mergeConflictStrategy is parsed and applied unconditionally despite being documented as DEEP-only. A null or invalid value will crash a REF-mode build with an unwrapped IllegalArgumentException/NullPointerException, bypassing the MojoExecutionException handling in execute().
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/ValidateMojo.java, line 272:
<comment>mergeConflictStrategy is parsed and applied unconditionally despite being documented as DEEP-only. A null or invalid value will crash a REF-mode build with an unwrapped IllegalArgumentException/NullPointerException, bypassing the MojoExecutionException handling in execute().</comment>
<file context>
@@ -251,6 +268,8 @@ private Optional<String> mergeInDirectory() {
mergedSpec = Optional.of(new MergedSpecBuilder(inputSpecRootDirectory, mergedFileName,
mergedFileInfoName, mergedFileInfoDescription, mergedFileInfoVersion, auth)
+ .withMergeMode(MergedSpecBuilder.MergeMode.valueOf(mergeMode.toUpperCase(java.util.Locale.ROOT)))
+ .withConflictStrategy(MergedSpecBuilder.MergeConflictStrategy.valueOf(mergeConflictStrategy.toUpperCase(java.util.Locale.ROOT)))
.buildMergedSpec());
LOGGER.info("Merge input spec would be used - {}", mergedSpec.get());
</file context>
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.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Adds a
mergeModeto improve multi-spec merging. DefaultREFpreserves the original $ref-based index; opt-inDEEPmerges paths by HTTP method and dedupes components with conflict handling.Bug Fixes
REF, keep first (or fail) inDEEP.DEEP).x-vendor extensions and deduplicate server URLs; addhttp://localhost:8080if none.New Features
mergeMode:REF(default, original behavior) orDEEP(inline merge with component dedupe/conflict detection). Exposed in CLI (--merge-mode), Gradle (mergeMode), and Maven (mergeMode).mergeConflictStrategy:WARN(default) orFAILforDEEP. Exposed in CLI (--merge-conflict-strategy), Gradle (mergeConflictStrategy), and Maven (mergeConflictStrategy)..yaml,.yml,.json; ignore invalid files; deterministic ordering; choose JSON output if the first spec is JSON.Written for commit f5f50a0. Summary will update on new commits.