Request and Response validation using schema file

I want to validate an API request and response against the swagger json file.
This works fine, as long as I have a body or response

I my case I never have a request body, I only pass parameters.
When the httpcode 204 No Content is return I also don’t have a response body.

How can I validate against and empty request body or response body.

thx.

my request and response are below:

{
  "log" : {
    "version" : "1.2",
    "pages" : [ ],
    "entries" : [ {
      "startedDateTime" : "2023-10-25T13:18:52.853Z",
      "request" : {
        "method" : "GET",
        "url" : "https://xxxx/dev/Transaction?storeId=xxxx&transactionCode=xxx",
        "httpVersion" : "",
        "cookies" : [ ],
        "headers" : [ {
          "name" : "Authorization",
          "value" : "Bearer xxxxxxxxx"
        } ],
        "queryString" : [ {
          "name" : "storeId",
          "value" : "xxxx"
        }, {
          "name" : "transactionCode",
          "value" : "xxx"
        } ],
        "headersSize" : 0,
        "bodySize" : 0,
        "comment" : ""
      },
      "response" : {
        "status" : 204,
        "statusText" : "",
        "httpVersion" : "",
        "cookies" : [ ],
        "headers" : [ {
          "name" : "Strict-Transport-Security",
          "value" : "max-age=15724800; includeSubDomains"
        }, {
          "name" : "#status#",
          "value" : "HTTP/1.1 204 No Content"
        }, {
          "name" : "Content-Length",
          "value" : "0"
        }, {
          "name" : "Date",
          "value" : "Wed, 25 Oct 2023 13:18:50 GMT"
        } ],
        "content" : {
          "size" : 0,
          "mimeType" : "",
          "text" : "",
          "comment" : ""
        },
        "redirectURL" : "",
        "headersSize" : 108,
        "bodySize" : 0,
        "comment" : ""
      },
      "cache" : { },
      "timings" : {
        "comment" : "",
        "connect" : 0,
        "wait" : 0,
        "send" : 0,
        "receive" : 0,
        "dns" : -1,
        "blocked" : -1,
        "ssl" : -1
      },
      "comment" : "",
      "_katalonRequestInformation" : {
        "name" : "4",
        "testObjectId" : "Object Repository/Transactions Read Service_Dev/_TransactionsRead_Transaction/get-transaction",
        "harId" : "47a0c846-e3c3-4b53-8fc0-b345903b5458",
        "reportFolder" : null
      },
      "time" : 0
    } ],
    "comment" : ""
  }
}

my json file to validate against is below

