soothfast v0.4.3

soothfast-sdk API reference#

Generated by cargo soothfast docs reference Measurements and verified claims come from the latest baseline; CI gates them.

soothfast_sdk#

SdkFileSet struct#

rust · ignore
pub struct SdkFileSet { pub files: BTreeMap<String, String>, pub notes: Vec<String> }

Rendered SDK files, keyed by path relative to the output directory.

SdkKind enum#

rust · ignore
pub enum SdkKind { Python, TypeScript }

A language the SDK engine can emit.

SdkOptions struct#

rust · ignore
pub struct SdkOptions { pub package: String, pub module: String, pub version: String, pub base_url: Option<String>, pub embed: Option<String>, pub embed_args: Vec<String>, pub embed_env: BTreeMap<String, String>, pub embed_env_vars: Vec<envtemplate::EnvVar>, pub targets: Vec<String>, pub description: Option<String>, pub repository: Option<String>, pub paginated: Vec<String>, pub cursor_param: String, pub limit_param: String }

Everything an emitter needs that the operations don't carry.

soothfast_sdk::envtemplate#

EnvVar struct#

rust · ignore
pub struct EnvVar { pub name: String, pub doc: Vec<String>, pub default: Option<String> }

One environment variable the embedded server reads.

markdown_table function#

rust · ignore
pub fn markdown_table(vars: &[EnvVar]) -> String

Render the knobs as a README table. Same text in both languages: the variables belong to the server, not to whoever is calling it.

parse function#

rust · ignore
pub fn parse(text: &str) -> Vec<EnvVar>

Parse a dotenv-style template into the knobs it documents.

Anything unparseable is skipped rather than rejected: the file belongs to the server, and an SDK is not the place a stray line becomes fatal.

Names are unique: a template that shows # KEY=example above the real KEY= names one knob, and emitting it twice would not compile.

soothfast_sdk::lower#

lower function#

rust · ignore
pub fn lower(ops: &[Operation], opts: &SdkOptions, kind: SdkKind) -> Result<Sdk, String>

Lower operations into the SDK model.

Component schemas shared across operations must agree; two operations producing a different schema under one name is the same identity conflict the dialect emitters refuse.

kind decides only how wire names are spelled — every typing question is answered the same way for every target.

verified claims
✓complexityclaimed O(n); growth drift x1.08 over sizes [16, 64, 256] (limit x2.5)
measured as `soothfast_sdk::bench_lower`
median walltime (ns)1224362
p99 walltime (ns)1284931
allocations/iter23907
allocated bytes/iter2064788

soothfast_sdk::model#

Field struct#

rust · ignore
pub struct Field { pub attr: String, pub wire: String, pub ty: Ty, pub required: bool, pub doc: Option<String> }

One field of a [Model].

Method struct#

rust · ignore
pub struct Method { pub name: String, pub operation_id: String, pub http_method: String, pub path: String, pub doc: Option<String>, pub params: Vec<Param>, pub body: Option<Ty>, pub ok: Ty, pub ok_status: u16, pub paginated: bool }

One client method, lowered from an operation.

Model struct#

rust · ignore
pub struct Model { pub name: String, pub doc: Option<String>, pub fields: Vec<Field> }

A named object schema, emitted as a class/interface.

Param struct#

rust · ignore
pub struct Param { pub attr: String, pub wire: String, pub location: ParamLoc, pub ty: Ty, pub required: bool, pub doc: Option<String> }

One parameter of a [Method].

ParamLoc enum#

rust · ignore
pub enum ParamLoc { Query, Path, Header }

Where a request parameter travels.

Sdk struct#

rust · ignore
pub struct Sdk { pub models: Vec<Model>, pub aliases: Vec<(String, Ty)>, pub methods: Vec<Method>, pub notes: Vec<String> }

The whole lowered SDK.

Ty enum#

rust · ignore
pub enum Ty { Str, Int, Float, Bool, Any, Unit, List(Box<Ty>), Map(Box<Ty>), Optional(Box<Ty>), Named(String), Union(Vec<Ty>), Literal(Vec<String>) }

A wire type, lowered from JSON Schema.

soothfast_sdk::target#

Target struct#

rust · ignore
pub struct Target { pub triple: &'static str, pub os: &'static str, pub cpu: &'static str, pub libc: Option<&'static str>, pub wheel_platform: &'static str, pub exe_suffix: &'static str }

One cross-compilation target and how each ecosystem names it.

built with cargo soothfast docs build source