Skip to content

Fix OpenAPI components.pathItems refs dropping operations#2292

Merged
joelrosario merged 2 commits intomainfrom
codex/fix-openapi-components-pathitems
Feb 22, 2026
Merged

Fix OpenAPI components.pathItems refs dropping operations#2292
joelrosario merged 2 commits intomainfrom
codex/fix-openapi-components-pathitems

Conversation

@nashjain
Copy link
Copy Markdown
Contributor

What:

  • Fix OpenAPI parsing/conversion for path-level $ref values that point to #/components/pathItems/*.
  • Add a parameterized regression test that covers both OpenAPI 3.0.1 and 3.1.0 with the same components.pathItems sample shape.

Why:

  • Specs using components.pathItems were failing validation on 3.0.1 (attribute components.pathItems is unexpected) and operations were being dropped (API Operations: 0) in both 3.0.1 and 3.1.0 test scenarios.

How:

  • Introduced parser preprocessing in OpenApiSpecification that inlines path-level #/components/pathItems/* refs into concrete path items before parsing.
  • Applied the same preprocessing path in both fromYAML(...) and checkSpecValidity(...).
  • For OpenAPI 3.0.x, removed components.pathItems after inlining to avoid parser warnings about unsupported attributes.
  • Kept existing additionalProperties preprocessing intact.

Checklist:

  • Unit Tests
  • Build passing locally (targeted tests were run; full suite not run)
  • Sonar Quality Gate (N/A)
  • Security scans don't report any vulnerabilities (N/A)
  • Documentation added/updated (share link) (N/A)
  • Sample Project added/updated (share link) (N/A)
  • Demo video (share link) (N/A)
  • Article on Website (share link) (N/A)
  • Roadmpap updated (share link) (N/A)
  • Conference Talk (share link) (N/A)

Issue ID:
Closes: N/A

Validation:

  • ./gradlew :specmatic-core:test --tests "io.specmatic.conversions.OpenApiSpecificationTest.checkSpecValidity should accept components pathItems references"
  • ./gradlew :specmatic-core:test --tests "io.specmatic.conversions.OpenApiSpecificationTest.should pass checkSpecValidity with valid openapi file" --tests "io.specmatic.conversions.OpenApiSpecificationTest.checkSpecValidity should throw ContractException when a valid openapi file gets parsed with issues" --tests "io.specmatic.conversions.OpenApiSpecificationTest.parser errors should be printed as a WARNING statement on the console"

@nashjain nashjain requested a review from joelrosario February 22, 2026 08:14
@github-actions
Copy link
Copy Markdown

Summary

Line coverage Branch coverage

Assembly Line coverage Branch coverage
application 58.7% 51.8%
application/backwardCompatibility 77.2% 62.1%
application/mcp 84.3% 89.2%
application/validate 1.3% 0%
io/specmatic/conversions 93.1% 80.3%
io/specmatic/conversions/lenient 93.9% 79.4%
io/specmatic/core 79.9% 62.7%
io/specmatic/core/azure 0% 0%
io/specmatic/core/config 57.7% 32.7%
io/specmatic/core/config/v1 98% 25%
io/specmatic/core/config/v2 91.9% 77.5%
io/specmatic/core/config/v3 49.5% 24.6%
io/specmatic/core/config/v3/components 71.4% 40%
io/specmatic/core/config/v3/components/runOptions 73% 44.7%
io/specmatic/core/config/v3/components/services 58.6% 50%
io/specmatic/core/config/v3/components/settings 98.3% 50%
io/specmatic/core/config/v3/components/sources 80% 59%
io/specmatic/core/config/v3/specmatic 65.3% 25%
io/specmatic/core/discriminator 53.2% 43.1%
io/specmatic/core/examples/module 43.3% 24.5%
io/specmatic/core/examples/server 70.4% 35.7%
io/specmatic/core/filters 83.3% 75.9%
io/specmatic/core/fuzzy 95.8% 92.7%
io/specmatic/core/git 8.1% 12.8%
io/specmatic/core/jsonoperator 58.4% 68.6%
io/specmatic/core/jsonoperator/value 85.7% 75.9%
io/specmatic/core/lifecycle 0% ****
io/specmatic/core/log 72.7% 52.8%
io/specmatic/core/matchers 76.7% 62.6%
io/specmatic/core/overlay 85.7% 58.3%
io/specmatic/core/pattern 87.1% 76.3%
io/specmatic/core/pattern/config 100% ****
io/specmatic/core/pattern/regex 94% 86.5%
io/specmatic/core/report 97.7% 92.8%
io/specmatic/core/route/modules 95.4% 87.5%
io/specmatic/core/utilities 64.8% 56.5%
io/specmatic/core/value 81.4% 71.5%
io/specmatic/core/wsdl/parser 80.9% 41.4%
io/specmatic/core/wsdl/parser/message 88.6% 67.8%
io/specmatic/core/wsdl/parser/operation 100% 100%
io/specmatic/core/wsdl/payload 71.7% 33.3%
io/specmatic/junit5/support 0% ****
io/specmatic/loader 80.4% 50.8%
io/specmatic/mcp/constants 0% ****
io/specmatic/mcp/report 0% 0%
io/specmatic/mcp/test 0% 0%
io/specmatic/mcp/test/client 0% 0%
io/specmatic/mcp/test/client/model 0% 0%
io/specmatic/mock 60.9% 57.3%
io/specmatic/proxy 66.5% 48.6%
io/specmatic/specmatic/core 100% ****
io/specmatic/specmatic/executable 100% ****
io/specmatic/specmatic/mcp 0% ****
io/specmatic/stub 77.3% 68.8%
io/specmatic/stub/listener 96.8% 90%
io/specmatic/stub/report 98.1% 75%
io/specmatic/test 73.6% 61.7%
io/specmatic/test/asserts 92.1% 86.6%
io/specmatic/test/fixtures **** ****
io/specmatic/test/handlers 90.3% 63.5%
io/specmatic/test/listeners 84.2% 54%
io/specmatic/test/matchers **** ****
io/specmatic/test/reports 69% 36.4%
io/specmatic/test/reports/coverage 96.9% 53.9%
io/specmatic/test/reports/coverage/console 85.8% 81%
io/specmatic/test/reports/coverage/html 0% 0%
io/specmatic/test/reports/renderers 12.4% 14%
io/specmatic/test/utils 92.1% 82%

@joelrosario joelrosario merged commit e7ca017 into main Feb 22, 2026
3 checks passed
@joelrosario joelrosario deleted the codex/fix-openapi-components-pathitems branch February 22, 2026 11:26
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.

2 participants