A validation library for graphql-java that adds constraint directives and custom rules to GraphQL input types and arguments.
graphql-java-extended-validation is a validation library for the graphql-java implementation that adds declarative and programmatic input validation to GraphQL APIs. It solves the problem of ensuring data integrity for GraphQL field arguments and input types by providing constraint directives and custom validation rules, preventing invalid data from reaching business logic.
Java developers building GraphQL APIs with graphql-java who need robust input validation, especially those familiar with Java Bean Validation (JSR 380) or requiring complex validation logic beyond GraphQL's built-in type system.
Developers choose this library because it integrates validation directly into the GraphQL schema using familiar directive syntax, supports internationalization, and offers both out-of-the-box constraints and extensible custom rules without requiring major architectural changes.
Validation library for graphql-java input
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables validation rules like @Size and @Pattern to be defined directly in GraphQL schema language, providing a clear, schema-first approach inspired by Java Bean Validation.
Supports Java Expression Language in @Expression directive, allowing access to validation context variables for advanced rule definitions beyond simple constraints.
Integrates with ResourceBundleMessageInterpolator for localized error messages, enabling custom templates and locale-specific validation feedback as described in the documentation.
Uses ValidationSchemaWiring to automatically enhance data fetchers with validation, minimizing code changes and aligning with graphql-java's extensible design.
Allows implementation of custom ValidationRule interfaces, providing flexibility to add project-specific validation logic alongside standard directives.
Relies on Java Expression Language for complex validations, which may introduce a learning curve and runtime performance costs compared to simpler validation methods.
Direct API usage requires manual validation rule application in data fetchers, as shown in the README, which can be verbose and error-prone compared to declarative approaches.
Current I18N support requires workarounds like implementing LocaleProvider in context objects, indicating incomplete integration with graphql-java's execution environment.