Paul Krill
Editor at Large

Microsoft unveils TypeSpec language for API development

news
May 2, 20242 mins

High-level definition language allows developers to define an API and then output many different protocols, clients, servers, and documentation, Microsoft said.

07 code type blocks letters
Credit: Michele M.F.

Microsoft has introduced TypeSpec, a language for API-centric development.

Unveiled April 25, TypeSpec is designed to meet the needs of API developers, managers, and architects in an environment where delivering high-quality APIs and related experiences has become increasingly critical and complex, Microsoft said. The company described TypeSpec as a lightweight language that describes APIs using any protocol or serialization format and encapsulates common data types, API patterns, and API guidelines into high level, reusable components. It can define complex data and API shapes with minimal types. 

The language was inspired by Microsoft’s TypeScript and C# languages and is easy to learn, according to Microsoft, which has used TypeSpec internally for many Azure cloud services. Instructions on getting started with the language can be found on the project website. Installation requirements also are accessible.

TypeSpec provides a platform that enables abstraction, encourages code reuse, and leverages modern tools including Visual Studio and Visual Studio Code for rapid development, Microsoft said. APIs are described using any protocol or serialization format with familiar syntax. The language can compile to OpenAPI, JSON Schema, Protobuf (Protocol Buffers), or all three simultaneously.

Microsoft said TypeSpec is “not just another API description language” but a higher-level definition language capable of defining an API and then outputting different protocols, clients, servers, documentation, and other capabilities. The language thus becomes a tool to adapt to a variety of development scenarios. Plus the tools for TypeSpec make development and maintenance easy, surfacing errors and guideline violations at development time, the company said.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author