# Tenant Schema Validator

Validate your tenant configuration JSON against the EaaS schema.

---

## API Usage

You can also call the validator programmatically via the REST API.

**Endpoint:** `POST https://eaas.aka-dev.net/api/validate`

**Request body:**

```json
{
  "tenant": { ... },
  "schema_version": "current"
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `tenant` | object | Yes | The tenant configuration to validate |
| `schema_version` | string | No | `"current"` (default), `"1.10.3"`, or `"1.11.0"` |
| `custom_schema` | object | No | A custom JSON Schema to validate against (overrides `schema_version`) |

**HTTP status codes:**

| Status | Meaning |
|--------|---------|
| `200` | Tenant is valid |
| `400` | Malformed request (bad JSON, missing `tenant` field) |
| `422` | Tenant failed schema validation |
| `500` | Internal error (schema could not be loaded or compiled) |

**Response body:**

```json
{ "valid": true, "errors": [] }
```

```json
{ "valid": false, "errors": ["Path: /deliveryServices/0/caching, Error: ..."] }
```

**Example:**

```bash
curl -X POST https://eaas.aka-dev.net/api/validate \
  -H "Content-Type: application/json" \
  -d '{"tenant": {"deliveryServices": []}}'
```

**Validate against an older schema version:**

```bash
curl -X POST https://eaas.aka-dev.net/api/validate \
  -H "Content-Type: application/json" \
  -d '{"tenant": {...}, "schema_version": "1.10.3"}'
```
