Skip to content

Expose addUnknownForEnums in Gradle service configuration #6784

@vrendina

Description

@vrendina

Use case

We have a somewhat unique use case where we are bundling a GraphQL client and server inside the same application. We have an Android frontend application that uses Apollo Kotlin with a custom NetworkTransport to communicate with a native library that exposes a GraphQL server through an FFI.

Since the client and server are bundled in the same application, there is never any risk of having an older client communicating with a server using a newer schema. Any incompatible schema changes would prevent the application from compiling.

Because of this configuration, it is unnecessary for us to generate an UNKNOWN__ entry for enums.

Describe the solution you'd like

There is a field on the CodegenOptions called addUnknownForEnums that appears to be hardcoded to "true".

I understand this is a potentially risky setting for most use cases, but wanted to ask if there would be any possibility to expose the setting through the Gradle DSL or if there is another way I'm missing to apply this option?

It looks like it might be possible to achieve the desired behavior through a custom Apollo compiler plugin, but I wanted to ask about the existing boolean first.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions