Skip to content

Make FastBuilder type and directive order match the standard Builder - #4533

Merged
bbakerman merged 1 commit into
graphql-java:masterfrom
xuorig:fix/fastbuilder-deterministic-order
Nov 4, 2026
Merged

bbakerman merged 1 commit into
graphql-java:masterfrom
xuorig:fix/fastbuilder-deterministic-order

Conversation

@xuorig

@xuorig xuorig commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Hello!

I noticed the ordering of the type map was not deterministic when using FastBuilder. Not a huge issue, but it makes some things simpler if ordering is stable, as the regular schema builder is.

While SDL printing is stable, we have several tests and other procedures that could be a little annoying to change in order.

Ordering the final type map should be cheap enough even for the fast builder, but let me know if you have any thoughts.

FastSchemaGenerator collected built types into a HashSet keyed on identity
hash codes, and FastBuilder preserved insertion order, so getTypeMap() and
getAdditionalTypes() order varied between JVM runs. Sort the type map by
name like GraphQLTypeCollectingVisitor does, and place built-in directives
first like Builder.ensureBuiltInDirectives.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 17 6182 (+4 🟢) 6126 (+4 🟢) 0 (±0) 0 (±0) 56 (±0)
Java 21 6182 (+4 🟢) 6126 (+4 🟢) 0 (±0) 0 (±0) 56 (±0)
Java 25 6182 (+4 🟢) 6126 (+4 🟢) 0 (±0) 0 (±0) 56 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 18578 (+12 🟢) 18410 (+12 🟢) 0 (±0) 0 (±0) 168 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 30326 3082 90.8% ±0.0%
Branches 8956 1506 85.6% ±0.0%
Methods 8094 1188 87.2% ±0.0%

Changed Class Coverage (1 class)

Class Line Branch Method
g.s.GraphQLSchema
$FastBuilder
+0.5% 🟢 ±0.0% ±0.0%

Full HTML report: build artifact jacoco-html-report

Updated: 2026-11-03 19:48:02 UTC

@bbakerman
bbakerman merged commit 32158e0 into graphql-java:master Nov 4, 2026
9 checks passed
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.

2 participants