PluginsFlowresolvers

Flow Resolvers

Package nameWeekly DownloadsVersionLicenseUpdated
@graphql-codegen/flow-resolversDownloadsVersionLicenseMar 11th, 2026

Installation

npm i -D @graphql-codegen/flow-resolvers

This plugin generates resolvers signature based on your GraphQLSchema.

It generates types for your entire schema: types, input types, enum, interface, scalar and union.

This plugin requires you to use @graphql-codegen/flow as well, because it depends on it’s types.

💡

Quick Start with flow-resolvers

You can find a blog post we wrote about using and customizing this plugin here, it refers to typescript-resolvers but everything there is relevant to flow-resolvers as well.

Enum Resolvers

Apollo-Server and schemas built with graphql-tools supports creating resolvers for GraphQL enums.

This is helpful because you can have internal values that are different from the public enum values, and you can use the internal values in your resolvers.

Codegen allows you to specify either mappers or enumValues to map enums in your resolvers, and if you are using it for enums, you’ll get a resolver signature for the enum resolvers as well.

Usage Example

With the following schema:

type Query {
  favoriteColor: Color!
}
 
enum Color {
  RED
  BLUE
}
schema: schema.graphql
generates:
  ./resolvers-types.js:
    config:
      enumValues:
        Color: ./enums#ColorsCode
    plugins:
      - flow
      - flow-resolvers
enums.ts
export enum ColorsCode {
  MY_RED = '#FF0000',
  MY_BLUE = '#0000FF'
}
resolvers.ts
import { ColorsCode } from './enums'
import type { Resolvers } from './resolvers-types'
 
const resolvers: Resolvers = {
  Color: {
    RED: ColorsCode.MY_RED,
    BLUE: ColorsCode.MY_BLUE
  },
  Query: {
    favoriteColor: () => ColorsCode.MY_RED // Now you cn return this, and it will be mapped to your actual GraphQL enum
  }
}

You can also define the same with explicit enum values:

schema: schema.graphql
generates:
  ./resolvers-types.js:
    config:
      enumValues:
        Color:
          RED: '#FF0000'
          BLUE: '#0000FF'
    plugins:
      - flow
      - flow-resolvers

Or, with mappers:

schema: schema.graphql
generates:
  ./resolvers-types.js:
    config:
      mappers:
        Color: ./enums#ColorsCode
    plugins:
      - flow
      - flow-resolvers