Skip to main content
Smithy 2.0 is a first-class Simile contract source. The model is standalone: Simile derives the HTTP surface, payload schemas, examples, errors, soundness rules, and response construction from the Smithy document without consulting OpenAPI or another contract format.

Minimal runnable service

Create orders.smithy:
Compile and execute it:

HTTP operations and payloads

Every operation Simile executes needs @http. The operation name becomes its stable operationId. Input members use Smithy’s HTTP binding traits for parameters: Simile currently reads a body from the member marked @httpPayload. Add @required when the body must be present and use the local @contentType trait when it is not application/json.

Errors and exact outcomes

Attach errors to the operation and give every error shape both @error and @httpError:
Use the local dataExamples trait on a payload member or shape to publish exact JSON witnesses. Simile retains those examples as provider-authored outcomes when they validate against the shape.

Public semantic traits

Declare Simile’s traits in the model that uses them. That keeps the published Smithy source self-contained and makes the semantic surface reviewable by Smithy consumers. simileConstraints uses the same public relationship vocabulary as Simile’s schema engine: ordering, dynamic bounds, implications, equality, distinctness, set relationships, equations, aggregates, templates, and lifecycle snapshots. Every referenced path is relative to the shape carrying the trait and must resolve to a compatible member. Use ordinary Smithy traits such as @required, @pattern, @length, @range, @uniqueItems, @readonly, and @documentation for single-field rules. Reserve simileConstraints for relationships involving more than one value.

Mixins, unions, and closure

Simile flattens Smithy structure mixins using member-copy semantics. Structures compile as closed JSON objects. Tagged unions retain Smithy’s member-name wrapper; apply the local @untagged trait when the public JSON uses unwrapped alternatives. A simileSchema discriminator can materialize the discriminator member on its closed target shapes.

Current source boundary

Simile accepts one standalone .smithy document per compilation. It does not currently assemble a multi-file Smithy model or resolve external model packages. Prelude shapes and traits are available, and every custom Simile trait must be declared locally. Compilation fails on unresolved operations, invalid HTTP statuses, incompatible semantic paths, and malformed trait values. Use this contract in a service configuration with:
Next, read Contract sources and HCL for source ownership or Payload soundness for the shared proof and synthesis model.