$ show kobylynskyi/graphql-java-codegen
This repository is a GraphQL code generation library and build plugin suite. It parses GraphQL schemas (SDL or introspection JSON) and generates Java, Kotlin, and Scala source files for types, enums, interfaces, unions, resolvers, client request/response classes, and response projections. The architecture is a core codegen engine with language-specific adapters (JavaGraphQLCodegen, KotlinGraphQLCodegen, ScalaGraphQLCodegen) that use FreeMarker templates for output. It integrates with Gradle, Maven, and SBT via dedicated plugins. External dependencies include graphql-java for schema parsing, FreeMarker for templating, and Jackson for serialization in generated code. The system supports extensive configuration (naming conventions, annotations, custom type mappings, Relay support) and is designed for schema-first development on both server and client sides.
The LLM identified 4 files worth highlighting for reuse:
Utility class that serializes GraphQL request objects (queries, mutations) into JSON strings suitable for HTTP transport. Handles proper escaping, collection formatting, and null values. This is a self-contained, reusable component for any GraphQL client implementation that needs to convert request objects to JSON.
Utility to discover GraphQL schema files (`.graphqls`, `.graphql`) in a directory tree with include/exclude patterns. Supports recursive scanning and filtering. This is a reusable component for any tool that needs to locate schema files, independent of the code generation logic.
Singleton registry that loads and caches FreeMarker templates per language (Java, Kotlin, Scala) and template type. Supports custom template overrides. Demonstrates a clean pattern for template management with lazy loading and caching, reusable in any code generation tool using FreeMarker.
Interface for supplying MappingConfig objects, with a mergeable implementation that allows layering of configuration from multiple sources (JSON, HOCON, programmatic). This pattern is reusable for any application that needs composable configuration with priority rules.