Skip to main content

Crate qql_convert

Crate qql_convert 

Source
Expand description

Qdrant REST JSON to QQL statement converter.

Five input shapes are accepted:

  1. Wrapped request — {"method", "path", "query"?, "body"?}; the collection is derived from the path. query recovers wait / timeout / consistency (also accepted as a ?… suffix on path).
  2. Bare body — raw Qdrant REST JSON without path context; the caller must supply the collection via convert / convert_stmts.
  3. JSONL capture — one wrapped request or bare body per line, as written by qql record. A failing line reports its 1-based number via ConvertError::InvalidLine.
  4. HTTP snippet — a METHOD /path line plus a JSON body, as shown in docs and blogs (full URLs and an HTTP/x suffix are accepted).
  5. curl command — a pasted invocation (-X, -d, --header, …, multi-line continuations, several commands). Shell-dynamic constructs ($VAR, @file, pipes) fail closed;

Markdown fences around any of the above are stripped as paste noise.

Conversion is contract-driven and AST-based:

OpenAPI request JSON -> qql_core::ast::Stmt -> qql_core::fmt::format_stmt

The returned strings are only produced by the canonical formatter (the same emitter behind qql fmt), so every emitted statement re-parses and is byte-stable under format_stmt(parse(emit)). Decoding fails closed: shapes the QQL AST cannot express return a typed ConvertError, never a placeholder or a silently dropped field.

Enums§

ConvertError
Typed conversion failure.

Functions§

convert
Convert REST JSON into canonical QQL statement strings.
convert_stmts
Convert a Qdrant REST JSON payload (one object or a JSONL capture) into typed QQL statements.