-
Notifications
You must be signed in to change notification settings - Fork 234
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
Adding support for XML response expectation expressions #478
Comments
There are no plans to do this at present, no. I'm not sure how the JS one works because the Pact Spec doesn't say anything about XML support either. |
Thanks, @adamrodger. Matt pointed me to this, though: https://github.com/pact-foundation/pact-compatibility-suite/blob/d22d4667c0bda76d408676044cb33db834e7167e/features/V1/http_consumer.feature#L5C1-L16 There’s some scenarios around XML in there. I’m not 100% that means XML is a first class citizen in the Pact spec, though. It is telling that there are only two bindings that claim to provide XML support (JS and JVM). |
There are XML test cases in the spec: pact-foundation/pact-specification@362b15a But, this is one of the grey areas where the compatibility suite augments the spec. The specification is more concerned about the serialisation of the pact file, and to an extent, agnostic to certain content-types and behaviours. As discussed in our strategy work earlier this year, the objective of the compatibility suite is to help clarify the behaviours that are either not described or ambiguous in the spec itself. Let's leave this open as a feature request. I don't believe it would be a huge amount of work to add XML given the infrastructure already available to .NET. See https://github.com/pact-foundation/pact-js/tree/master/src/v3/xml for how JS implements it over the FFI. |
The test cases may mention XML but it doesn't appear anywhere in the spec. I imagine that's why it doesn't have wider adoption, as the spec only ever mentions JSON (and kinda multipart form, but not really) as the supported body format. Obviously there are plugins that can add further ones, but those are implicitly out of spec. XML is a more complicated format than JSON and so if we're supporting it properly in the spec then a few test case examples aren't really enough. For example:
That's why XML really needs XML Schema along with it to properly validate it. Only in the most simple circumstances will it work like JSON does, and it will fall down very quickly if we say we support XML without specifying what happens with those semantics. JSON doesn't have to worry about things like that. ECMA 404 (the JSON spec) only defines valid syntax without any semantics attached so matching rules are much more straightforward. |
Is it true that XML is supported already for JVM, JS and Rust? I have a client that requires .NET support so wondering how far on the horizon the support could be for handling language porting. |
Are there any plans to add support to Pact .Net for XML response body expectations similar to what is possible in PactJS like documented here: https://docs.pact.io/implementation_guides/javascript/docs/xml#support
?
The text was updated successfully, but these errors were encountered: