157 lines
3.4 KiB
JSON
157 lines
3.4 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://example.local/http-client-app/contracts/workspace-json-schemas/mock-file.schema.json",
|
|
"title": "HTTP Client Mock Rule File",
|
|
"type": "object",
|
|
"required": [
|
|
"schemaVersion",
|
|
"updatedAt",
|
|
"rules"
|
|
],
|
|
"properties": {
|
|
"schemaVersion": {
|
|
"type": "integer",
|
|
"const": 1
|
|
},
|
|
"updatedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"rules": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/$defs/mockRule"
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"$defs": {
|
|
"mockRule": {
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"name",
|
|
"enabled",
|
|
"priority",
|
|
"match",
|
|
"response"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"priority": {
|
|
"type": "integer"
|
|
},
|
|
"tags": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"match": {
|
|
"type": "object",
|
|
"required": [
|
|
"method",
|
|
"path"
|
|
],
|
|
"properties": {
|
|
"method": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"path": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"pathMode": {
|
|
"type": "string",
|
|
"enum": [
|
|
"exact",
|
|
"prefix",
|
|
"regex"
|
|
],
|
|
"default": "exact"
|
|
},
|
|
"headers": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"query": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
},
|
|
"response": {
|
|
"type": "object",
|
|
"required": [
|
|
"statusCode"
|
|
],
|
|
"properties": {
|
|
"statusCode": {
|
|
"type": "integer",
|
|
"minimum": 100,
|
|
"maximum": 599
|
|
},
|
|
"headers": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"bodyType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"json",
|
|
"text",
|
|
"binary",
|
|
"file"
|
|
]
|
|
},
|
|
"body": {
|
|
"type": [
|
|
"string",
|
|
"object",
|
|
"array",
|
|
"number",
|
|
"boolean",
|
|
"null"
|
|
]
|
|
},
|
|
"bodyFilePath": {
|
|
"type": "string"
|
|
},
|
|
"delayMs": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"templateEnabled": {
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
}
|