.d.ts
files that describe payload values and HTTP operations directly. Simile parses the declarations
with OXC; it never executes JavaScript, invokes tsc, or expects an object representation of
another contract format.
Minimal runnable service
Createorders.d.ts:
Operation registry
Simile discovers public operation interfaces whose names end inOperations. Every member name is
an operationId; every member declares a literal method, literal path, optional tags and
parameters, an optional request, and declared responses.
content keys are literal media types. Use a numeric
status string such as "201" or a supported status range declared by the contract package.
Payload types
Use declarations that describe public JSON values: objects, interfaces, literal types, unions, intersections, tuples, arrays, template literal types, and references to other payload types. Simile recognizesDateTime, Uri, EmailAddress, and Binary as formatted scalar aliases.
The current frontend lowers TypeScript’s number to a JSON number. It does not infer integer,
numeric-bound, string-length, or array-length facets from a type name. Use literal unions and
template literal types when they state the real finite or patterned contract; otherwise report the
unsupported local facet instead of implying that a branded alias enforces it.
TypeScript object types are structurally open. Wrap an object in Closed<T> when the service
rejects undeclared properties. Optional properties remain distinct from required properties whose
value includes null.
Request and response direction can use separate payload types. A split provider contract may also
publish Input and Output namespaces, but the operation registry remains the authority for which
type is used on each wire edge.
Soundness propositions
SchemaSoundness attaches public cross-field propositions to their owning payload type. Simile
lowers these semantic types into its shared schema constraints and uses them for validation and
synthesis.
Supported relationship types are:
Ordered,Bounded,Implies, andEqualFields;DistinctValuesandSetRelationship;EquationwithField,Literal,Add,Subtract, andMultiplyexpressions;AggregateandTemplate; andLifecycle.
EqualsAt, StateAt, ContainsAt, and CompareAt. Paths are tuples of field
segments; use the entire "*" segment to select every array item. Attach each proposition to the
narrowest payload owner that contains all participating fields.
Use ordinary TypeScript types for the field-local rules they can express. Do not create a semantic
proposition merely to restate requiredness, literal values, or nullability, and do not use a
cross-field relationship to approximate an unsupported scalar facet.
Request-to-response relationships
PublishResponseRelations or resource-local interfaces ending in ResponseRelations. The
structure is operation ID, response status, content type, then the literal relation document:
Provider-authored examples
Literal witnesses live inOperationExamples. Request examples are keyed by name; response
examples are additionally grouped by status:
Split declaration packages
A.d.ts entrypoint recursively loads only relative declaration imports and exports. Bare package
imports are not fetched. Passing a directory loads every non-test .d.ts file below it. A remote
TypeScript URL must therefore contain the whole contract in one document.
A practical package separates core, payload models, request and response types, operation groups,
soundness propositions, response relations, and examples behind a small commerce.d.ts barrel.
Unsupported declarations that are not referenced by the public payload graph are ignored;
unsupported referenced declarations fail compilation.
Use the package in a service configuration with: