Getting Started with TypeSpec for HTTP
Let’s create a REST API definition with TypeSpec. TypeSpec has an official HTTP API “binding” called @typespec/http. It’s a set of TypeSpec declarations and decorators that describe HTTP APIs and can be used by code generators to generate OpenAPI descriptions, implementation code, and the like. Built on top of the HTTP library, there is the REST library @typespec/rest which provides some REST concepts like resources.
TypeSpec also has an official OpenAPI emitter called @typespec/openapi3 that consumes the HTTP API bindings and emits standard OpenAPI 3.0 descriptions. This can then be fed into any OpenAPI code generation pipeline.
Additionally, TypeSpec includes the @typespec/versioning library for handling service versioning.
References:
Read more here: Source link
