# The story behind Apollo Kotlin 3 codegen

DevFeed: [The story behind Apollo Kotlin 3 codegen](<https://devfeed.tech/articles/the-story-behind-apollo-kotlin-3-codegen-23544.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/the-story-behind-apollo-kotlin-3-codegen>)

Author: Martin Bonnin

Published: 2022-04-26T09:21:00Z

Content type: article

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [Code generation](<https://devfeed.tech/topics/code-generation.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [multiplatform](<https://devfeed.tech/topics/multiplatform.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>)

Tags: [apollo](<https://devfeed.tech/tags/apollo.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [sealed-classes](<https://devfeed.tech/tags/sealed-classes.md>)

## AI overview

This article explains the design and tradeoffs behind Apollo Kotlin 3 code generation. It describes the challenges of making the codebase Kotlin Multiplatform and implementing GraphQL fragments as interfaces, then compares operation-based model generation with simpler schema mappings. The article argues that operation-based models provide better type safety and compile-time verification by avoiding unnecessary nullability.

## Source excerpt

Apollo Kotlin 3 was released in December 2021. This is a significant release for Apollo Kotlin, and it's fair to say it took significant effort to reach that point 🚀. Now that Apollo Kotlin 3 is in orbit 👨🚀, it is a good time to reflect on how we got there and the different tradeoffs involved in generating type safe models from GraphQL operations. When we started Apollo Kotlin 3, we had two main goals: Our initial gut feeling was that 1. was a huge task and 2.