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

ProviderStateParameters - are defaulting to String #1771

Open
lushilling opened this issue Feb 27, 2024 · 1 comment
Open

ProviderStateParameters - are defaulting to String #1771

lushilling opened this issue Feb 27, 2024 · 1 comment

Comments

@lushilling
Copy link

lushilling commented Feb 27, 2024

This is still an issue with Pact-JVM too

my consumer tests are written in Pact-JS
it logs the value as the correct type
pact_matching::json: compare_values: Calling match_values for path $.userId pact_matching::json: JSON -> JSON: Comparing '1' to '1' using Type -> Ok(()) pact_matching::json: compare_values: Comparing 'Number(1)' to 'Number(1)' at path '$.userId' -> Ok(())

Pact file created

"generators": {
          "body": {
            "$.userId": {
              "expression": "${userId}",
              "type": "ProviderState"
            }
          }
        }

Provider written in Java -> logs

2024-02-26 17:12:18,369 DEBUG ll=DEBUG c=a.c.d.p.p.ProviderClient t=main 	method: POST
path: /login
	query: {}
	headers: {Accept=[application/json], Content-Type=[application/json]}
	matchers: MatchingRules(rules={body=MatchingRuleCategory(name=body, matchingRules={$.userId=MatchingRuleGroup(rules=[au.com.dius.pact.core.model.matchingrules.TypeMatcher@346330b6], ruleLogic=AND, cascaded=false)}), header=MatchingRuleCategory(name=header, matchingRules={}), path=MatchingRuleCategory(name=path, matchingRules={}), query=MatchingRuleCategory(name=query, matchingRules={})})
	generators: Generators(categories={BODY={$.smUserId=ProviderStateGenerator(expression=${smUserId}, dataType=RAW)}})
	body: PRESENT({"userId":"829152765"})
@lushilling
Copy link
Author

lushilling commented Feb 27, 2024

Looks like this comment has the same issue
pact-foundation/pact-reference#116 (comment)

I've found a workaround but its not suitable for all my test cases
(I have to hardcode the values on the consumer side, and remove fromProviderState)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant