spring-cloud-contract icon indicating copy to clipboard operation
spring-cloud-contract copied to clipboard

boolean values are omitted when generate a RequestResponsePact from a Contract

Open mathieu-amblard opened this issue 2 years ago • 1 comments

I am using the ToFileContractsTransformer in version 3.0.4 to generate a PACT file from a Contract for HTTP as described in the reference documentation : https://docs.spring.io/spring-cloud-contract/docs/3.0.0/reference/htmlsingle/#how-to-generate-pact-from-scc.

My Contract looks like this :

package com.test

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    description("""
Some description...
""")
    request {
       ...
    }
    response {
        body(
                [[
                         number  : 1,
                         string      : "Some string",
                         bool        : true
                 ]]
        )
    }
}

The generate PACT file looks like this :

{
    "provider": {
        "name": "..."
    },
    "consumer": {
        "name": "..."
    },
    "interactions": [
        {
            "description": "Some description",
            "request": {
                ...
            },
            "response": {
                "body" : "[{\"number\":1,\"string\":\"Some string\"}]",
            }
        }
    ],
    "metadata": {
        "pactSpecification": {
            "version": "3.0.0"
        },
        "pact-jvm": {
            "version": "4.0.10"
        }
    }
}

I have also tried by setting the response body as string and I get the same result.

Is there another way to declare boolean values in request or response body ?

Thanks in advance.

mathieu-amblard avatar Dec 06 '21 08:12 mathieu-amblard

That should work, it looks like a bug

marcingrzejszczak avatar Dec 06 '21 09:12 marcingrzejszczak

PactConverter has been removed in Spring Cloud Contract 4.0.0 so we're not planning on doing additional work for it. We're working with the Pact Foundation to move the support to the foundation.

marcingrzejszczak avatar Apr 26 '23 13:04 marcingrzejszczak