Add XML conversion to bodies, and fix XML data conversion #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Because in XML everything is a string, there can be problems to validating against a schema that includes other primitive types. Now, we convert the strings based on the schema types. If the property is a boolean, we convert to a boolean to pass the validation. If the value is not a valid boolean, we do nothing to let the schema validation to raise an error.
Also, now we are validating if the payload includes prefixes and namespaces defined in the schema (the XMLNS feature of XML).
Added a new option to
ValidationOptions:AllowXMLBodyValidationto enable XML validations in request/response bodies (the default isfalse). Created a functionWithXmlBodyValidationto enable the new validator option.No breaking changes with the new code, as the updated function was internal, and the XML body validation setting is
falseby default.