FAQ
Is this production-ready?
Section titled “Is this production-ready?”Yes. v1.0.0 froze the public surface and v1.3.0 is the current release. The emitter is gated by the full vitest suite, a 308-test AsyncAPI 3.1.0 compliance suite, a 75% per-file coverage floor, and zero-clone duplication checks. Every emitted document in CI is validated with AJV against the official schema.
Which AsyncAPI version does it emit?
Section titled “Which AsyncAPI version does it emit?”3.1.0, the latest release. The output is validated against the official AsyncAPI 3.1.0 JSON Schema, not a hand-maintained approximation.
Does it support AsyncAPI 2.x?
Section titled “Does it support AsyncAPI 2.x?”No. There is no 2.x output mode. The reference chains and component structure differ enough that downgrading would produce a different document, not a flag. If you need 2.x, keep it as a separate conversion step.
How is this different from tsp-asyncapi?
Section titled “How is this different from tsp-asyncapi?”Both are TypeSpec emitters. This one targets AsyncAPI 3.1.0, validates every output against the official schema, generates binding metadata and placement rules from @asyncapi/specs, and ships reusable components plus split-schema output. See the comparison snapshot for the current table.
Can I use it together with @typespec/openapi3?
Section titled “Can I use it together with @typespec/openapi3?”Yes. Model REST endpoints under a @service namespace and event operations in a sibling namespace outside that service subtree. @typespec/http routes every operation under a service as REST, so event operations placed inside one become phantom OpenAPI routes and collide as duplicate GETs. The emitter warns with event-op-in-service-namespace and excludes http-routed operations from the AsyncAPI document. See Mixing with OpenAPI.
Where does the output go?
Section titled “Where does the output go?”tsp-output/@lars-artmann/typespec-asyncapi/asyncapi.yaml by default. The output-file and file-type options rename and reformat it; split-schemas writes one file per schema under schemas/.
How do I suppress a diagnostic?
Section titled “How do I suppress a diagnostic?”Use the compiler’s standard suppression:
#suppress "@lars-artmann/typespec-asyncapi/bare-op-assumed-rest" "This op is intentionally REST-only"See Diagnostics for the full list and severity.
Does it work with Bun, Deno, or the browser?
Section titled “Does it work with Bun, Deno, or the browser?”The TypeSpec compiler itself runs on Node.js. The emitter is plain ESM and has no Bun-specific runtime requirements, but the supported toolchain is Node.js 20.11+ with the tsp CLI. Bun is used in this repository only to collect coverage, not to run the emitter.
Can I keep my existing AsyncAPI YAML?
Section titled “Can I keep my existing AsyncAPI YAML?”Yes, as a reference while you migrate. There is no importer: model the same channels and messages in TypeSpec, then compare the emitted document to your hand-written one. Migration guide.
How do I version the emitted document?
Section titled “How do I version the emitted document?”Three sources, highest precedence first: the version emitter option, @apiVersion, then the latest value of a @versioned enum. See Versioning.
Is the document spec-complete or just schema-valid?
Section titled “Is the document spec-complete or just schema-valid?”Both are tested. AJV validation proves the document conforms to the AsyncAPI 3.1.0 JSON Schema; the compliance suite additionally asserts exact $ref chains, binding placements, security shapes, and schema output. Schema validity alone would not catch a semantically wrong $ref.
Where do I report a bug?
Section titled “Where do I report a bug?”GitHub issues. Include the TypeSpec input, the emitted output, and the diagnostics. Security reports go through GitHub security advisories.
Where to go next
Section titled “Where to go next”- Installation — requirements and setup
- Architecture — how the emitter is put together
- Related Tools — the surrounding ecosystem