-
Notifications
You must be signed in to change notification settings - Fork 149
global: Remove 'flow' child #2527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- update examples and tests
📝 WalkthroughWalkthroughThe GlobalInterceptor class annotation is updated to add Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
distribution/examples/extending-membrane/global-interceptor/apis.yaml (1)
1-1: Consider using a variable or latest version for the schema reference.The schema URL is hardcoded to version
v7.0.4.json. If this example is intended to work with multiple versions or be maintained long-term, consider whether this should reference a variable,latest, or be updated as part of release processes.distribution/src/test/java/com/predic8/membrane/examples/withoutinternet/test/GlobalInterceptorExampleTest.java (1)
17-21: Wildcard imports improve brevity.The switch to wildcard imports and static imports for
Header.*andRestAssured.*makes the code more concise. This is acceptable if it aligns with the project's coding style.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
core/src/main/java/com/predic8/membrane/core/interceptor/GlobalInterceptor.javadistribution/examples/extending-membrane/global-interceptor/README.mddistribution/examples/extending-membrane/global-interceptor/apis.yamldistribution/src/test/java/com/predic8/membrane/examples/withoutinternet/test/GlobalInterceptorExampleTest.java
🧰 Additional context used
🧬 Code graph analysis (1)
core/src/main/java/com/predic8/membrane/core/interceptor/GlobalInterceptor.java (6)
core/src/main/java/com/predic8/membrane/core/interceptor/flow/AbortInterceptor.java (1)
MCElement(32-56)core/src/main/java/com/predic8/membrane/core/interceptor/flow/RequestInterceptor.java (1)
MCElement(31-62)core/src/main/java/com/predic8/membrane/core/interceptor/flow/ResponseInterceptor.java (1)
MCElement(28-47)core/src/main/java/com/predic8/membrane/core/interceptor/flow/IfInterceptor.java (1)
MCElement(41-151)core/src/main/java/com/predic8/membrane/core/interceptor/flow/ForInterceptor.java (1)
MCElement(46-147)core/src/main/java/com/predic8/membrane/core/interceptor/chain/ChainInterceptor.java (1)
MCElement(32-73)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (java)
🔇 Additional comments (7)
distribution/examples/extending-membrane/global-interceptor/apis.yaml (2)
3-15: LGTM! Clean global interceptor configuration.The new structure places interceptors directly under the
global:key without theflow:wrapper, which aligns perfectly with the PR objective and thenoEnvelope = trueannotation change inGlobalInterceptor.java.
8-9: Wildcard CORS origin in example is acceptable.The
Access-Control-Allow-Origin: "*"configuration allows any origin to access the API. This is acceptable for an example/demonstration, but production deployments should restrict this to specific trusted origins.distribution/examples/extending-membrane/global-interceptor/README.md (2)
14-19: LGTM! Updated endpoints reflect the example APIs.The curl commands have been updated to include paths
/fooand/bar. Since the APIs inapis.yamluse simplereturninterceptors without specific path restrictions, these paths (or any other paths) should work correctly. The path choice helps demonstrate that the global interceptor applies to all requests regardless of the path.
21-21: Correct update to reference the new YAML configuration.The documentation now correctly references
apis.yamlinstead ofproxies.xml, which aligns with the shift to YAML-based configuration demonstrated in this PR.distribution/src/test/java/com/predic8/membrane/examples/withoutinternet/test/GlobalInterceptorExampleTest.java (2)
32-32: LGTM! Package-private visibility is appropriate for JUnit 5.JUnit 5 doesn't require test methods to be public, so using package-private (default) visibility is a recommended practice that reduces unnecessary boilerplate.
Also applies to: 45-45
39-40: CONTENT_TYPE constant correctly resolves to "Content-Type" and matches the YAML configuration.The test assertions are correct:
Access-Control-Allow-Methods: "GET, POST"matches apis.yaml configuration at line 12Access-Control-Allow-Headers: CONTENT_TYPEcorrectly usesHeader.CONTENT_TYPE, which resolves to"Content-Type"as specified in apis.yaml line 15Both test methods (lines 39-40 and 52-53) verify the CORS headers properly.
core/src/main/java/com/predic8/membrane/core/interceptor/GlobalInterceptor.java (1)
25-25: LGTM! Annotation change aligns with similar interceptors.Adding
noEnvelope = trueis consistent with other flow interceptors likeResponseInterceptor,RequestInterceptor, andAbortInterceptor. This allows child interceptors to be placed directly under theglobal:key in YAML configurations without requiring a wrapper element. The existing example configuration in./distribution/examples/extending-membrane/global-interceptor/apis.yamlalready demonstrates this pattern in use with direct nesting of interceptors.
|
This pull request needs "/ok-to-test" from an authorized committer. |
|
/ok-to-test |
Interceptors are placed directly under global
Summary by CodeRabbit
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.