Data Schema¶
The Data Schema (ip.schema.data_schema field on ip.schema) is a pure JSON Schema draft-07 document.
It is used only for payload validation at the network edge — it has no knowledge of Odoo fields.
It validates both inbound payloads before import and outbound payloads before delivery.
Both schemas are validated at save time by ip.schema._check_schemas(), which raises a ValidationError for invalid field paths, operators, or JSON Schema syntax.
See also
Odoo Schema — operators, traits, DataLoader internals, and cookbook.
sync_base.ip.schema— technical reference.
Root Type¶
The type keyword at the root of the ip.schema.data_schema dictates how Odoo handles the payload:
Value |
Behaviour |
|---|---|
|
One JSON object per event. On export, |
|
A batch of records per event. On export, the entire recordset is serialised into a JSON array in a single event. |
Keywords¶
Keyword |
Purpose |
Recommendation |
|---|---|---|
|
Declares the vocabulary version. |
Always include ( |
|
|
Required. |
|
Array of keys that must be present. |
List all non-optional fields. |
|
Controls unknown keys. |
Use |
|
Named field definitions with type constraints. |
Declare every field you map in the Odoo Schema. |
|
Regex-keyed definitions, e.g. |
Useful for dynamically-named CID fields. |
Example¶
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["json_ref"],
"additionalProperties": false,
"properties": {
"json_ref": { "type": "string" },
"content": {
"type": "object",
"properties": { "body": { "type": ["string", "null"] } }
},
"avatar": {
"type": "object",
"properties": {
"cid_str": { "type": "string" },
"name": { "type": "string" }
}
},
"json_tags": {
"type": "array",
"items": {
"type": "object",
"properties": { "label": { "type": "string" } },
"required": ["label"]
}
}
}
}
Matching payload:
{
"json_ref": "REC-001",
"content": { "body": "Hello world" },
"avatar": { "cid_str": "QmXxxx...", "name": "Profile" },
"json_tags": [
{ "label": "welcome" },
{ "label": "general" }
]
}