atproto_sdl/printer/constraints
Renders atproto_lexicon/ast constraint records to their @attr(...)
spellings, and renders a ref string or UnionConstraints to its bare
type-position spelling. One function per constraint record, mirroring
lower’s build_*_constraints inverses.
Values
pub fn blob_attrs(c: ast.BlobConstraints) -> List(String)
pub fn boolean_attrs(c: ast.BooleanConstraints) -> List(String)
pub fn bytes_attrs(c: ast.BytesConstraints) -> List(String)
pub fn integer_attrs(c: ast.IntegerConstraints) -> List(String)
pub fn ref_display(ref: String) -> String
A ref string’s bare-local-name spelling: #localName prints as
localName (the printer’s canonical local-ref spelling), anything
else (a dotted cross-doc path) prints verbatim.
pub fn string_attrs(c: ast.StringConstraints) -> List(String)
pub fn string_type_name(
format: option.Option(ast.StringFormat),
) -> String
The scalar spelling for a string’s format: one of the ten format
sugar scalars (Cid, Did, …) when recognized, else plain
String (an unrecognized FormatOther becomes a @format(...)
attribute instead, via string_attrs).
pub fn union_display(c: ast.UnionConstraints) -> String
A | B, A | B! (closed) for 2+ refs; a single-ref (or empty) union
must parenthesize ((A), (A!)), since a bare A is always a plain
ref, never a union of one: without the parens, a real single-ref
open union (e.g. catalog.edit’s fields, deliberately a union of
one so more variants can be added later) would print indistinguishably
from PropRef and reparse as one.