Skip to content

fix(MergedSpecBuilder): merge path items by HTTP method instead of overwriting on path collision#24100

Draft
Picazsoo wants to merge 4 commits into
OpenAPITools:masterfrom
Picazsoo:feature/merge-specs
Draft

fix(MergedSpecBuilder): merge path items by HTTP method instead of overwriting on path collision#24100
Picazsoo wants to merge 4 commits into
OpenAPITools:masterfrom
Picazsoo:feature/merge-specs

Conversation

@Picazsoo

@Picazsoo Picazsoo commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Fixes OpenAPI merging to combine colliding paths by HTTP method and keep both operations. Builds a full merged spec with deduped components/servers and preserved vendor extensions.

  • Bug Fixes

    • Merge path items by method; warn on duplicate path+method and keep the first.
    • Merge components by name; dedupe identical ones; warn on conflicts.
    • Preserve x- vendor extensions on paths, operations, and schemas.
    • Deduplicate server URLs; add http://localhost:8080 if none exist.
  • Refactors

    • Build and serialize a full OpenAPI model via swagger Json/Yaml mappers.
    • Only process .yaml, .yml, .json; ignore invalid files; deterministic ordering; choose JSON output if the first spec is JSON.
    • Add tests for path collisions, component merging, vendor extensions, identical duplicates, non-spec files, and conflict warnings; update petstore-v3.1.yaml operationIds to avoid test collisions.

Written for commit 818f196. Summary will update on new commits.

Review in cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant