basysKom AnwendungsEntwicklung

FOSS-Update: basysKom contributions to the OpenAPI Generator
Essential Summary
Over the last months basysKom contributed a number of improvements to the OpenAPI Generator project. OpenAPI as a standard provides a structured way to define, implement, test and maintain REST-like APIs.
Professionelle Entwicklung Ihrer HMI

Sie benötigen ein Geräte-HMI, Ihnen fehlt es aber an Zeit oder speziellem HMI-Know-How?​

Warum Dienstleistungen von basysKom?

Von der Konzeption über die Implementierung bis zum Testen unterstützen wir Sie in der Entwicklung Ihrer individuellen HMI. Unsere Services umfassen zudem die Technische Beratung, individuelle Trainings, Coaching, Verstärkung Ihrer Entwicklungsteams bis hin zur vollständigen Auftragsabwicklung im gesamten Lebenszyklus Ihres Produktes.

Over the last months basysKom contributed a number of improvements to the OpenAPI Generator project. OpenAPI as a standard provides a structured way to define, implement, test and maintain REST-like APIs. A key feature of OpenAPI is a formal language which is used to specify APIs. This language can be used to automatically generate client- and server-side stub code. The OpenAPI Generator supports code generation for over 40 languages and frameworks. The support for Qt was, so-far, a bit lacking. This article provides an overview of our ongoing work to improve the Qt-support in the OpenAPI Generator. We have split this post in sections, where we briefly highlight the change, what it enables and where you find the commit.

Security

When working with APIs, authentication and authorization are important aspects to consider. While the OpenAPI specification addresses these topics, the OpenAPI Generator for Qt did not support any of them. As a first step, we implemented support for the BasicAuth and the ApiKey mechanism (OpenAPI 2.0/3.0) We also added BearerToken support which is part of OpenAPI 3.0. The according pull request can be found here.

In addition to that, we worked on the Oauth2 security feature. The generator now allows to use all the Oauth2 flows from the OpenAPI Specification to generate access tokens: Implicit Flow, Password Flow, Authorization Code Flow and the Implicit Flow. This pull request was recently merged and can be found here.

ParameterizedServer

Next up there is the Parameterized Server support. This is a feature where the server URL can be parameterized with a placeholder to select the actual endpoint being used. This can be useful when there are several server endpoints e.g. when there is a develop, staging and production environment. The merged pull request can be found here.

ParameterSerialization

OpenAPI uses Uniform Resource Identifier (URI) RFC3986 to identify a resource. The URI Template specification RFC6570 defines multiple ways on how a URI can be structured. Different delimiters for query, path or cookie parameters, for example. Query parameters are delimited by an ampersand by default, but you can choose from other delimiters according to the URI Template specification. OpenAPI defines a set of rules that are using the URI Template specification. It is called ParameterSerialization and allows to provide styling options for the parameter serialization in a request. We implemented this feature for Qt with this pull request.

Data types: Unique Items

OpenAPI allows to define data types as well as various properties of these data types. The unique items  feature allows to specify an array that should not contain duplicate items. This can be useful when you want to prevent that for example the same ID is used twice in one request. On the Qt-side this is exposed as a QSet. Our contribution enables this feature now

Qt6 and further on

Qt6 was not yet supported by the Generator. Enabling it was easy and boiled down to preventing the generator from emitting certain deprecated functions. The code produced by the generator is now expected to also compile without warnings in Qt6 projects. The pull request can be found here.

Most of the improvements outlined above have been released with the OpenAPI generator v5.1.0.

basysKom is offering consulting, training and development services around Qt. We also work with Open Source projects to bring features & bugfixes upstream. Come talk to us for support in your next project.

Picture of Frank Meerkötter

Frank Meerkötter

Frank Meerkoetter is the Development Lead for basysKom GmbH, where he is consulting customers on industrial and embedded applications, often in combination with Qt. He is responsible for the technical consulting, system- and software-architecture within basysKom. He used to be the the maintainer of Qt OPC UA (2017-2024) and a contributor to the Qt project. He has a strong background in Embedded Linux, systems programming, distributed systems and application development. He holds a Master of Computer Science from the University of Applied Sciences in Darmstadt.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Weitere Blogartikel

basysKom Newsletter

We collect only the data you enter in this form (no IP address or information that can be derived from it). The collected data is only used in order to send you our regular newsletters, from which you can unsubscribe at any point using the link at the bottom of each newsletter. We will retain this information until you ask us to delete it permanently. For more information about our privacy policy, read Privacy Policy