Multi-File Output
For large specs, enable split-schemas to emit every schema into its own file under schemas/:
npx tsp compile api.tsp \ --emit @lars-artmann/typespec-asyncapi \ --option @lars-artmann/typespec-asyncapi.split-schemas=trueor in tspconfig.yaml:
options: "@lars-artmann/typespec-asyncapi": split-schemas: trueWhat changes
Section titled “What changes”- Every
components.schemasentry becomesschemas/Name.yaml(or.json) - All
$refvalues are rewritten from#/components/schemas/Nametoschemas/Name.yaml— in the main document and in the schema files themselves - The main document keeps channels, operations, messages, and all other components inline
When to use it
Section titled “When to use it”- Specs with dozens of schemas that become unreadable in one file
- Review diffs that should show one schema per change
- Downstream tools that consume per-schema files
Where to go next
Section titled “Where to go next”- Emitter Options — all output options
- split-schemas example — multi-file output in practice
- Schema Generation — what lands in components.schemas