Files
apimposter/mocks.schema.json
Andreas Svanberg 864eccc330
All checks were successful
Build, Test & Checkstyle / build (push) Successful in 32s
Initial version
2026-04-16 15:09:19 +02:00

61 lines
1.9 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://gitea.dsv.su.se/DMC/apimposter/mocks.schema.json",
"title": "APImposter mocks configuration schema",
"description": "Schema for APImposter YAML configuration files",
"type": "array",
"items": {
"type": "object",
"required": ["method", "path"],
"oneOf": [
{
"required": ["response"],
"properties": {
"method": { "$ref": "#/$defs/httpMethod" },
"path": { "type": "string" },
"response": { "$ref": "#/$defs/response" }
}
},
{
"required": ["conditionalResponses"],
"properties": {
"method": { "$ref": "#/$defs/httpMethod" },
"path": { "type": "string" },
"conditionalResponses": { "$ref": "#/$defs/conditionalResponses" }
}
}
]
},
"$defs": {
"httpMethod": {
"type": "string",
"enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]
},
"response": {
"type": "object",
"properties": {
"status": { "type": "integer" },
"headers": { "type": "object" },
"body": { "type": ["string", "object", "array", "number", "boolean"] },
"delay": { "type": "integer" }
}
},
"conditionalResponses": {
"type": "object",
"required": ["conditions"],
"properties": {
"conditions": {
"type": "object",
"properties": {
"path": { "type": "object", "additionalProperties": { "$ref": "#/$defs/response" } },
"query": { "type": "object", "additionalProperties": { "$ref": "#/$defs/response" } },
"headers": { "type": "object", "additionalProperties": { "$ref": "#/$defs/response" } },
"body": { "type": "object", "additionalProperties": { "$ref": "#/$defs/response" } }
}
},
"response": { "$ref": "#/$defs/response" }
}
}
}
}