PyCon DE & PyData 2026

Accelerate FastAPI Development with OpenAPI Generator
2026-04-15 , Ferrum [2nd Floor]

Develop FastAPI applications faster with the contract-first approach using the OpenAPI Generator, no GenAI required.

To attend this workshop, please install the openapi generator.
For details, please visit the README.md of https://gitlab.com/Eeffee/pycon26

Machine learning models are often deployed as APIs, but the "agreement" between the consumer and the service is often fragile. How does the consuming app know if a parameter is optional or required? When the code diverges from the documentation, integration breaks.
In this tutorial you will learn to define an API contract using OpenAPI specification. We will use the OpenAPI Generator to automatically generate API endpoints and strictly typed Pydantic data models. Following this approach for all applications supports standardization, consistency, and maintainability across all projects.

The session will cover three key areas:
Design: We will define an OpenAPI specification as our single source of truth for the API and end consumer.
Generate: We will use the OpenAPI Generator to create a FastAPI skeleton and show possibilities for customization to fit specific project needs.
Implement: We will connect our generated app to a ML model where we will create Mystic Creatures for Real Life Problems


Machine learning models are often deployed as APIs, where we have an endpoint that generates predictions given some input. For example, we can send a POST request specifying a color, a length, and a number of legs, and the endpoint predicts the best fitting animal. The description of the endpoint, the schema of the request, and the response acts as a form agreement between the consumer and the service. In practice, the restrictions on the API are not well defined. How does the consuming app know if a parameter is optional or required?
In this tutorial you will learn to define an API contract as an OpenAPI specification (OAS). OAS is a standardized description of the API endpoints and data models. We will demonstrate how to use the OpenAPI Generator to automatically generate the API endpoints and strictly typed Pydantic data models, by only designing the OAS in YAML format, without GenAI. OpenAPI Generator utilizes mustache templates to translate the specification into actual code. We will demonstrate use cases for customizing the template for specific needs of the resulting API stubs.
By generating code from the contract, you ensure that the deployed application always reflects the agreed-upon specification. It automates the writing of repetitive code, such as Pydantic models and endpoint definitions, allowing developers to focus on the implementation logic. It enforces standard patterns and structures, ensuring consistency and maintainability across different projects.

Expect fun mystic creatures after deploying the resulting API in your local environment.

Target Audience

Engineers and data scientists looking to standardize their FastAPI development workflow. We expect you to have basic knowledge in Python, virtualenv, Pydantic data models and FastAPI.

To attend this workshop, please install the openapi generator v7.20.
For details, please visit the README.md of https://gitlab.com/Eeffee/pycon26

Technical Setup

For details, please visit the README.md of https://gitlab.com/Eeffee/pycon26

Outline

  1. Introduction (10 min)
    * The philosophy of Contract-First development
    * Overview of the OpenAPI specification and Pydantic data models
    * Introduction to the OpenAPI generator tool
  2. Design (20 min)
    * Introduction to the unicorn service logic (Input: Real Life Problems, Output: Mystic Creatures)
    * Definition of the openapi specification, focusing on the Request and Response schemas
  3. Generate (30 min)
    * Running the standard vanilla OpenAPI generator
    * Introduction to mustache templates
    * Customization of the default mustache to inject our specific dependencies
  4. Implementing (15 min)
    * We will connect the generated API stubs to a predict() function that calls our unicorn generation service.
  5. Demo & QA (15m)
    * Running the server via uvicorn and testing our unicorn service endpoint using the Swagger UI.

Expected audience expertise in your talk's domain:: Intermediate Expected audience expertise in Python:: Intermediate

I am a senior MLOps engineer at Malt. A long time ago I studied physics in Amsterdam, after which I moved to Berlin to discover the world of data science. Currently I'm working at Malt exploring the boundaries between devops and data.

Kat is a Senior Machine Learning Engineer at Malt, the freelancer marketplace, where she works in the relevancy and matching team. She has a background in bioinformatics and passionate about beautiful code.