-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Array examples not accepting unnamed items #299
Comments
I see your problem. I'll add a new set of methods to allow you to define arrays of arrays with the each/min/max matchers. |
uglyog
pushed a commit
that referenced
this issue
Aug 6, 2016
I added new PactDslJsonBody()
.stringType('type', 'FeatureCollection')
.eachLike('features')
.stringType('type', 'Feature')
.object('geometry')
.stringType('type', 'Point')
.eachArrayLike('coordinates')
.decimalType(-7.55717)
.decimalType(49.766896)
.closeArray()
.closeArray()
.closeObject()
.object('properties')
.stringType('prop0', 'value0')
.closeObject()
.closeObject()
.closeArray() This generated the following JSON: {
"features": [
{
"geometry": {
"coordinates": [[-7.55717, 49.766896]],
"type": "Point"
},
"type": "Feature",
"properties": { "prop0": "value0" }
}
],
"type": "FeatureCollection"
} |
uglyog
pushed a commit
that referenced
this issue
Aug 7, 2016
That's brilliant, thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a consumer pact body that includes GeoJSON e.g.
"coordinates": [ [ [ -7.55717, 49.766896 ], [ -7.557159, 49.766807 ] ] ]
A response could hold any number of coordinates so I want to use eachLike() or minArrayLike().
.object("geometry") .stringType("type") .array("coordinates") .array() .minArrayLike(0) .decimalType() //unsupported .decimalType() //unsupported .closeObject() .closeArray() .closeArray() .closeArray() .closeObject();
However, neither of these methods allows the use of unnamed example items, so the above insists on using decimalType(String) which GeoJSON does not provide. As I can use unnamed types outside these methods I don't see why I can't use them inside the eachLike/minArrayLike/maxArrayLike functions
As a work around I tried leaving the coordinates array empty for Postel's law, but I ran into this issue #298
The text was updated successfully, but these errors were encountered: