Skip to content

Backport 26.1: Allow empty unions to be completed by extensions - #4447

Open
andimarek wants to merge 1 commit into
26.xfrom
codex/backport-4388-to-26.x
Open

Backport 26.1: Allow empty unions to be completed by extensions#4447
andimarek wants to merge 1 commit into
26.xfrom
codex/backport-4388-to-26.x

Conversation

@andimarek

Copy link
Copy Markdown
Member

Backport of #4388 to the 26.x maintenance branch.

Summary

  • Allow SDL union definitions with no base members when union extensions provide members
  • Keep truly empty unions invalid, including directive-only extensions
  • Validate union extension members against the previous effective union so duplicates across the base definition or earlier extensions are rejected
  • Add regression coverage for Empty union base definitions rejected before extensions are merged (spec violation) #4200 and additional draft-spec union extension cases

Fixes #4200

Testing

  • ./gradlew test --tests graphql.schema.idl.SchemaGeneratorTest --tests graphql.schema.idl.SchemaTypeCheckerTest

@andimarek andimarek changed the title Allow empty unions to be completed by extensions Backport 26.1: Allow empty unions to be completed by extensions Aug 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5738 (-189 🔴) 5682 (-189 🔴) 0 (±0) 0 (±0) 56 (±0)
Java 17 5738 (-189 🔴) 5681 (-189 🔴) 0 (±0) 0 (±0) 57 (±0)
Java 21 5738 (-189 🔴) 5681 (-189 🔴) 0 (±0) 0 (±0) 57 (±0)
Java 25 5738 (-189 🔴) 5681 (-189 🔴) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 22984 (-756 🔴) 22757 (-756 🔴) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 28931 3119 90.3% -0.3% 🔴
Branches 8427 1503 84.9% -0.4% 🔴
Methods 7743 1222 86.4% -0.6% 🔴

Changed Class Coverage (34 classes)

