Skip to content

Key Concepts of TypeSpec

necusjz edited this page Sep 23, 2025 · 2 revisions

A basic introduction to TypeSpec. At the very least, you need to know that currently, codegen's TypeSpec parsing is done on the frontend.

src/typespec

It's a Git submodule, usually we use git submodule update --init --recursive --checkout --force to sync with it.

https://github.com/Azure/typespec-azure leverages https://github.com/microsoft/typespec as "core".

src/typespec-aaz

The parsing logic is in the frontend. It'll generate an initial data model to backend.

src/aaz_dev/swagger

TypespecCommandGenerator transforms swagger to aaz data model. It contains several APIs:

  • @bp.route("//<list_path:mod_names>/ResourceProviders", methods=("GET",))
  • @bp.route("//<list_path:mod_names>/ResourceProviders/<rp_name>/TypeSpec", methods=("GET",))

Misc.

Entry file is main.tsp. The frontend doesn't have direct access to the disk, so it will ask for this from the backend.

web/src/typespec/brower-host.ts, the entire TypeSpec functionality does need a browser host.

eng/scripts/bundle_dists.js packages all TypeSpec libraries.

Emitter is kind of plugin.

Clone this wiki locally