Skip to content

Validate every row against the table (required, types, ranges, enums, links, unknown

POST
/datanotes/operations/check_table/
curl --request POST \
--url https://example.com/datanotes/operations/check_table/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "table": null, "limit": 500, "offset": 0 }'

Validate every row against the table (required, types, ranges, enums, links, unknown columns, CHECK constraints, those that follow links included, filtered link targets (ref_where / ref_by), stale generated/identity values, missing inverse links, front matter that cannot be read: code unreadable, with no column, for a note whose table line names the table but whose YAML is broken, which every other read leaves out). A CHECK violation has code check and the CHECK’s name as constraint (every other code names its column), as in the violations of list_changes. Use it to find rows edited by hand that break the schema. Without table, every table is checked: each row then names its table, tables_checked counts the tables checked, and a table that cannot be checked is listed in errors ({table, error}) while the others are. The rows with violations are paged: limit (default 500, at most 5000) from offset; total counts them all. (Hand edits are also checked as they happen: see violations in list_changes.)

Media typeapplication/json
object
table
Any of:
string
limit

Rows with violations returned (paging).

integer
default: 500 >= 1 <= 5000
offset

Rows with violations skipped first (paging).

integer
0

Done.

Media typeapplication/json
object
table
required

Qualified table; null when every table was checked.

string | null
rows_checked
required

Rows checked.

integer
tables_checked

Tables checked (when every table was checked).

integer
total
required

Rows breaking the rules in all (violations is the page from offset).

integer
errors

Tables that could not be checked (when every table was checked), with the reason.

Array<object>
object
table
required
string
error
required
string
violations
required

Rows breaking the table’s rules (this page of them).

Array<object>
CheckedRow

A row breaking the rules, with its table when every table was checked.

object
path
required

Row note path.

string
table

The row’s qualified table (when every table was checked).

string
violations
required

What is wrong with this row.

Array<object>
Violation
object
column

The column the violation is about (every code but check and unreadable).

string
index

The item of a list column that breaks the rule, from 0.

integer
constraint

The CHECK’s name (code check).

string
code
required

Kind of violation.

string
Allowed values: required inverse type min max step enum broken_link ref unique unknown_column check generated cycle vocabulary unreadable
message
required

Agent-readable explanation.

string
value

The offending value, when there is one.

Example

{
"violations": [
{
"violations": [
{
"code": "required"
}
]
}
]
}

Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Missing or wrong bearer token.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Unknown table, view, migration, note or folder.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Ambiguous table name: it matches several tables (paths or tables lists them).

Media typeapplication/json
object
error
required
string
paths

The tables’ folders the name matches.

Array<string>
tables

The qualified tables the name matches.

Array<string>

Example generated

{
"error": "example",
"paths": [
"example"
],
"tables": [
"example"
]
}

Unexpected error.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}