Class Line Branch Method
g.l.AstSignature
$3
+100.0% 🟢 +100.0% 🟢 +100.0% 🟢
g.l.AstSignatureInputReferences removed removed removed
g.l.AstSignatureReferenceCollector removed removed removed
g.l.AstSignatureWithInputResult removed removed removed
g.l.AstSignatureWithInputResult
$Builder
removed removed removed
g.l.Directive -3.2% 🔴 ±0.0% -5.9% 🔴
g.l.DirectiveDefinition -19.2% 🔴 ±0.0% ±0.0%
g.l.DirectiveExtensionDefinition removed removed removed
g.l.DirectiveExtensionDefinition
$Builder
removed removed removed
g.l.DirectiveLocation -4.3% 🔴 ±0.0% -8.3% 🔴
g.l.FragmentSpread -16.1% 🔴 ±0.0% -27.8% 🔴
g.l.FragmentSpread
$Builder
-6.5% 🔴 ±0.0% -9.1% 🔴
g.l.PrettyAstPrinter ±0.0% -2.0% 🔴 ±0.0%
g.l.VariableDefinition -14.5% 🔴 ±0.0% -26.1% 🔴
g.l.VariableDefinition
$Builder
-6.2% 🔴 ±0.0% -8.8% 🔴
g.s.d.a.EditOperationAnalyzer -0.3% 🔴 ±0.0% -0.7% 🔴
g.s.d.a.SchemaDifference
$AppliedDirectiveDirectiveLocation
removed removed removed
g.s.GraphQLDirective -3.1% 🔴 ±0.0% -6.7% 🔴
g.s.GraphqlDirectivesContainerTypeBuilder -14.7% 🔴 -50.0% 🔴 -18.2% 🔴
g.s.GraphQLInterfaceType
$Builder
-1.4% 🔴 ±0.0% -3.8% 🔴
g.s.GraphQLObjectType -1.7% 🔴 ±0.0% -3.6% 🔴
g.s.i.e.DirectiveExtensionDirectiveRedefinitionError removed removed removed
g.s.i.e.DirectiveExtensionMissingBaseError removed removed removed
g.s.i.e.SchemaProblem -16.7% 🔴 ±0.0% -25.0% 🔴
g.s.i.TypeDefinitionRegistry ±0.0% -0.3% 🔴 ±0.0%
g.s.t.FieldVisibilitySchemaTransformation
$ElementRemovalVisitor
removed removed removed
g.s.t.FieldVisibilitySchemaTransformation
$FieldRemovalVisitor
+100.0% 🟢 +100.0% 🟢 +100.0% 🟢
g.s.t.VisibleInterfaceImplementationPredicateEnvironmentImpl removed removed removed
g.s.v.NoDefaultValueCircularRefs removed removed removed
g.s.v.NoUnbrokenInputCycles -2.6% 🔴 -4.4% 🔴 ±0.0%
g.v.OperationValidator ±0.0% -1.3% 🔴 ±0.0%
g.v.TraversalContext +99.4% 🟢 +94.1% 🟢 +100.0% 🟢
g.v.ValidationContext -2.8% 🔴 ±0.0% -5.0% 🔴
g.v.ValidationError
$Builder
±0.0% -50.0% 🔴 ±0.0%
Directive — method details
Method Line Branch
deepCopy 0.0% (-100.0% 🔴)
DirectiveDefinition — method details
Method Line Branch
<init> new 100.0%
withNewChildren 0.0% (-100.0% 🔴)
deepCopy 0.0% (-100.0% 🔴)
lambda$withNewChildren$0 0.0% (-100.0% 🔴)
<init> removed removed
getDirectives removed removed
getDirectivesByName removed removed
getDirectives removed removed
hasDirective removed removed
DirectiveLocation — method details
Method Line Branch
deepCopy 0.0% (-100.0% 🔴)
FragmentSpread — method details
Method Line Branch
getDirectivesByName 0.0% (-100.0% 🔴)
getDirectives 0.0% (-100.0% 🔴)
hasDirective 0.0% (-100.0% 🔴)
withNewChildren 0.0% (-100.0% 🔴)
lambda$withNewChildren$0 0.0% (-100.0% 🔴)
FragmentSpread.Builder — method details
Method Line Branch
directive 0.0% (-100.0% 🔴)
PrettyAstPrinter — method details
Method Line Branch
lambda$directiveDefinition$0 100.0% 50.0% (-50.0% 🔴)
directiveExtensionDefinition removed removed
lambda$directiveExtensionDefinition$0 removed removed
VariableDefinition — method details
Method Line Branch
<init> new 100.0%
getDirectivesByName 0.0% (-100.0% 🔴)
getDirectives 0.0% (-100.0% 🔴)
hasDirective 0.0% (-100.0% 🔴)
withNewChildren 0.0% (-100.0% 🔴)
newVariableDefinition 0.0% (-100.0% 🔴)
lambda$withNewChildren$0 0.0% (-100.0% 🔴)
<init> removed removed
VariableDefinition.Builder — method details
Method Line Branch
directive 0.0% (-100.0% 🔴)
description removed removed
EditOperationAnalyzer — method details
Method Line Branch
appliedDirectiveDeleted 85.5% 72.5% (-0.2% 🔴)
appliedDirectiveArgumentDeleted 82.6% (-0.3% 🔴) 73.5% (-0.6% 🔴)
appliedDirectiveArgumentAdded 79.6% (-0.4% 🔴) 69.4% (-0.8% 🔴)
appliedDirectiveArgumentChanged 99.1% 68.6% (-0.3% 🔴)
appliedDirectiveAdded 85.5% 72.5% (-0.2% 🔴)
isAppliedDirectiveAdded 80.4% (-8.9% 🔴) 78.6% (-4.8% 🔴)
lambda$isAppliedDirectiveAdded$6 0.0% (-100.0% 🔴)
GraphQLDirective — method details
Method Line Branch
<init> new 100.0%
copy 0.0% (-100.0% 🔴)
<init> removed removed
getExtensionDefinitions removed removed
isDeprecated removed removed
getDeprecationReason removed removed
getDirectives removed removed
getDirectivesByName removed removed
getAllDirectivesByName removed removed
getDirective removed removed
getAppliedDirectives removed removed
getAllAppliedDirectivesByName removed removed
getAppliedDirective removed removed
GraphqlDirectivesContainerTypeBuilder — method details
Method Line Branch
withDirectives 0.0% (-100.0% 🔴) 0.0% (-100.0% 🔴)
withDirective 0.0% (-100.0% 🔴)
GraphQLInterfaceType.Builder — method details
Method Line Branch
replaceInterfaces 0.0% (-100.0% 🔴)
GraphQLObjectType — method details
Method Line Branch
getDirective 0.0% (-100.0% 🔴)
SchemaProblem — method details
Method Line Branch
toString 0.0% (-100.0% 🔴)
TypeDefinitionRegistry — method details
Method Line Branch
<init> new 100.0%
add 95.6% (-0.3% 🔴) 92.9% (-0.5% 🔴)
remove 92.3% (-0.5% 🔴) 90.9% (-0.8% 🔴)
remove 74.1% (-1.8% 🔴) 68.2% (-2.7% 🔴)
isPossibleType 92.6% (+14.8% 🟢) 83.3% (+16.7% 🟢)
<init> removed removed
removeDirectiveExtension removed removed
defineDirectiveExt removed removed
directiveExtensions removed removed
implementsInterface removed removed
getImplementingTypeExtensions removed removed
isUnionMember removed removed
lambda$isUnionMember$0 removed removed
lambda$implementsInterface$0 removed removed
lambda$defineDirectiveExt$0 removed removed
lambda$merge$15 removed removed
lambda$merge$16 removed removed
NoUnbrokenInputCycles — method details
Method Line Branch
unwrapNonNull 83.3% (-16.7% 🔴) 75.0% (-25.0% 🔴)
OperationValidator — method details
Method Line Branch
checkVariable new 100.0% 100.0%
validateDeferDirectiveOnRootLevel 92.9% 68.8% (-12.5% 🔴)
validateDeferDirectiveOnValidOperation new 90.9% 80.0%
getOperationDefinition new 100.0%
lambda$getOperationDefinition$1 new 100.0%
lambda$getOperationDefinition$0 new 100.0%
enterTraversal removed removed
enterField removed removed
enterVariableDefinition removed removed
enterArgument removed removed
enterArrayValue removed removed
enterObjectField removed removed
leaveTraversal removed removed
resolveSelectionSetParent removed removed
getSelectionSetOwnerType removed removed
getOperationType removed removed
getFieldDefinition removed removed
getArgumentDefinition removed removed
getNullableType removed removed
getParentType removed removed
getFieldDefinition removed removed
getInputType removed removed
getDefaultValue removed removed
getDirectiveDefinition removed removed
enterName removed removed
leaveName removed removed
lastElement removed removed
pop removed removed
checkVariable removed removed
validateVariableNotAllowedInConstantDirective removed removed
getInlineFragmentType removed removed
validateDeferDirectiveOnValidOperation removed removed
ValidationContext — method details
Method Line Branch
getTraversalContext new 100.0%
getParentType new 100.0%
getInputType new 100.0%
getDefaultValue new 100.0%
getFieldDef new 100.0%
getDirective new 100.0%
getArgument new 100.0%
getOutputType new 100.0%
getQueryPath new 100.0%
toString new 0.0%
ValidationError.Builder — method details
Method Line Branch
sourceLocation 100.0% 50.0% (-50.0% 🔴)

Full HTML report: build artifact jacoco-html-report

Updated: 2026-08-20 00:30:11 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant