11# openiap-gql Code Generation Guide
22
3- This repository is the single source of truth for the OpenIAP GraphQL schema. The SDL
3+ <!-- markdownlint-disable MD033 -->
4+ <p align =" center " >
5+ <img src =" ./logo.png " alt =" OpenIAP GraphQL logo " width =" 320 " />
6+ <br />
7+ <strong >OpenIAP meets GraphQL</strong >
8+ </p >
9+ <!-- markdownlint-enable MD033 -->
10+
11+ _ Unified schema and multiplatform codegen toolkit for OpenIAP._
12+
13+ This repository is the single source of truth for the OpenIAP GraphQL schema. The SDL
414files live in ` src/ ` and are split into common (` type.graphql ` , ` api.graphql ` ), error
515taxonomy (` error.graphql ` ), and platform-specific (` *-ios.graphql ` , ` *-android.graphql ` )
616definitions.
717
818To keep every consumer in sync, code generation helpers are provided for
9- TypeScript, Dart, Swift, and Kotlin. Each section below explains the tooling,
10- commands, and output locations. Update the schema files first, then rerun the
19+ TypeScript, Dart, Swift, and Kotlin. Each section below explains the tooling,
20+ commands, and output locations. Update the schema files first, then rerun the
1121appropriate generator for your target language.
1222
1323---
@@ -21,15 +31,15 @@ Uses [`@graphql-codegen/cli`](https://www.the-guild.dev/graphql/codegen).
21313 . Generate types: ` npm run generate `
22324 . Generated output: ` src/generated/types.ts `
2333
24- Configuration lives in ` codegen.ts ` . The script merges every SDL file and
34+ Configuration lives in ` codegen.ts ` . The script merges every SDL file and
2535emits a schema-first type layer that mirrors the documented shapes.
2636
2737---
2838
2939## Dart
3040
3141Uses [ ` graphql_codegen ` ] ( https://pub.dev/packages/graphql_codegen ) with
32- ` build_runner ` . A ready-to-use package scaffold is located in
42+ ` build_runner ` . A ready-to-use package scaffold is located in
3343` generators/dart/ ` .
3444
35451 . Install Dart 3.0+.
@@ -40,30 +50,30 @@ Uses [`graphql_codegen`](https://pub.dev/packages/graphql_codegen) with
40506 . Generated output: ` generators/dart/lib/generated/ `
4151
4252The ` pubspec.yaml ` and ` build.yaml ` already point the generator at the shared
43- schema files in ` ../src ` . Customize package name, output path, and scalars as
53+ schema files in ` ../src ` . Customize package name, output path, and scalars as
4454needed for your application.
4555
4656---
4757
4858## Swift
4959
5060Relies on the official [ Apollo iOS CLI] ( https://www.apollographql.com/docs/ios/ )
51- for schema codegen. A helper script is provided in ` generators/swift/ ` .
61+ for schema codegen. A helper script is provided in ` generators/swift/ ` .
5262
53631 . Install the CLI (one time): ` brew install apollo-ios-cli `
54642 . Run the helper: ` generators/swift/generate-swift.sh `
55653 . Generated output: ` generators/swift/Generated/ `
5666
5767The script passes every SDL file to the CLI and emits an embedded module named
58- ` OpenIAPGraphQL ` . Adjust the script flags to fit your Xcode project (e.g.
68+ ` OpenIAPGraphQL ` . Adjust the script flags to fit your Xcode project (e.g.
5969` --module-type swiftPackage ` or supply operation files via ` --operation-paths ` ).
6070
6171---
6272
6373## Kotlin
6474
6575Recommended tooling is [ Apollo Kotlin] ( https://www.apollographql.com/docs/kotlin ) .
66- Use the Gradle plugin inside your Android project to consume the schema. Add a
76+ Use the Gradle plugin inside your Android project to consume the schema. Add a
6777codegen module (e.g. ` :openiap-graphql ` ) and configure it as follows:
6878
6979``` kotlin
@@ -93,14 +103,14 @@ dependencies {
93103```
94104
95105Then run ` ./gradlew :openiap-graphql:generateApolloSources ` to regenerate the
96- models. Keep your query/mutation documents under ` src/main/graphql ` inside that
106+ models. Keep your query/mutation documents under ` src/main/graphql ` inside that
97107module.
98108
99109---
100110
101111## Workflow Tips
102112
103- - Treat the SDL files in ` src/ ` as the canonical schema. Commit schema updates
113+ - Treat the SDL files in ` src/ ` as the canonical schema. Commit schema updates
104114 before shipping generated code.
105115- Regenerate types whenever you change schema shape or add operations in your
106116 client projects.
0 commit comments