Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: graphql-java/graphql-java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: graphql-java/graphql-java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: validation-refactor
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 11 commits
  • 85 files changed
  • 3 contributors

Commits on Jan 27, 2026

  1. Consolidate 31 validation rule classes into single OperationValidator

    Replace the AbstractRule + RulesVisitor + 31 individual rule class
    architecture with a single OperationValidator class that implements
    DocumentVisitor directly.
    
    BREAKING CHANGE: The rule filtering predicate type changes from
    Predicate<Class<?>> to Predicate<OperationValidationRule> in
    Validator, ParseAndValidate, and GraphQL. Code that filters
    validation rules by class reference must migrate to the new
    OperationValidationRule enum.
    
    - Create OperationValidationRule enum with 31 values (one per rule)
    - Create OperationValidator implementing DocumentVisitor with all
      validation logic consolidated from the 31 rule classes
    - Simplify Validator to create OperationValidator directly
    - Update ParseAndValidate and GraphQL predicate types
    - Delete AbstractRule, RulesVisitor, and all 31 rule classes
      (keep VariablesTypesMatcher as utility)
    - Convert all test files from mock-based rule instantiation to
      integration tests or OperationValidator with rule predicates
    - Update JMH benchmarks
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    andimarek and claude committed Jan 27, 2026
    Configuration menu
    Copy the full SHA
    8884d2d View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2026

  1. Restore 10 test coverage gaps lost during validation refactor

    Add integration tests replacing removed mock-based tests:
    - Per-operation fragment visiting (RulesVisitorTest)
    - Invalid input object field, list, nested list, and simple list types (ArgumentsOfCorrectTypeTest)
    - Null value for non-null input object field (ArgumentsOfCorrectTypeTest)
    - Unknown type on inline fragment not triggering composite type error (FragmentsOnCompositeTypeTest)
    - Directive argument scope isolation (KnownArgumentNamesTest)
    - Defaulted non-null field and directive arguments (ProvidedNonNullArgumentsTest)
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    andimarek and claude committed Jan 28, 2026
    Configuration menu
    Copy the full SHA
    b3e3f3e View commit details
    Browse the repository at this point in the history
  2. Move VariablesTypesMatcher and all validation tests from rules sub-pa…

    …ckage to validation package
    
    The rules sub-package is no longer needed since all 31 rule classes
    were consolidated into OperationValidator. Move the remaining utility
    class (VariablesTypesMatcher) and all 32 test files into the parent
    graphql.validation package, then delete the empty rules directories.
    
    Also remove stale JSpecifyAnnotationsCheck entries for deleted rule
    classes and update comments referencing the old package.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    andimarek and claude committed Jan 28, 2026
    Configuration menu
    Copy the full SHA
    1f6d39d View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2026

  1. Improve OperationValidator documentation and naming

    - Rename methods for clarity:
      - shouldRunNonFragmentSpreadChecks() -> shouldRunDocumentLevelRules()
      - shouldRunFragmentSpreadChecks() -> shouldRunOperationScopedRules()
      - fragmentSpreadVisitDepth -> fragmentRetraversalDepth
    
    - Add comprehensive class Javadoc explaining:
      - Two independent state variables and their three valid combinations
      - Visual matrices showing when each rule category runs
      - Step-by-step traversal example with state at each step
    
    - Add detailed Javadoc to OperationValidationRule enum categorizing
      all rules by their traversal behavior
    
    - Simplify code by removing duplicate checks and redundant comments
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    andimarek and cursoragent committed Jan 29, 2026
    Configuration menu
    Copy the full SHA
    142bad7 View commit details
    Browse the repository at this point in the history
  2. Remove redundant shouldRunDocumentLevelRules() checks

    These checks are always true in methods that are only called at
    document level (depth=0):
    - checkDocument(): Document node visited once at start
    - checkOperationDefinition(): Operations are never inside fragments
    - checkVariableDefinition(): Variable definitions only exist in operations
    - documentFinished(): Called when leaving Document
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    andimarek and cursoragent committed Jan 29, 2026
    Configuration menu
    Copy the full SHA
    72b2828 View commit details
    Browse the repository at this point in the history
  3. Add JSpecify @NullMarked annotations to ValidationContext and Operati…

    …onValidator
    
    ValidationContext:
    - Add @NullMarked at class level
    - Add @nullable to methods that can return null based on traversal state:
      getFragment, getParentType, getInputType, getDefaultValue, getFieldDef,
      getDirective, getArgument, getOutputType, getQueryPath
    
    OperationValidator:
    - Add @NullMarked at class level
    - Add @nullable to methods that can return null:
      getQueryPath, requireSameNameAndArguments, findArgumentByName,
      requireSameOutputTypeShape
    - Add @nullable to parameters that can be null:
      addError (SourceLocation), mkNotSameTypeError (typeA, typeB),
      overlappingFieldsImpl, overlappingFields_collectFields,
      overlappingFields_collectFieldsForInlineFragment,
      overlappingFields_collectFieldsForField, sameType, sameArguments
    - Add @nullable to fields that can be null:
      variableDefinitionMap, FieldAndType.graphQLType
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    andimarek and cursoragent committed Jan 29, 2026
    Configuration menu
    Copy the full SHA
    e0c5f0b View commit details
    Browse the repository at this point in the history
  4. Add JSpecify @NullMarked annotations to TraversalContext

    - Add @NullMarked at class level
    - Add @nullable to fields: directive, argument
    - Add @nullable to public methods that can return null:
      getOutputType, getParentType, getInputType, getDefaultValue,
      getFieldDef, getQueryPath, getDirective, getArgument
    - Add @nullable to private methods that can return null:
      lastElement, find, getFieldDef(schema, parentType, field),
      getNullableType
    - Add @nullable to parameters that accept null:
      addOutputType, addParentType, addInputType, addDefaultValue,
      addFieldDef, getNullableType
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    andimarek and cursoragent committed Jan 29, 2026
    Configuration menu
    Copy the full SHA
    b65e8c3 View commit details
    Browse the repository at this point in the history

