This project aims to provide a setup to generate OpenAPI clients in various languages using multiple toolchains and to compare them.
Requirements:
make(generator tasks)- .NET SDK 8 (Kiota, NSwag, and C# tests)
uvanduvx(OpenAPI Generator, and Python tests)- Node.js and
npx(OpenAPI mock server)
git clone https://github.com/criteo/openapi-clients-analysis.git
cd openapi-clients-analysis/
make| Language | Generators |
|---|---|
| C# | Kiota 1.29.0, NSwag 14.6.2, OpenAPI Generator 7.17.0 |
| Python | Kiota 1.29.0, OpenAPI Generator 7.17.0 |
API endpoints are described in the openapi.yaml OpenAPI 3.0 specification. We generate all clients directly from it.
Each generated client corresponds to a task in the Makefile. To generate all the clients, simply run:
make # add -j4 to build them in parallelThe outputs are in the clients directory.
To mock the OpenAPI specification, run:
./mock.shThis launches a Prism mock server on http://127.0.0.1:4010 that listens to all specified endpoints, validates requests, and returns the responses defined under example: in each endpoint’s specification.
A NUnit suite to test all three C# clients is maintained in Criteo.OpenApiClientsAnalysis.UTest.
To run the tests, start the mock server, then:
dotnet testNo proper test suite yet, just some playground scripts colocated next to the generated clients in clients/python.
uv sync # setup .venv and install clients
uv run <script.py>