Alpha. Vary is under active development and not ready for production use. Syntax, APIs, performance, and behaviour may change between releases.

content

import content exposes the runtime-backed domain types that represent validated public content. Every type has a private constructor; the only way to produce a value is the corresponding Type.validate(raw) call.

Domain typePurpose
IssueTitleBounded length, no control characters, no markup.
MarkdownBodyBounded length; safe for Markdown.render_body(...).
SafeHtmlOutput of trusted HTML producers (see below).
PlainTextBounded text with control characters stripped.
UsernameLength, allowed characters, reserved-name list.
EmailAddressLength and format check.
LabelNameIssue label rules.
PublicUrlURL parsing plus UrlPolicy checks.
SearchTextSearch-friendly text (normalized, length bound).
SearchIndexNormalized search input ready to feed the search index.

Content-type selection

The Vary HTTP runtime emits the correct response Content-Type for the declared response shape:

Response formContent-Type
response NameResponse { ... }application/json; charset=utf-8
Handler returning a JSON envelope from api_responseapplication/json; charset=utf-8
Markdown.render_body(...).safe_html()text/html; charset=utf-8
xml_document(root)application/atom+xml or application/xml
Plain text bodytext/plain; charset=utf-8

For routes that need a non-default media type, use the raw_content endpoint clause (see HTTP services). The boundary refuses to mix declared media types with hand-built Str bodies that pass through unchecked.

Security constraints

content is the only safe source for the typed HTML and Markdown sinks. Direct Str flow into Markdown.render_body, the SafeHtml sink, or the HTML response body is a compile error - the type checker rejects it before code generation. Validate at the boundary, work with the domain type, and let the runtime render.