Vigilfield Docs
API referenceQueries

`POST /queries/compile` — compile VFQL and return the SQL or the diagnostics.

POST/queries/compile

Creates nothing (R4): no run, no scheduler dispatch, no credit movement.

A refused compile is a 200 carrying diagnostics and no sql — the request asked "is this valid, and where is it wrong?" and got its answer. The 400 is for an unknown vfql_version, which is a fact about the request with no place in the text to point at, and it carries no diagnostics key at all (R6).

⚠️ No ?as_admin= parameter, unlike every other route in this cluster. This endpoint's job is to report catalog facts back to the caller, so an override here would be an unaudited catalog-disclosure surface; the catalog is always computed for the acting team with no admin clause (vigilfield_query::compile_query_for).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

A query, as it travels: the VFQL text, the grammar version to parse it under, and the values bound to its declared parameters (ADR-0058 §2).

There is no language field: every stored and submitted query text is VFQL, and there is no spelling that means "this one is SQL" (§5).

⚠️ It lives here, beside [ParamValue], and not in the wire layer. It was vigilfield_query::dto::QueryText while POST /queries/compile was its only carrier; the table's population config now stores one (PopulationConfig.query, in the table crate), and a wire DTO is not a type a storage model can depend on. Putting it beside the parameter type it names is the same argument ParamValue already carries: this is the vocabulary of a query, and one spelling of it is the point. The crate stays pure — this names only String, BTreeMap, serde, a schema derive and ParamValue.

It reaches its old consumers unchanged, on the path ParamValue already travels: re-exported by vigilfield_workload_preprocessor and then by vigilfield_query, so vigilfield_query::QueryText still resolves.

Response Body

application/json

curl -X POST "https://example.com/queries/compile" \  -H "Content-Type: application/json" \  -d '{    "text": "string",    "vfql_version": "string"  }'
{  "diagnostics": [    {      "kind": "string",      "message": "string",      "span": {        "end": 0,        "start": 0      }    }  ],  "sql": "string"}