> Markdown version of [/videos/1150-openapi-meets-openai](https://www.wearedevelopers.com/videos/1150-openapi-meets-openai). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # OpenAPI meets OpenAI Stop manually coding routine CRUD operations. Discover how to strategically prompt GPT-4 with OpenAPI specs to instantly generate functional, compile-ready Kotlin and Spring backend components. - **Speakers:** [Christopher Walles](https://www.wearedevelopers.com/@christopher-walles) - **Event:** World Congress 2024 - **Published:** August 22, 2024 - **Duration:** 29:50 - **URL:** https://www.wearedevelopers.com/videos/1150-openapi-meets-openai ## Summary Modern backend development often involves writing repetitive code for database-centric operations, taking engineering time away from domain-specific business logic. By combining OpenAPI specifications with large language models like GPT-4, engineering teams can transcend basic server stubs and directly generate functional, compile-ready backend implementations. This generative architecture leverages the structured nature of YAML configurations to explicitly outline schemas and operations, which an AI can interpret to write accurate codebase components mapped against popular tooling like the Spring framework and Kotlin. The most effective strategy for reliable code generation sidesteps feeding entire API specification documents to the model all at once. Instead, developers should break the architecture breakdown into small, contextual chunks by methodically prompting the LLM to sequence request/response schemas, database entities, data repositories, and finally, execution controllers. By injecting previously generated classes back into the prompt context for subsequent steps, the LLM maintains strict syntactic correctness and accurately builds isolated object-relational database models. Crucially, explicitly prompting the LLM to skip natural language code explanations preserves expensive output tokens and yields machine-readable results ready for direct file saving. While this LLM-augmented workflow dramatically accelerates greenfield endpoint implementation and accurately translates documented constraint paths into HTTP error responses, structural edge cases remain. Autogenerated server components are currently optimized for direct CRUD workflows rather than complex, highly abstracted enterprise business logic. Furthermore, baseline generative operations often channel logic directly into controllers, circumventing modern modular best practices like dedicated service layers. Nevertheless, strategically integrating LLMs to eliminate the initial friction of schema parsing provides a significant velocity boost for backend repository operations. **Keywords:** openapi specification, generative AI integration, LLM prompt engineering, spring framework backend, kotlin server code, REST API automation, YAML schema chunking, ORM database mapping, CRUD endpoint generation, boilerplate code reduction, object-relational mapping, output token optimization, HTTP request handling, generative software architecture ## Chapters 1. **Generating functioning backend code from OpenAPI specifications** (00:11) — Using generative AI to eliminate repetitive backend engineering tasks. 1. **Understanding the purpose of OpenAPI specifications** (02:25) — Formal API descriptions in YAML enable documentation and automated client or server stub generation. 1. **Deconstructing API backends and the Pet Store schema** (05:14) — Breaking down database-heavy operations using API schemas from the classic open API pet store example. 1. **Breaking large code generation tasks into smaller segments** (10:08) — Slicing the YAML file into individual pieces ensures more reliable generative output from language models. 1. **Modeling backend components with the Spring framework** (11:25) — Mapping generated backend functionality to controllers, repositories, entities, and database schemas using Kotlin and Spring. 1. **Prompt engineering techniques for generating schema classes** (15:37) — Structuring strict rules and supplying limited context chunks prevents models from outputting unnecessary code explanations. 1. **Generating database entities and resolving relationship mapping** (21:14) — Instructing the language model to translate id references into exact foreign key dependencies for relational databases. 1. **Generating dynamic API endpoint controllers and repositories** (23:22) — Supplying previously generated schema context prompts the model to correctly wire database access and explicit HTTP error handling. 1. **Limitations of directly generating implementation strictly to controllers** (27:20) — Placing business logic strictly in controllers bypasses application service layers and exposes fundamental API specification gaps. ## Related Moments - [Integrating generative AI into software development workflows](https://www.wearedevelopers.com/videos/952-the-transformative-impact-of-genai-for-software-development-and-its-implications-for-cybersecurity) (from "The transformative impact of GenAI for software development and its implications for cybersecurity") - [Building agentic workflows using prompt engineering and language models](https://www.wearedevelopers.com/videos/1266-navigating-the-ai-revolution-in-software-development) (from "Navigating the AI Revolution in Software Development") - [Automating documentation and code generation with OpenAPI standards](https://www.wearedevelopers.com/videos/759-awful-apis-a-history-lesson-in-industry-mistakes-and-mishaps) (from "Awful APIs: A History Lesson in Industry Mistakes and Mishaps") - [Overcoming challenges with OpenAPI generators for custom SDKs](https://www.wearedevelopers.com/videos/128-building-a-friendly-kotlin-sdk-to-connect-to-jetbrains-space) (from "Building a Friendly Kotlin SDK to Connect to JetBrains Space") - [Overview of generative AI and the presentation agenda](https://www.wearedevelopers.com/videos/1001-langchain4j-an-introduction-for-impatient-developers) (from "Langchain4J - An Introduction for Impatient Developers") - [Integrating generative AI capabilities via cloud-based API endpoints](https://www.wearedevelopers.com/videos/1001-langchain4j-an-introduction-for-impatient-developers) (from "Langchain4J - An Introduction for Impatient Developers") ## Related Articles - [MLOps And AI Driven Development](https://www.wearedevelopers.com/magazine/82-mlops-and-ai-driven-development) - [How to Use Generative AI to Accelerate Learning to Code](https://www.wearedevelopers.com/magazine/530-how-to-use-generative-ai-to-accelerate-learning-to-code) - [What Are Large Language Models?](https://www.wearedevelopers.com/magazine/304-what-are-large-language-models) - [WWC24 Talk - Scott Hanselman - AI: Superhero or Supervillain?](https://www.wearedevelopers.com/magazine/469-wwc24-talk-scott-hanselman-ai-superhero-or-supervillain) ## Related Jobs - [AI Software Engineer (Germany)](https://www.wearedevelopers.com/jobs/48317-ai-software-engineer-germany) at **Sunhat** - [Staff Software Engineer, Copilot Experiences](https://www.wearedevelopers.com/jobs/ext/164361-staff-software-engineer-copilot-experiences) at **GitHub** - [Senior AI Agent Software Engineer (Go, Python) (m/f/x)](https://www.wearedevelopers.com/jobs/48277-senior-ai-agent-software-engineer-go-python-m-f-x) at **Dynatrace** - [AI & Machine Learning Engineer (all genders)](https://www.wearedevelopers.com/jobs/48217-ai-machine-learning-engineer-all-genders) at **msg** - [Principal Software Engineer, Enterprise AI Platform](https://www.wearedevelopers.com/jobs/ext/1467292-principal-software-engineer-enterprise-ai-platform) at **GitHub** - [AI Full Stack Engineer](https://www.wearedevelopers.com/jobs/ext/1354435-ai-full-stack-engineer) at **Almedia**