Entity Schemas
Define entity structures
Entity schema routes are world-scoped.
GET /api/worlds/:worldAddress/entity-schemas?page=1&limit=20
POST /api/worlds/:worldAddress/entity-schemas
{
"name": "horse",
"description": "A racing horse",
"attributes": [
{
"name": "speed_rating",
"type": "float",
"constraints": { "min": 0, "max": 1 },
"defaultValue": 0.5
}
]
}
| Field | Type | Required | Description |
|---|
name | string | Yes | Schema name, 1-255 chars |
description | string | No | Schema description |
attributes | object[] | No | Inline attributes created with the schema |
attributes[].name | string | Yes | Attribute key |
attributes[].type | enum | Yes | integer | float | string | boolean | json |
attributes[].constraints | object | No | Validation rules for attribute values |
attributes[].constraints.min | number | No | Lower bound |
attributes[].constraints.max | number | No | Upper bound |
attributes[].constraints.enum | string[] | No | Allowed string values |
attributes[].constraints.pattern | string | No | Regex for string attributes |
attributes[].constraints.required | boolean | No | Required semantics flag |
attributes[].defaultValue | any | No | Default state value |
GET /api/worlds/:worldAddress/entity-schemas/:schemaName/attributes?page=1&limit=20
POST /api/worlds/:worldAddress/entity-schemas/:schemaName/attributes
{
"name": "wins",
"type": "integer",
"constraints": { "min": 0 },
"defaultValue": 0
}
| Field | Type | Required | Description |
|---|
name | string | Yes | Attribute key |
type | enum | Yes | integer | float | string | boolean | json |
constraints | object | No | Validation rules |
constraints.min | number | No | Lower bound |
constraints.max | number | No | Upper bound |
constraints.enum | string[] | No | Allowed string values |
constraints.pattern | string | No | Regex for string attributes |
constraints.required | boolean | No | Required semantics flag |
defaultValue | any | No | Default state value |
GET /api/worlds/:worldAddress/entity-schemas/:schemaName/attributes/:name
PUT /api/worlds/:worldAddress/entity-schemas/:schemaName/attributes/:name
{
"name": "wins",
"type": "integer",
"constraints": {
"min": 0,
"required": true
},
"defaultValue": 0
}
| Field | Type | Required | Description |
|---|
name | string | No | New attribute key |
type | enum | No | integer | float | string | boolean | json |
constraints | object | No | Validation rules (same shape as create) |
defaultValue | any | No | Default value for future merges/defaulting |
DELETE /api/worlds/:worldAddress/entity-schemas/:schemaName/attributes/:name
GET /api/worlds/:worldAddress/entity-schemas/:schemaName
PUT /api/worlds/:worldAddress/entity-schemas/:schemaName
{
"name": "horse",
"description": "A racing horse updated"
}
| Field | Type | Required | Description |
|---|
name | string | No | Schema name. |
description | string | No | Schema description. |
DELETE /api/worlds/:worldAddress/entity-schemas/:schemaName