soothfast-sdk API reference#
Generated by
cargo soothfast docs referenceMeasurements and verified claims come from the latest baseline; CI gates them.
soothfast_sdk#
SdkFileSet struct#
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#
pub enum SdkKind { Python, TypeScript }
A language the SDK engine can emit.
SdkOptions struct#
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#
pub struct EnvVar { pub name: String, pub doc: Vec<String>, pub default: Option<String> }
One environment variable the embedded server reads.
markdown_table function#
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#
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#
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.
soothfast_sdk::model#
Field struct#
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#
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#
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#
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#
pub enum ParamLoc { Query, Path, Header }
Where a request parameter travels.
Sdk struct#
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#
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#
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.