Skip to main content

Qt and OpenAPI/Swagger - a tutorial – Dev/Des 2021

OpenAPI (aka. Swagger) is a widely used technology to implement APIs in a cloud/IT context. It provides a structured, integrated, and language-agnostic way to design, test, and maintain HTTP-APIs based on an interface definition language (IDL).

One of the biggest selling points of OpenAPI is the ability to generate server-/client-side code for various languages and frameworks based on a common IDL. Typical use-cases from a Qt perspective are desktop or mobile applications that need to interact with a cloud-based backend service.

This tutorial will provide an overview of OpenAPI in general, its root in the Swagger-project, the tools of the ecosystem, and how to best work with it in the context of a Qt application. In a hands-on session, we will review an existing API using Swagger-UI, generate Qt-specific client code and wrap everything up into a working Qt Quick HMI. We will also present our ongoing work on improving the Qt support within the OpenAPI ecosystem.