Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codegen] add additionalImportedModulesNames to apollo codegen config #156

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,8 @@ public struct ApolloCodegenConfiguration: Codable, Equatable {

/// Name used to scope the generated schema type files.
public let schemaNamespace: String
/// Names used to add additional scopes to the generated schema type files.
public let additionalImportedModulesNames: [String]
/// The input files required for code generation.
public let input: FileInput
/// The paths and files output by code generation.
Expand Down Expand Up @@ -984,6 +986,7 @@ public struct ApolloCodegenConfiguration: Codable, Equatable {
/// - experimentalFeatures: Allows users to enable experimental features.
public init(
schemaNamespace: String,
additionalImportedModulesNames: [String] = [],
input: FileInput,
output: FileOutput,
options: OutputOptions = Default.options,
Expand All @@ -992,6 +995,7 @@ public struct ApolloCodegenConfiguration: Codable, Equatable {
operationManifest: OperationManifestConfiguration? = Default.operationManifest
) {
self.schemaNamespace = schemaNamespace
self.additionalImportedModulesNames = additionalImportedModulesNames
self.input = input
self.output = output
self.options = options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ struct ImportStatementTemplate {
return """
@_exported import \(apolloAPITargetName)
\(if: config.output.operations != .inSchemaModule, "import \(config.schemaModuleName)")
\(forEachIn: config.additionalImportedModulesNames, {
return "import \($0)"
})
"""
}
}
Expand Down