website/src/pages/plugins/java/kotlin.mdx
import { Callout } from '@theguild/components' import { PluginApiDocs, PluginHeader } from '@/components/plugin' import { pluginGetStaticProps } from '@/lib/plugin-get-static-props' export const getStaticProps = pluginGetStaticProps(__filename)
<PluginHeader />The kotlin plugin generates Kotlin classes for Enums and Input types.
You can use this plugin to generate Java enums based on your GraphQL schema, and it also generates a type-safe Kotlin transformer for GraphQL input types.
To get started with these plugins and preset, make sure you have the following installed:
Run the following in your Android project:
npm init --yes
npm install graphql
npm install -D @graphql-codegen/cli @graphql-codegen/kotlin
Then, create codegen.yml with the following configuration:
schema: POINT_TO_YOUR_SCHEMA
documents: POINT_TO_YOUR_GRAPHQL_OPERATIONS
generates:
./app/src/Types.kt:
plugins:
- kotlin
<Callout>Also, make sure to add node_modules to your .gitignore file.</Callout>