Skip to main content

Module sql

Module sql 

Source
Expand description

SQL-driven HTTP handler generation.

Consumes scythe’s AnalyzedQuery IR (plus the Catalog it was analyzed against) and emits routes, JSON Schema validators, and an OpenAPI 3.1 spec. The HTTP vocabulary (@http, @http_param, @http_auth, …) lives entirely in this module — scythe knows nothing about HTTP. Spikard parses them out of AnalyzedQuery.custom.

Pipeline:

  AnalyzedQuery.custom  ─►  parse_http_annotations  ─►  HttpAnnotations
  AnalyzedQuery (+ Catalog) ─►  route_from_query   ─►  RouteMetadata
  [RouteMetadata + AnalyzedQuery]  ─►  openapi_from_routes  ─►  Value (OpenAPI 3.1)
  [AnalyzedQuery]  ─►  build_sidecar  ─►  Sidecar  (per-language call info)

Re-exports§

pub use annotations::AnnotationParseError;
pub use annotations::ApiKeyLocation;
pub use annotations::AuthRequirement;
pub use annotations::HttpAnnotations;
pub use annotations::HttpMethod;
pub use annotations::HttpParamBinding;
pub use annotations::parse_http_annotations;
pub use neutral_to_json_schema::BuildOptions;
pub use neutral_to_json_schema::DecimalMode;
pub use neutral_to_json_schema::neutral_to_json_schema;
pub use openapi::OpenApiInfo;
pub use openapi::openapi_from_routes;
pub use route::RouteBuildError;
pub use route::SqlRoute;
pub use route::route_from_query;
pub use sidecar::Sidecar;
pub use sidecar::SidecarEntry;
pub use sidecar::SidecarParam;

Modules§

annotations
Spikard’s HTTP annotation grammar, parsed out of scythe’s CustomAnnotation slice. Scythe captures every unknown -- @<name> <value> line verbatim; spikard owns the vocabulary that turns those triples into route metadata.
neutral_to_json_schema
Map scythe’s neutral type strings to OpenAPI 3.1 JSON Schema fragments.
openapi
Emit an OpenAPI 3.1 document from a slice of SqlRoute.
route
Build spikard_core::RouteMetadata from a scythe AnalyzedQuery.
sidecar
Per-language call metadata that crosses the boundary from spikard’s SQL module to the per-language handler-stub generators.

Structs§

HandlerSet
Aggregate output of build_handler_set: routes + OpenAPI spec + sidecar.
LanguageBackend
Per-language inputs to build_handler_set. Each backend names itself (used as the sidecar key) and supplies callbacks that translate scythe metadata into language-native names and types.

Functions§

build_handler_set
Walk a slice of analyzed queries and build the full handler set: routes, OpenAPI spec, and a per-language sidecar. Queries without an @http directive are skipped silently. The sidecar is populated by passing per- language lang_type_for resolvers in languages.