Qt 6.11 introduces a new OpenAPI module as a Technical Preview, featuring a code generator that produces Qt 6 C++ HTTP clients from OpenAPI YAML specifications. Built on top of the upstream OpenAPI Generator, it integrates with Qt's RESTful networking APIs and provides a dedicated CMake function `qt_add_openapi_client()` for seamless project setup. The post walks through a practical example of building a minimal ChatGPT client using the OpenAI API spec, requiring only two operations and no manual JSON parsing or QNetworkRequest handling. It also addresses whether code generators remain relevant in the age of AI, arguing that generators offer reproducibility, consistency, and design correctness that AI tools cannot reliably guarantee.

6m read timeFrom qt.io
Post cover image
Table of contents
Digging Briefly into the Qt 6 Generator DetailsA Real Life Example - Simple ChatGPT ClientWith AI Everywhere, Do We Still Need Generators?Summary

Sort: