Skip to content

Conversation

@ySnoopyDogy
Copy link
Contributor

The new XML validation functions just convert the data to JSON before validating the schema. With that we can just convert the data on Request and Response validations just by looking at the content type.

The XML conversion have some peculiarities, like a password field of "123456" being converted into an integer and failing validation, and the boolean conversions failing because of string fields. Because of that, I let the option to enable XML conversion default to false. If the user does not explicit enables the XML Validation, the validation is ignored just like today.

Using the option to validate XML bodies inside the Request/Response validation, we can benefit the schema compilation code.

No breaking changes with the new code

@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

❌ Patch coverage is 96.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.55%. Comparing base (cadff75) to head (1d1f518).

Files with missing lines Patch % Lines
responses/validate_body.go 95.12% 2 Missing ⚠️
requests/validate_body.go 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
- Coverage   97.58%   97.55%   -0.04%     
==========================================
  Files          56       56              
  Lines        5176     5235      +59     
==========================================
+ Hits         5051     5107      +56     
- Misses        125      128       +3     
Flag Coverage Δ
unittests 97.55% <96.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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