Commits on Feb 13, 2026

  1. Merge origin/master into validation-refactor

    Fix NullAway errors from master's @NullMarked additions to
    GraphQLSchema and GraphQLTypeUtil. Add null checks in
    OperationValidator and TraversalContext for nullable
    getCodeRegistry(), unwrapAll(), and type comparison methods.
    
    Update JSpecifyAnnotationsCheck exemption list to match master's
    annotated classes, removing deleted DeferDirective rule entries.
    Add @NullMarked to ParseAndValidate to match master.
    andimarek committed Feb 13, 2026
    Configuration menu
    Copy the full SHA
    23dd3db View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2026

  1. Optimize validation hot paths to reduce collection overhead

    Replace HashMap/LinkedHashMap allocations with linear scans for small
    argument lists, single-pass partitioning in groupByCommonParents, pre-sized
    maps, computeIfAbsent, HashSet for fragment tracking, and ArrayList over
    LinkedList. Short-circuit isRuleEnabled when all rules are enabled.
    
    ~12% improvement on ValidatorBenchmark (largeSchema4: 7.86→6.94ms,
    manyFragments: 5.83→5.16ms).
    
    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
    andimarek and claude committed Feb 15, 2026
    Configuration menu
    Copy the full SHA
    7a4e1fb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c0b4b1c View commit details
    Browse the repository at this point in the history
  3. Remove unnecessary null checks on getCodeRegistry()

    GraphQLSchema.getCodeRegistry() is no longer @nullable, so these
    guards are unnecessary.
    
    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
    andimarek and claude committed Feb 15, 2026
    Configuration menu
    Copy the full SHA
    051f73d View commit details
    Browse the repository at this point in the history
Loading