`{
     "$schema": "http://json-schema.org/draft-06/schema#",   
    "openapi": "3.0.1",
    "info": {
        "title": "Transactions Read Service_Dev",
        "version": "1.0"
    },
    "servers": [
        {
            "url": "https:/xxx/dev/"
        }
    ],
    "paths": {
        "/TransactionsRead/Search": {
            "post": {
                "tags": [
                    "Transaction"
                ],
                "summary": "/Search - POST",
                "operationId": "post-search",
                "parameters": [
                    {
                        "name": "storeId",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "pagenum",
                        "in": "query",
                        "description": "Format - int32.",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    },
                    {
                        "name": "pagesize",
                        "in": "query",
                        "description": "Format - int32.",
                        "schema": {
                            "type": "integer",
                            "format": "int32"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DTO_SearchFilter"
                            },
                            "example": {
                                "employeeId": "string",
                                "pauzed": "Yes",
                                "fromDate": "string",
                                "toDate": "string",
                                "transactionCode": "string",
                                "businessPartnerId": "string",
                                "businessPartnerName": "string",
                                "sortTransactionDate": "Ascending"
                            }
                        },
                        "text/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DTO_SearchFilter"
                            },
                            "example": {
                                "employeeId": "string",
                                "pauzed": "Yes",
                                "fromDate": "string",
                                "toDate": "string",
                                "transactionCode": "string",
                                "businessPartnerId": "string",
                                "businessPartnerName": "string",
                                "sortTransactionDate": "Ascending"
                            }
                        },
                        "application/*+json": {
                            "schema": {
                                "$ref": "#/components/schemas/DTO_SearchFilter"
                            },
                            "example": {
                                "employeeId": "string",
                                "pauzed": "Yes",
                                "fromDate": "string",
                                "toDate": "string",
                                "transactionCode": "string",
                                "businessPartnerId": "string",
                                "businessPartnerName": "string",
                                "sortTransactionDate": "Ascending"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/DTO_Search_Result"
                                },
                                "examples": {
                                    "default": {
                                        "value": null
                                    }
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DTO_Search_Result"
                                },
                                "example": {
                                    "totalCount": 0,
                                    "pageNum": 0,
                                    "pageSize": 0,
                                    "transactions": [
                                        {
                                            "transactionCode": "string",
                                            "transactionDate": "string",
                                            "status": "string",
                                            "transactionType": "string",
                                            "businessPartnerId": "string",
                                            "businessPartnerName": "string",
                                            "totalAmount": 0,
                                            "updateDate": "string"
                                        }
                                    ]
                                }
                            },
                            "text/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DTO_Search_Result"
                                },
                                "example": {
                                    "totalCount": 0,
                                    "pageNum": 0,
                                    "pageSize": 0,
                                    "transactions": [
                                        {
                                            "transactionCode": "string",
                                            "transactionDate": "string",
                                            "status": "string",
                                            "transactionType": "string",
                                            "businessPartnerId": "string",
                                            "businessPartnerName": "string",
                                            "totalAmount": 0,
                                            "updateDate": "string"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                },
                                "examples": {
                                    "default": {
                                        "value": null
                                    }
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                },
                                "example": {
                                    "type": "string",
                                    "title": "string",
                                    "status": 0,
                                    "detail": "string",
                                    "instance": "string"
                                }
                            },
                            "text/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                },
                                "example": {
                                    "type": "string",
                                    "title": "string",
                                    "status": 0,
                                    "detail": "string",
                                    "instance": "string"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error"
                    }
                }
            }
        },
        "/TransactionsRead/Transaction": {
            "get": {
                "tags": [
                    "Transaction"
                ],
                "summary": "/Transaction - GET",
                "operationId": "get-transaction",
                "parameters": [
                    {
                        "name": "storeId",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "transactionCode",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/DTO_Transaction"
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DTO_Transaction"
                                }
                            },
                            "text/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DTO_Transaction"
                                }
                            }
                        }
                    },
                    "204": {
                        "description": "No Content"
                    },
                    "400": {
                        "description": "Bad Request",
                        "content": {
                            "text/plain": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                },
                                "examples": {
                                    "default": {
                                        "value": null
                                    }
                                }
                            },
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                },
                                "example": {
                                    "type": "string",
                                    "title": "string",
                                    "status": 0,
                                    "detail": "string",
                                    "instance": "string"
                                }
                            },
                            "text/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ProblemDetails"
                                },
                                "example": {
                                    "type": "string",
                                    "title": "string",
                                    "status": 0,
                                    "detail": "string",
                                    "instance": "string"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Server Error"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "DTO_Address": {
                "type": "object",
                "properties": {
                    "addressId": {
                        "type": "string",
                        "nullable": true
                    },
                    "type": {
                        "type": "string",
                        "nullable": true
                    },
                    "street": {
                        "type": "string",
                        "nullable": true
                    },
                    "streetNo": {
                        "type": "string",
                        "nullable": true
                    },
                    "streetNoSuffix": {
                        "type": "string",
                        "nullable": true
                    },
                    "zipCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "city": {
                        "type": "string",
                        "nullable": true
                    },
                    "region": {
                        "type": "string",
                        "nullable": true
                    },
                    "countryCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "isOneTimeAddress": {
                        "type": "boolean"
                    }
                },
                "additionalProperties": false
            },
            "DTO_Batch_Serial_Numbers": {
                "type": "object",
                "properties": {
                    "number": {
                        "type": "string",
                        "nullable": true
                    },
                    "quantity": {
                        "type": "number",
                        "format": "double"
                    }
                },
                "additionalProperties": false
            },
            "DTO_BusinessPartner": {
                "type": "object",
                "properties": {
                    "internalId": {
                        "type": "string",
                        "nullable": true
                    },
                    "businessPartnerId": {
                        "type": "string",
                        "nullable": true
                    },
                    "name": {
                        "type": "string",
                        "nullable": true
                    },
                    "addresses": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Address"
                        },
                        "nullable": true
                    },
                    "contactperson": {
                        "$ref": "#/components/schemas/DTO_Contactperson"
                    }
                },
                "additionalProperties": false
            },
            "DTO_Contactperson": {
                "type": "object",
                "properties": {
                    "contactId": {
                        "type": "string",
                        "nullable": true
                    },
                    "givenName": {
                        "type": "string",
                        "nullable": true
                    },
                    "surName": {
                        "type": "string",
                        "nullable": true
                    },
                    "prefix": {
                        "type": "string",
                        "nullable": true
                    },
                    "saluation": {
                        "type": "string",
                        "nullable": true
                    },
                    "emailAddress": {
                        "type": "string",
                        "nullable": true
                    },
                    "phoneNumbers": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_Currency": {
                "type": "object",
                "properties": {
                    "currencyCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "currencyName": {
                        "type": "string",
                        "nullable": true
                    },
                    "currencySign": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_Header_Discounts": {
                "type": "object",
                "properties": {
                    "sequence": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "reason": {
                        "$ref": "#/components/schemas/DTO_Reason"
                    },
                    "discountPercentage": {
                        "type": "number",
                        "format": "double"
                    },
                    "discountAmount": {
                        "type": "number",
                        "format": "double"
                    }
                },
                "additionalProperties": false
            },
            "DTO_Image": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string",
                        "nullable": true
                    },
                    "url": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_Line": {
                "type": "object",
                "properties": {
                    "lineNum": {
                        "type": "integer",
                        "format": "int32"
                    },
                    "itemId": {
                        "type": "string",
                        "nullable": true
                    },
                    "itemName": {
                        "type": "string",
                        "nullable": true
                    },
                    "itemType": {
                        "type": "string",
                        "nullable": true
                    },
                    "quantity": {
                        "type": "number",
                        "format": "double"
                    },
                    "multiplyQuantity": {
                        "type": "number",
                        "format": "double"
                    },
                    "minQuantity": {
                        "type": "number",
                        "format": "double"
                    },
                    "unitGroup": {
                        "$ref": "#/components/schemas/DTO_UnitGroup"
                    },
                    "unitPriceEx": {
                        "type": "number",
                        "format": "double"
                    },
                    "vatAmountPerUnit": {
                        "type": "number",
                        "format": "double"
                    },
                    "lineTotalEx": {
                        "type": "number",
                        "format": "double"
                    },
                    "vatCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "vatRate": {
                        "type": "number",
                        "format": "double"
                    },
                    "includeVat": {
                        "type": "boolean"
                    },
                    "isManualPrice": {
                        "type": "boolean"
                    },
                    "isVariablePriceItem": {
                        "type": "boolean"
                    },
                    "batch_Serial_Numbers": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Batch_Serial_Numbers"
                        },
                        "nullable": true
                    },
                    "linked_Items": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Line"
                        },
                        "nullable": true
                    },
                    "transportationMethod": {
                        "$ref": "#/components/schemas/DTO_TransportationMethod"
                    },
                    "discountReason": {
                        "$ref": "#/components/schemas/DTO_Reason"
                    },
                    "discountPercentage": {
                        "type": "number",
                        "format": "double"
                    },
                    "discountPerUnitEx": {
                        "type": "number",
                        "format": "double"
                    },
                    "returnReason": {
                        "$ref": "#/components/schemas/DTO_Reason"
                    },
                    "images": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Image"
                        },
                        "nullable": true
                    },
                    "shippingDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "comments": {
                        "type": "string",
                        "nullable": true
                    },
                    "priceComment": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_Payment": {
                "type": "object",
                "properties": {
                    "paymentTypeId": {
                        "type": "string",
                        "nullable": true
                    },
                    "name": {
                        "type": "string",
                        "nullable": true
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "paymentAmount": {
                        "type": "number",
                        "format": "double"
                    },
                    "paymentJournal": {
                        "type": "string",
                        "nullable": true
                    },
                    "uniqueNumber": {
                        "type": "string",
                        "nullable": true
                    },
                    "drawerId": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_Reason": {
                "type": "object",
                "properties": {
                    "reasonId": {
                        "type": "string",
                        "nullable": true
                    },
                    "name": {
                        "type": "string",
                        "nullable": true
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_SearchFilter": {
                "type": "object",
                "properties": {
                    "employeeId": {
                        "type": "string",
                        "nullable": true
                    },
                    "pauzed": {
                        "$ref": "#/components/schemas/YesNoEnum"
                    },
                    "fromDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "toDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "transactionCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "businessPartnerId": {
                        "type": "string",
                        "nullable": true
                    },
                    "businessPartnerName": {
                        "type": "string",
                        "nullable": true
                    },
                    "sortTransactionDate": {
                        "$ref": "#/components/schemas/SortEnum"
                    }
                },
                "additionalProperties": false
            },
            "DTO_Search_Result": {
                "type": "object",
                "properties": {
                    "totalCount": {
                        "type": "integer",
                        "format": "int64"
                    },
                    "pageNum": {
                        "type": "integer",
                        "format": "int32",
                        "nullable": true
                    },
                    "pageSize": {
                        "type": "integer",
                        "format": "int32",
                        "nullable": true
                    },
                    "transactions": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Search_Transactions"
                        },
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_Search_Transactions": {
                "type": "object",
                "properties": {
                    "transactionCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "transactionDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "status": {
                        "type": "string",
                        "nullable": true
                    },
                    "transactionType": {
                        "type": "string",
                        "nullable": true
                    },
                    "businessPartnerId": {
                        "type": "string",
                        "nullable": true
                    },
                    "businessPartnerName": {
                        "type": "string",
                        "nullable": true
                    },
                    "totalAmount": {
                        "type": "number",
                        "format": "double"
                    },
                    "updateDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_Transaction": {
                "type": "object",
                "properties": {
                    "_Id": {
                        "type": "string",
                        "nullable": true
                    },
                    "transactionCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "transactionDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "transactionType": {
                        "type": "string",
                        "nullable": true
                    },
                    "status": {
                        "type": "string",
                        "nullable": true
                    },
                    "quotationDueDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "storeId": {
                        "type": "string",
                        "nullable": true
                    },
                    "employeeId": {
                        "type": "string",
                        "nullable": true
                    },
                    "employeeName": {
                        "type": "string",
                        "nullable": true
                    },
                    "businessPartner": {
                        "$ref": "#/components/schemas/DTO_BusinessPartner"
                    },
                    "customerReference": {
                        "type": "string",
                        "nullable": true
                    },
                    "currency": {
                        "$ref": "#/components/schemas/DTO_Currency"
                    },
                    "totalAmountEx": {
                        "type": "number",
                        "format": "double"
                    },
                    "totalVatAmount": {
                        "type": "number",
                        "format": "double"
                    },
                    "roundingAmount": {
                        "type": "number",
                        "format": "double"
                    },
                    "transportationMethod": {
                        "$ref": "#/components/schemas/DTO_TransportationMethod"
                    },
                    "itemLines": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Line"
                        },
                        "nullable": true
                    },
                    "paymentLines": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Payment"
                        },
                        "nullable": true
                    },
                    "discounts": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/DTO_Header_Discounts"
                        },
                        "nullable": true
                    },
                    "receipts": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "nullable": true
                    },
                    "comments": {
                        "type": "string",
                        "nullable": true
                    },
                    "updateDate": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_TransportationMethod": {
                "type": "object",
                "properties": {
                    "transportationMethodId": {
                        "type": "string",
                        "nullable": true
                    },
                    "name": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": false
            },
            "DTO_UnitGroup": {
                "type": "object",
                "properties": {
                    "unitGroupCode": {
                        "type": "string",
                        "nullable": true
                    },
                    "unitGroupName": {
                        "type": "string",
                        "nullable": true
                    },
                    "itemQuantity": {
                        "type": "number",
                        "format": "double"
                    },
                    "multiplyQuantity": {
                        "type": "number",
                        "format": "double"
                    },
                    "minQuantity": {
                        "type": "number",
                        "format": "double"
                    }
                },
                "additionalProperties": false
            },
            "ProblemDetails": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string",
                        "nullable": true
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "status": {
                        "type": "integer",
                        "format": "int32",
                        "nullable": true
                    },
                    "detail": {
                        "type": "string",
                        "nullable": true
                    },
                    "instance": {
                        "type": "string",
                        "nullable": true
                    }
                },
                "additionalProperties": {}
            },
            "SortEnum": {
                "enum": [
                    "Ascending",
                    "Descending"
                ],
                "type": "string"
            },
            "YesNoEnum": {
                "enum": [
                    "Yes",
                    "No"
                ],
                "type": "string"
            }
        },
        "securitySchemes": {
            "apiKeyHeader": {
                "type": "apiKey",
                "name": "Ocp-Apim-Subscription-Key",
                "in": "header"
            },
            "apiKeyQuery": {
                "type": "apiKey",
                "name": "subscription-key",
                "in": "query"
            }
        }
    },
    "security": [
        {
            "apiKeyHeader": []
        },
        {
            "apiKeyQuery": []
        }
    ]
}`
1 Like

