Skip to content

Commit

Permalink
docs: Clarify other schema module type (#3170)
Browse files Browse the repository at this point in the history
  • Loading branch information
calvincestari authored Aug 1, 2023
1 parent c3f6951 commit 1e0f8dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/source/code-generation/codegen-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,13 @@ let configuration = ApolloCodegenConfiguration(

**[`ModuleType.other`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.enum/other)**

This option should be used when you would like to define a schema module using another package management system, such as CocoaPods, or manually creating Xcode targets.
This value should be used when you would like to define a schema module using another package management system (such as CocoaPods), or you want more control over the generated package than what [`ModuleType.swiftPackageManager`](https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/schematypesfileoutput/moduletype-swift.enum/swiftpackagemanager) allows, or manually creating your own targets or modules in another way.

`ModuleType.other` indicates to the Code Generation Engine that your schema types will be contained in their own target, rather than embedded in your application target. This affects the `import` statements in your generated operation definition files.

Using this option, you are required to create a target for your schema module using your preferred package manager.
Using this option, you are required to create a target, or module, for your schema module using your preferred package manager.

> **Note:** The name of the target for your schema module must be the [`schemaNamespace`](#schema-namespace) provided in your configuration, as this will be used in the `import` statements of generated operation files.
> **Note:** You must specify the name of the target, or module, you created in the [`schemaNamespace`](#schema-namespace) property of your configuration. This will be used for `import` statements as well as to fully qualify the referenced types in generated operation files.
<MultiCodeBlock>

Expand Down
6 changes: 4 additions & 2 deletions docs/source/project-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ Use the [`.swiftPackageManager`](./code-generation/codegen-configuration#swift-p

You can also include schema types directly in a target that you created.

To do this, use [`ModuleType.embeddedInTarget(name: String)`](./code-generation/codegen-configuration#embedded-in-target) as the value of the [`output.schemaTypes.moduleType`](./code-generation/codegen-configuration#module-type) property. The generated schema types are then enclosed in a caseless namespace enum to prevent naming conflicts with types you already defined in your target.
To do this, use [`ModuleType.embeddedInTarget(name: String)`](./code-generation/codegen-configuration#embedded-in-target) as the value of the [`output.schemaTypes.moduleType`](./code-generation/codegen-configuration#module-type) property. The generated schema types are scoped within a caseless enum used as a namespace to prevent conflicts with types you may already have defined in your target.

> This option makes you responsible for **manually** adding generated files to your chosen target. When the code generation engine creates or removes files, you'll need to manually add or remove them from Xcode's project navigator.
If you require more control over your schema types you can use the [`ModuleType.other`](./code-generation/codegen-configuration#other) value. This gives you full control over the module and your choice of dependency manager.

> These options makes you responsible for **manually** adding generated files to your chosen target or module. When the code generation engine creates or removes files, you'll need to manually add or remove them from the project navigator.
### Operation model generation

Expand Down

0 comments on commit 1e0f8dd

Please sign in to comment.