Skip to content

ProviderStateParameters - are defaulting to String #1110

@lushilling

Description

@lushilling

In the Provider test, I am setting a number value in the request body. However when the test runs its converts it from an Integer to String.

In my consumer everything works and contract generated correctly:
I have the following line in my request body
accountId: fromProviderState('${accountId}', accountId)

In the debug logs I can see it populating correctly with correct type

Calling match_values for path $.accountId
Comparing '1686819389' to '1686819389' using Type -> Ok(())
Comparing 'Number([1686819389](tel:1686819389))' to 'Number([1686819389](tel:1686819389))' at path '$.accountId' -> Ok(())
body: '{……..  ,"accountId":1686819389}'

In my provider:

int accountId = 2;
providerStateParameters.put(ACCOUNT_ID, accountId);

In the debug logs:

****I set my account id as: 1689080143238***
body: PRESENT({………..,"accountId":"1689080143238"})

Both consumer (pact-js) and provider (pact-jvm) are on the latest version

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageThis issue is yet to be triaged by a maintainerupstreamIndicates that an issue relates to an upstream problem (such as in pact-reference)

    Type

    No type

    Projects

    Status

    New Issue

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions