D
02/03/2025, 8:51 AMsomeProxies array[object] or null
name string or null
enabled boolean
defaultSettlement integer<int32> or null
Allowed values:
1 2 null
My consumer contract contains this
"someProxies ": [
{
"defaultSettlement": null,
"enabled": true,
"name": "My Settlement"
}
However I get this error for the "defaultSettlement"
Response body is incompatible with the response body schema in the spec file: must be equal to one of the allowed values
Can anyone help figure out whats going wrong here?
ps. I am using null, because I cant figure out a way cast to int due to the way the nullable definition is set up.Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
D
02/03/2025, 10:23 AM{
"openapi": "3.0.1",
"info": {
"title": "A Test Service",
"version": "v1"
},
"paths": {
...
},
"components": {
"schemas": {
"CcySettings": {
"type": "object",
"properties": {
"MyProxies": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MyProxy"
},
"nullable": true
}
},
"additionalProperties": false
},
"MyProxy": {
"type": "object",
"properties": {
"name": {
"type": "string",
"nullable": true
},
"enabled": {
"type": "boolean"
},
"defaultSettlement": {
"enum": [
1,
2
],
"type": "integer",
"format": "int32",
"nullable": true
}
},
"additionalProperties": false
},
}
}
}Matt (pactflow.io / pact-js / pact-go)
openapi: 3.1.0
info:
title: A Test Service
version: v1
paths:
/get:
get:
operationId: getAnimalByID
responses:
"200":
description: successful operation
content:
"application/json":
schema:
$ref: '#/components/schemas/MyProxy'
components:
schemas:
MyProxy:
type: object
properties:
name:
type:
- string
- 'null'
enabled:
type: boolean
defaultSettlement:
oneOf:
- type: 'null'
- type: integer
enum:
- 1
- 2
format: int32
additionalProperties: false
When using nullable in 3.0.1 I can’t get it to pass. It’s like nullable is being ignore somehowMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Slackbot
02/03/2025, 10:50 AMMatt (pactflow.io / pact-js / pact-go)
openapi: 3.0.1
info:
title: A Test Service
version: v1
paths:
/get:
get:
operationId: getAnimalByID
responses:
"200":
description: successful operation
content:
"application/json":
schema:
$ref: '#/components/schemas/MyProxy'
components:
schemas:
MyProxy:
type: object
properties:
name:
type: string
nullable: true
enabled:
type: boolean
defaultSettlement:
oneOf:
- type: integer
enum:
- 1
- 2
format: int32
- type: object
nullable: true
additionalProperties: falseMatt (pactflow.io / pact-js / pact-go)
D
02/04/2025, 4:00 AMMatt (pactflow.io / pact-js / pact-go)