Skip to content
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

Request to provider failed with an exception: "/" is not allowed in an identifier in path expression #1556

Closed
topsycreed opened this issue May 19, 2022 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@topsycreed
Copy link

Hey!

Steps to reproduce:
Sent a get request to endpoint:
Method:GET Path:/shipping/v1 Headers: { "Accept": "application/json", "site": "US", "Content-Type": "application/json" }
That returning response body with '/' symbols, for example:
{ "data": [ { "relationships": { "user/shippingAddress": { "data": { "id": "123", "type": "user/shipping-address" } } } } ] }

Actual:
At Pact you will see exception:
Request to provider failed with an exception: "/" is not allowed in an identifier in path expression "$.data[0].relationships.user/shippingAddress.data.id" at index 28 (au.com.dius.pact.core.model.InvalidPathExpression)

Expected:
Test should be passed successfully, since it's already implemented on service end to return such response and consumers expected that.

@rholshausen rholshausen added the bug Indicates an unexpected problem or unintended behavior label Jun 9, 2022
@rholshausen
Copy link
Contributor

I am not able to replicate this issue with Pact-JVM. See example tests: Consumer and Provider

I did notice that the pact file generated from that consumer test (see pact) has the slash escaped $.data[*].relationships['user/shippingAddress'].data.id, while the error you provided has $.data[0].relationships.user/shippingAddress.data.id which is not valid.

How have you generated the Pact file that was used in your test?

@topsycreed
Copy link
Author

Hey @rholshausen thanks for your support! We were able to fix the issue from Consumer side as you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants