pact-foundation / pact-specification

Describes the pact format and verification specifications
MIT License
292 stars 28 forks source link

Serialisation of ProviderStateGenerator #92

Closed mefellows closed 2 years ago

mefellows commented 2 years ago

The docs for the provider state generator indicate the serialisation format should be:

{"expression": "/api/user/${id}", type": "ProviderStateGenerator"}

However, the rust core seems to produce a value that is simply ProviderState. See this example interaction produced from the latest (0.1.6) FFI from the Pact JS repository:

    {
      "description": "a request to get the account details",
      "providerStates": [
        {
          "name": "Account Test001 exists",
          "params": {
            "accountRef": "Test001"
          }
        }
      ],
      "request": {
        "generators": {
          "query": {
            "$.accountNumber[0]": {
              "expression": "${accountNumber}",
              "type": "ProviderState"
            }
          }
        },
        "headers": {
          "Accept": "application/hal+json"
        },
        "matchingRules": {
          "header": {},
          "query": {
            "$.accountNumber[0]": {
              "combine": "AND",
              "matchers": [
                {
                  "match": "type"
                }
              ]
            }
          }
        },
        "method": "GET",
        "path": "/accounts/search/findOneByAccountNumberId",
        "query": {
          "accountNumber": [
            "100"
          ]
        }
      },

I'm assuming the docs are incorrect?

uglyog commented 2 years ago

The docs are wrong

mefellows commented 2 years ago

I'll fix, thanks.