Microsoft's Project Kiota Simplifies API Client Development with OpenAPI Definitions

Riley King

Riley King

January 16, 2025 · 4 min read
Microsoft's Project Kiota Simplifies API Client Development with OpenAPI Definitions

Microsoft has unveiled Project Kiota, an open-source tool that simplifies API client development by leveraging OpenAPI definitions. This innovative solution enables developers to automate the process of building API clients, eliminating the need to learn a new REST library for each language used. With Kiota, developers can focus on writing code rather than worrying about the underlying API complexities.

At the heart of modern application development lies service-oriented architectures, which involve building applications from a mix of services. Microsoft has long been a proponent of API-first design and development, providing low-level tools to build and deliver APIs. The company's API strategy is built around the OpenAPI description language, which makes it easy to build applications with self-describing APIs. OpenAPI descriptions are delivered as a standard build artifact, alongside binaries, allowing tools like Visual Studio to consume the description and build a scaffolding for clients to use with HTTP APIs.

However, not all languages and toolchains are supported by Visual Studio. This is where Project Kiota comes in – a standalone CLI-based tool that works with OpenAPI descriptions to generate API clients for multiple languages, including Dart, Go, Ruby, and more. The tool is designed to quickly add new language support, with work already underway for Swift and TypeScript.

The primary goal of Project Kiota is to eliminate the need for developers to take a dependency on a different API client library for every API they need to call. By generating methods and objects, Kiota simplifies the development workflow, avoiding over-complication. The tool provides a basic set of tools for serializing and deserializing JSON payloads and allows developers to specify which elements of an OpenAPI description they're implementing, resulting in simpler generated code.

Getting started with Kiota is relatively straightforward. Developers can download binaries for Linux, macOS, and Windows, or use a prebuilt Docker image. The tool can also be installed from the .NET CLI, and community-built alternatives are available using services like the asdf tool-version manager or the Homebrew macOS package manager. A preview extension is also available for Visual Studio Code, plugging Kiota directly into the editor.

Using Kiota is a relatively simple process. Developers need to install the Kiota command-line tool, ensure their project has the right settings, and include Kiota's dependencies. They can then generate an API client from OpenAPI YAML, which can be a local file or a URL for public APIs. The generated client classes can be imported and used in the application, with calls to the API encapsulated in methods in the Kiota-generated class.

The benefits of using Kiota extend beyond the coding workflow. The tool can quickly build tests for service-oriented architectures, dropping into a CI/CD pipeline to ensure services build correctly and are fit for use. Kiota can also be used as part of a low-code environment, building and validating connectors ready for use in workflows. Furthermore, Kiota clients could serve as the API equivalent of a semantic memory, capturing the API structure and leaving a client library ready for use by AI in future operations, reducing risk and helping manage and secure calls to services.

In conclusion, Project Kiota is a significant development in the world of API client development, offering a language-agnostic architecture that works with most common development toolchains. By automating the process of building API clients, Kiota simplifies the development workflow, allowing developers to focus on writing code rather than worrying about API complexities. As the technology continues to evolve, it's likely to have a profound impact on the way we build and interact with APIs.

Similiar Posts

Copyright © 2024 Starfolk. All rights reserved.