Skip to content

fix Openapi dir resolving#2941

Open
christiangoerdes wants to merge 3 commits into
masterfrom
openapi-dir-resolving
Open

fix Openapi dir resolving#2941
christiangoerdes wants to merge 3 commits into
masterfrom
openapi-dir-resolving

Conversation

@christiangoerdes
Copy link
Copy Markdown
Collaborator

@christiangoerdes christiangoerdes commented May 12, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Fixed directory path resolution for loading OpenAPI documents to properly handle relative paths and file URIs against the configured base location, ensuring the correct directory is scanned when relative paths are provided.
  • Tests

    • Added test coverage to verify OpenAPI specifications load correctly from directories relative to the base location.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dae6a78a-1295-4bd2-b745-b04d1a13f3ad

📥 Commits

Reviewing files that changed from the base of the PR and between 1af0001 and fff6a30.

📒 Files selected for processing (2)
  • core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/OpenAPIRecordFactory.java
  • core/src/test/java/com/predic8/membrane/core/openapi/serviceproxy/OpenAPIRecordFactoryTest.java

📝 Walkthrough

Walkthrough

The getOpenAPIFiles method now resolves directory names against a baseLocation and normalizes file URIs before enumerating OpenAPI specification files. A corresponding test validates that relative directory paths are correctly resolved and produce the expected OpenAPI records.

Changes

Base Location Relative Path Resolution

Layer / File(s) Summary
Directory path resolution logic
core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/OpenAPIRecordFactory.java
getOpenAPIFiles now resolves the input directoryName against baseLocation, converts file: URIs via pathFromFileURI, and constructs the File from the normalized path instead of using the input directly.
Test for relative directory resolution
core/src/test/java/com/predic8/membrane/core/openapi/serviceproxy/OpenAPIRecordFactoryTest.java
New test readsDirectoryRelativeToBaseLocation configures an OpenAPISpec with a relative directory path, verifies that records are created from the resolved location, and asserts expected record count and presence of specific IDs.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested Reviewers

  • predic8

Poem

🐰 A path once wandered, straight and true,
Now bends toward the base it knew,
File URIs transform and bend,
Relative paths extend and mend—
OpenAPI records, found with care,
Where baseLocation leads them there.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix Openapi dir resolving' directly addresses the main change: modifying how OpenAPI directory paths are resolved, particularly handling relative paths and file URIs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch openapi-dir-resolving

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@christiangoerdes
Copy link
Copy Markdown
Collaborator Author

/ok-to-test

@christiangoerdes christiangoerdes linked an issue May 12, 2026 that may be closed by this pull request
@membrane-ci-server
Copy link
Copy Markdown

This pull request needs "/ok-to-test" from an authorized committer.

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.

OpenAPI: dir resolving not from conf

1 participant