Emil_Fernandez | 2023-12-27 16:42:08 UTC | #1
we made an action with this output contract the json of the output contract is:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"searchMemberbyPhoneSet": {
"type": "object",
"properties": {
"searchMemberByPhone": {
"type": "array",
"items": {
"type": "object",
"properties": {
"clientId": {
"type": "string"
},
"nationalityId": {
"type": "string"
},
"active": {
"type": "string"
},
"language": {
"type": "string"
},
"telNumber": {
"type": "string"
},
"clientType": {
"type": "string"
},
"mobNumber2": {
"type": "string"
},
"surname": {
"type": "string"
},
"mobNumber1": {
"type": "string"
},
"contractId": {
"type": "string"
},
"name": {
"type": "string"
},
"contractCode": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"memberId": {
"type": "string"
}
},
"required": [
"clientId",
"nationalityId",
"active",
"language",
"telNumber",
"clientType",
"mobNumber2",
"surname",
"mobNumber1",
"contractId",
"name",
"contractCode",
"email",
"memberId"
]
}
}
}
}
},
"required": [
"searchMemberbyPhoneSet"
]
}
but we have an error 400:
{ "message": "JSON failed output schema validation for the following reasons: Schema: # @/properties/searchMemberbyPhoneSet/properties/searchMemberByPhone. Error location: /searchMemberbyPhoneSet/searchMemberByPhone. instance type (object) does not match any allowed primitive type (allowed: [\"array\"])", "code": "invalid.schema", "status": 400, "messageParams": {}, "contextId": "8b611d74-388d-423a-ba53-4f96da756459", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [] }
can you help me to translate this to a valid schema?
thanks and best regards.
Jerome.Saint-Marc | 2024-01-02 16:15:40 UTC | #2
Hello,
There is likely something different between what you declared in your output contract, and the shape of the response you are getting from your web service. Can you post/share a sample response that you get from your API (to compare with your output contract and check if it is properly defined)?
Regards,
Emil_Fernandez | 2024-01-24 00:39:13 UTC | #3
hi Jerome, the error was in the output contract, the first object was empty and have another object inside, and thisobject has another inside with all the properties like this JSON:
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "searchMemberbyPhoneSet" ], "properties": { "searchMemberbyPhoneSet": { "type": "object", "properties": { "searchMemberByPhone": { "type": "object", "properties": { "clientId": { "type": "string" }, "nationalityId": { "type": "string" }, "active": { "type": "string" }, "language": { "type": "string" }, "telNumber": { "type": "string" }, "clientType": { "type": "string" }, "mobNumber2": { "type": "string" }, "surname": { "type": "string" }, "mobNumber1": { "type": "string" }, "contractId": { "type": "string" }, "name": { "type": "string" }, "contractCode": { "type": "string" }, "email": { "type": "string", "format": "email" }, "memberId": { "type": "string" } }, "additionalProperties": true } }, "additionalProperties": true } }, "additionalProperties": true
we have a 200 ok response with this output contract JSON.
thanks for your reply.
greetings.
system | 2024-02-23 00:40:03 UTC | #4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 23866