Skip to main content
Version: 7.x.x

Types and Fields

graphql-kotlin-schema-generator uses reflection to automatically map Kotlin classes and enums to the corresponding GraphQL types.

By default, all public properties and functions with a valid GraphQL name and a supported return type will be mapped to a corresponding GraphQL field. Kotlin return types have to be either one of the supported scalars or a custom Kotlin type defined within supported packages. Nullability information is automatically inferred from the underlying Kotlin return type.

Additional built-in validations

  • function types aka lambdas property types are currently not supported by the schema generator
  • automatically generated data class methods (componentN, copy, equals, hashCode, toString) are filtered out

Default behavior can be customized. Fields can be renamed or excluded. Support for additional types or validations can be added by providing an instance of custom SchemaGeneratorHook.

Type Inheritance

graphql-kotlin-schema-generator provides support for both GraphQL unions and interfaces. Superclasses and interfaces can be excluded from the schema by marking them with @GraphQLIgnore annotation or by providing custom filtering logic in a custom SchemaGeneratorHook.