Why don’t you simply add a response code check, prior to schema validation?
If not 200, most likely you don’t have a valid content, so why bother to schema validation?
Fail the test due to the response code.
Or check the Content-Length. Or both.

1 Like

Of course, that is not the problem. This can be done by a case statement in the verrification step.
But by validating you want to test The response against the definition. When testing a 204 situation we expect “no content”. So we sent a request with expected result in “204: No content.” The response is correct, 204 without content. The validation result in an error. Is this an error in the Katalon validation, or do we have to add some code to the open api definition.

So, just enclose the step for schema validation in an if.
When you get 204, skip that step, as it has no sense to check the json schema for an empty body. Or use another simplified schema, altough it will be overthinked imho.
When you get 204, will be enough to check if the response type it is still json (or whatever type is expected for this case) and it contains the expected text.

You can retreieve the content type from the response object with:
https://api-docs.katalon.com/com/kms/katalon/core/testobject/ResponseObject.html#getContentType()

or use the boolean checker:
https://api-docs.katalon.com/com/kms/katalon/core/testobject/ResponseObject.html#isJsonContentType()

for checking see:
https://api-docs.katalon.com/com/kms/katalon/core/webservice/keyword/WSBuiltInKeywords.html#verifyElementText(com.kms.katalon.core.testobject.ResponseObject,%20java.lang.String,%20java.lang.String,%20com.kms.katalon.core.model.FailureHandling)

or:

https://api-docs.katalon.com/com/kms/katalon/core/webservice/keyword/WSBuiltInKeywords.html#containsString(com.kms.katalon.core.testobject.ResponseObject,%20java.lang.String,%20boolean)

Thanks,
I will look into it

You should do something like this (in pseudocode):

if responseCode == 200 {
  verifyResponseType == JSON
  verifySchema
  someOtherDataValidation
} else if responseCode == 204 {
  verifyResponseType == TEXT # most likely you receive text in this case
  checkResponseTextContains("No content")
} else {
  markTestFailed # unexpected response
}

However, with the above, you may do some bug hidding.
A better approach will be, if you know in what situation you receive 200 or 204, to do something like:

if expectedResponse == 200 {
  verifyResponseCode == 200
  verifyResponseType == JSON
  verifySchema
  someOtherDataValidation
} else if expectedResponse == 204 {
  verifyResponseCode == 204
  verifyResponseType == TEXT # most likely you receive text in this case
  checkResponseTextContains("No content")
} else {
  markTestFailed # what the heck happened
}