Contract

The Contract tab validates API responses against a JSON Schema. This ensures the server returns data in the expected format, catching breaking changes and bugs early. You can either define a custom schema for standalone requests or use schemas from your OpenAPI project definitions.

Validation Modes

The Contract tab operates in two modes depending on the request source:

Custom Schema Mode

For standalone requests (not from a project). You manually define a JSON Schema to validate responses.

Project Mode

For requests from an OpenAPI project. Uses expected responses defined in your project's endpoint specification.

Custom Schema Mode

When working with standalone requests (not from a project), you can add a custom JSON Schema to validate responses:

Initial State

Contract Validation

Add a custom JSON Schema to validate responses, or save this request to a project for full contract validation.

Add Schema
Schema Editor

Click "Add Schema" to open the schema editor. You can paste JSON Schema directly or upload a .json file:

{"type": "object", "properties": {...}}
Upload JSON
CancelSave Schema
Example Schema
{
  "type": "object",
  "required": ["id", "name", "email"],
  "properties": {
    "id": {
      "type": "integer",
      "minimum": 1
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}
File Upload: You can upload a .json file containing your schema. Maximum file size is 1 MB.

Project Mode

When a request is opened from an OpenAPI project, the Contract tab uses the expected responses defined in your endpoint specification:

Expected Responses

Shows all responses defined in the OpenAPI spec for this endpoint:

200Successful responseCurrent
application/jsonUser
400Bad request
application/jsonError
500Internal server error
Actual Response

Shows the current response summary for comparison:

200OK
Content-Type:application/json
Size:1,234 bytes

Validation Results

The validation result shows whether the response matches the expected schema:

Response matches contract

Response status code, content type, and body all match the expected schema.

Status 404 matched default response

Status code wasn't explicitly defined but matched the "default" response in the spec.

Schema validation failed (3 errors)

Response body doesn't match the expected schema structure.

Schema Validation Errors

When validation fails, detailed errors are shown to help identify the mismatch:

Validation Errors

/users/0/emailmust match format "email"
Expected:email format
Actual:"not-an-email"
/users/0/agemust be integer
Expected:integer
Actual:string

... and 1 more error

Error Path: The JSON path (e.g., /users/0/email) shows exactly where in the response the error occurred. Use this to quickly locate the problematic data.

Content Type Validation

In addition to schema validation, the Contract tab also checks:

CheckWhat's Validated
Status CodeResponse status matches one of the defined expected responses
Content-TypeResponse content type matches the expected media types
Body SchemaResponse body structure matches the JSON Schema (for JSON responses)
Non-JSON Responses: Schema validation is skipped for non-JSON content types (XML, HTML, text). A "Schema validation skipped" message is shown instead.

Schema References

In Project Mode, schemas can be defined in two ways:

inlineInline Schema

Schema is defined directly in the endpoint's response specification.

UserReferenced Schema

Schema references a shared component defined in the project's components/schemas section.

$ref Resolution: Tigrister automatically resolves $ref references to their full schema definitions, including nested references within schemas.