Skip to main content
OpenAPI describes individual fields well, but many valid service payloads depend on relationships between fields. Simile adds x-simile-constraints for relationships inside one payload and x-simile-from-request for public relationships between an operation’s request and response. For example, OpenAPI can require created_at and updated_at to be RFC 3339 timestamps. The Simile extension can additionally require them to appear in chronological order:
The result is executable contract rather than descriptive metadata. Simile compiles each clause for two jobs:
  • proof — reject an incoming request or generated response that violates the relationship;
  • construction — establish the relationship while synthesizing a request or response.
Invalid paths, incompatible types, contradictory clauses, and unsupported operators fail service compilation. Simile never silently ignores a constraint it cannot execute.

Extension map

Use ordinary OpenAPI keywords for field-local rules such as required, enum, minimum, maxLength, oneOf, and format. Use x-simile-constraints only when multiple values must be understood together.
For the complete constraint vocabulary, read x-simile-constraints. For the design model and proof semantics, read Payload soundness. For approximate generation when a provider has not published a relationship, read Generation heuristics.