Open YingzheHeBetty opened 3 years ago
CSV matching is not supported (except in Pact Ruby). You can only do exact string matching unfortunately.
I think this is a valid concern, so re-opening
This highlights a deeper issue, how can we provide an extension mechanism for formats that don't have a default implementation. Maybe shared libraries, or possibly an embedded scripting language so that support for other formats can be easily added.
The ruby one allows you to configure a differ based on the content type, so you can write your own. That's why it has the CSV support.
I assume that needs to be written in Ruby and made available to the underlying Ruby engine. That you can't write it in the language being used? I was thinking of something like an API that allows extensions to be added in a generic way.
I looked into this when spiking protobufs. Golang has very good support for cross platform plugins, and I showed that I could integrate that into rust as a lib. But then I just thought about the complexitybthay might result it.
A possibly better alternative is to have the plugin expose an well defined API interface and register with the system. This would have the upside of allowing anyone to write a plugin in any language and would require them contributing it back (the downside is they will be written in many languages 😂)
The ruby one allows you to configure a differ based on the content type, so you can write your own. That's why it has the CSV support.
Could you provide more details/examples on CSV support? In my case, my consumer is written in ruby and my provider is written in JVM. Is there any way that I could verify CSV format response body?
I haven't touched it for years, but here are the docs https://www.rubydoc.info/gems/pact-csv/0.0.1
I haven't touched it for years, but here are the docs https://www.rubydoc.info/gems/pact-csv/0.0.1
Is it possible to verify non-json format response body? If my provider is written in Java?
This highlights a deeper issue, how can we provide an extension mechanism for formats that don't have a default implementation. Maybe shared libraries, or possibly an embedded scripting language so that support for other formats can be easily added.
It would be very useful to have it added into pact testing!
A prototype CSV plugin has been written. See https://github.com/pact-foundation/pact-plugins/tree/main/plugins/csv
Hi, I have a pact file like this:
When I verified it on the provider side, the test failed:
Any solutions? Thank you!