Skip to content

Option to generate all / matching enum types regardless of whether they are used in operations #3607

@hongping-quora

Description

@hongping-quora

Question

Apollo Koltin has an option alwaysGenerateTypesMatching:
https://www.apollographql.com/docs/kotlin/kdoc/older/3.8.2/apollo-gradle-plugin-external/com.apollographql.apollo3.gradle.api/-service/always-generate-types-matching.html

We were able to generate code with Apollo Kotlin for the enum types in the schema even if they aren't used by any queries or fragments by using .* with this option.

For Apollo iOS, we tried setting these options explicitly to false, but still didn't see the Swift code generated for the unused enum types from the schema.

  • pruneGeneratedFiles
  • reduceGeneratedSchemaTypes

The documentation in https://www.apollographql.com/docs/ios/code-generation/codegen-configuration
for reduceGeneratedSchemaTypes says

Defaults to false which generates Object types for all objects that implement any Interface referenced in operation documents.

While https://www.apollographql.com/docs/ios/docc/documentation/apollocodegenlib/apollocodegenconfiguration/outputoptions/reducegeneratedschematypes says

Whether to reduce the number of schema types that are generated to only those that are referenced in an operation.

Wondering if reduceGeneratedSchemaTypes should apply to enums that aren't referenced in an operation? If not, is there another option to do so?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that have a question which should be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions