Skip to main content
When OpenAPI is selected as the service’s contract source, OpenAPI describes the complete public HTTP contract. HCL describes selected observable behavior that does not belong in that contract. Smithy and semantic TypeScript are equally supported alternatives; see Contract sources and HCL before choosing a format. The relationship is asymmetric: the selected contract is required and independently executable; HCL is optional and must agree with it. This page covers the OpenAPI form of that model.

What OpenAPI owns

OpenAPI is the authority for:
  • HTTP methods and paths;
  • request body presence, media types, and schemas;
  • response statuses, media types, and schemas;
  • public examples and tags;
  • callback and top-level webhook wire contracts; and
  • operationId, when a provider wants HCL to target an operation.
With only OpenAPI, Simile can run every normalized operation, validate a supported request body, and synthesize a response permitted by the contract. This baseline is intentionally useful: a provider should not have to rewrite its API before developers can emulate it.

What HCL adds

HCL can:
  • select a status already declared by the operation;
  • publish exact, schema-checked named outcomes;
  • select outcomes from public request values;
  • group outcomes into opaque test scenarios;
  • map Simile’s protocol-error categories to declared service responses; and
  • declare backends, transactional consequences, and post-response work;
  • attach one or more webhook occurrences to a committed effect; and
  • supply a minimal webhook contract only when the public API source omits it.
HCL cannot add a route, replace a request schema, invent a response status, or contradict OpenAPI. It targets an operation by its exact operationId, which is why an operation needs an ID only when HCL refers to it.

A minimal overlay

Suppose OpenAPI already declares POST /orders, operationId: createOrder, and a 201 response. The provider can choose that response and declare observable follow-up work:
The compiler verifies that createOrder exists, 201 is declared, and the backend reference resolves. behavior selects the public HTTP result, effect owns its synchronous consequences, and async owns work dispatched outside the response-critical path. The service supervisor applies this compiled plan without reopening HCL.

Exact outcomes without private rules

OpenAPI examples are the lowest-maintenance source of exact output. If a reusable failure family or scenario needs more control, HCL can provide a body that is checked against the selected OpenAPI response schema:
The scenario exposes the result a tester needs without embedding the provider’s private decline decision. That distinction is essential because distributed HCL is inspectable.

Why not put everything in HCL

A second full API language would create drift. Providers would have to maintain methods, paths, schemas, and examples twice, while ordinary OpenAPI tooling could not see the emulator’s contract. Keeping HCL additive makes source ownership clear and allows OpenAPI-only services to remain first-class. The same boundary applies to webhooks. OpenAPI owns a reusable outbound method and payload schema. HCL owns when an operation emits that message, how its body is projected from public request or response data, and any explicit causal dependencies between sibling occurrences. See Webhook delivery for the complete model. The complete block grammar, value types, defaults, and name-resolution rules are defined in the Simile HCL language specification. Use the HCL glossary when a term such as outcome, scenario, fault, or effect needs a precise definition. When ordinary OpenAPI Schema cannot express a public relationship between fields, Simile provides the executable x-simile-constraints extension. See the OpenAPI extension reference for its clause glossary and authoring rules.

Why not infer behavior from route names

POST /orders suggests creation to a human, but it does not prove what is stored, what identity is assigned, or what happens later. Simile refuses to turn naming conventions into state or effect semantics. Approximation is permitted only in bounded payload generation heuristics, where it is reported and never becomes a validation rule. Continue with Outcome fidelity for response selection or Dependencies and effects for backend declarations.