Expand description
Schema-driven YAML template emitter for faucet init.
Given a schemars-emitted JSON Schema for a connector config struct,
schema_to_yaml_template walks the schema’s properties and produces a
comment-annotated YAML block suitable for pasting under config: in a
generated pipeline file. Required fields are surfaced with placeholder
values and a # REQUIRED comment; optional fields are commented out so
users can opt in by uncommenting and editing.
The emitter is intentionally a string builder rather than a serde_yaml
round-trip: comments and required/optional distinctions matter to the
reader and would be lost by any round-trip through a generic YAML value.
Structs§
- Tagged
Enum Field - A top-level property whose schema is a tagged enum (
oneOfwith aconstdiscriminator field). Returned bydiscover_tagged_enum_fieldsso the CLI’s interactive mode can prompt the user for the variant before emitting the scaffold.
Functions§
- discover_
tagged_ enum_ fields - Walk the top-level properties of
schemaand return every property whose schema is a tagged enum.$refs are resolved against$defs. - schema_
to_ yaml_ template - Render the
propertiesofschemaas a YAML block, indented byindent_spacescolumns. Returns a string that always ends with\n. - schema_
to_ yaml_ template_ with_ choices - Like
schema_to_yaml_template, but each entry inchoicesoverrides the inlined variant for a tagged-enum field whose property name matches the key. (e.g.choices.insert("auth", "Bearer")makes the Bearer variant the inlined default.) Unknown variant tags fall back to the first variant.