Skip to content

WSDL Validator: Support for Emtpy Messages#2955

Merged
rrayst merged 4 commits into
masterfrom
wsdl-validator-emtpy-messages
May 26, 2026
Merged

WSDL Validator: Support for Emtpy Messages#2955
rrayst merged 4 commits into
masterfrom
wsdl-validator-emtpy-messages

Conversation

@predic8
Copy link
Copy Markdown
Member

@predic8 predic8 commented May 26, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved SOAP/WSDL handling to skip validation for empty response bodies and to correctly handle messages with no defined parts (prevents spurious validation errors).
  • Tests

    • Added test and sample WSDL to cover messages without parts, ensuring parsing and validation behave as expected.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 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: 71c27a6c-07f3-47ea-a3b2-ef38d136aaad

📥 Commits

Reviewing files that changed from the base of the PR and between 05274fb and 13c3a09.

📒 Files selected for processing (1)
  • core/src/test/java/com/predic8/membrane/core/util/soap/WSDLParserTest.java

📝 Walkthrough

Walkthrough

Adds null-safe handling for WSDL messages with no parts, filters null parts in the extractor, updates WSDLValidator to skip empty-response bodies and branch on flow state, standardizes imports, and adds a test + WSDL fixture for empty messages.

Changes

WSDL Empty Message Handling and Validator Logic

Layer / File(s) Summary
Message part null-safety
core/src/main/java/com/predic8/membrane/core/util/wsdl/parser/Message.java
getPart() now returns null when no parts are defined; Javadoc updated to document "first part or null if no part is defined".
Message element extractor null filtering
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLMessageElementExtractor.java
Document-style parts pipeline filters out null results from Message::getPart to prevent downstream consumers from seeing missing parts.
WSDLValidator response and element validation
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLValidator.java
Early return for empty RESPONSE flow messages; element validation branches on Interceptor.Flow state rather than runtime instanceof checks while preserving SOAP fault handling.
AbstractXMLSchemaValidator import cleanup
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/AbstractXMLSchemaValidator.java
Wildcard imports replaced with explicit imports; local variable type changed from explicit List<Validator> to var.
Test coverage for empty messages
core/src/test/java/com/predic8/membrane/core/util/soap/WSDLParserTest.java, core/src/test/resources/ws/special/empty-message.wsdl
New emptyMessage test verifies parsing of messages with zero parts; new WSDL test resource defines CityResponse message with no parts.

🎯 3 (Moderate) | ⏱️ ~20 minutes


Possibly Related PRs

  • membrane/api-gateway#2871: Both PRs directly modify WSDLValidator.validateMessage response validation control flow and fault-handling logic.

Suggested Reviewers

  • rrayst

🐰 I found a WSDL with nothing inside,

so I hopped and made the code more wide-eyed.

Nulls are filtered, validators neat,

Tests added too — now parsing's complete! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 contains a typo ('Emtpy' instead of 'Empty') and clearly describes the main change: adding support for empty WSDL messages in the validator.
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 wsdl-validator-emtpy-messages

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLValidator.java (1)

104-107: 💤 Low value

Consider the log level and request handling.

Two observations:

  1. Log level: Using log.info() for skipping validation of empty responses might be verbose. Consider log.debug() since this is an expected condition that doesn't require operator attention.

  2. Request handling: This early return only applies to RESPONSE flow. Should empty request bodies also skip validation, or is this response-specific by design?

The response-only handling appears intentional based on the PR scope (WSDL operations can have empty responses), but verifying the design intent would be helpful.

💡 Optional: Change to debug level
-            log.info("Skipping validation of empty response.");
+            log.debug("Skipping validation of empty response.");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLValidator.java`
around lines 104 - 107, In WSDLValidator update the log level for the
empty-response early-return: in the conditional that checks (flow ==
Interceptor.Flow.RESPONSE && message.isBodyEmpty()) replace the use of
log.info(...) with log.debug(...) so skipping validation of expected empty
responses is logged at a debug level; keep the early return behavior as-is
(response-only) since this PR is response-scoped but confirm separately if empty
requests should also be skipped in a future change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/src/test/java/com/predic8/membrane/core/util/soap/WSDLParserTest.java`:
- Around line 199-217: The test emptyMessage in WSDLParserTest should verify the
new null-return behavior of Message.getPart(): after locating the Message
instance (msg) with name "CityResponse" and asserting msg.getParts().size() ==
0, add an assertion that msg.getPart() returns null (or is null) to cover the PR
change to Message.getPart(). Ensure you reference the same msg variable and keep
the check right after the existing part-size assertion.

---

Nitpick comments:
In
`@core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLValidator.java`:
- Around line 104-107: In WSDLValidator update the log level for the
empty-response early-return: in the conditional that checks (flow ==
Interceptor.Flow.RESPONSE && message.isBodyEmpty()) replace the use of
log.info(...) with log.debug(...) so skipping validation of expected empty
responses is logged at a debug level; keep the early return behavior as-is
(response-only) since this PR is response-scoped but confirm separately if empty
requests should also be skipped in a future change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f8f6c152-d840-4d4d-8913-ecd6c2b109bd

📥 Commits

Reviewing files that changed from the base of the PR and between b6622e0 and 05274fb.

📒 Files selected for processing (6)
  • core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/AbstractXMLSchemaValidator.java
  • core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLMessageElementExtractor.java
  • core/src/main/java/com/predic8/membrane/core/interceptor/schemavalidation/WSDLValidator.java
  • core/src/main/java/com/predic8/membrane/core/util/wsdl/parser/Message.java
  • core/src/test/java/com/predic8/membrane/core/util/soap/WSDLParserTest.java
  • core/src/test/resources/ws/special/empty-message.wsdl

@rrayst rrayst merged commit f44812c into master May 26, 2026
4 of 5 checks passed
@rrayst rrayst deleted the wsdl-validator-emtpy-messages branch May 26, 2026 14:39
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