Behaviour changes
Some schemas that built on 14.2.0 fail on this version, mostly ones with type extensions. The details are below.
- Type extensions (#855, fixes #552): union, enum, interface and scalar extensions now add to their type instead of replacing it. Directives on extensions are applied and passed to
SchemaDirectiveWiring, andextend type X implements Ytakes effect. Because of this, every union member from an extension needs a class, enum values from extensions must exist in the Java enum, and implementors must declare the interface's fields. An undeclared directive on an extension fails unlessallowUndeclaredDirectivesis set. When an extension repeats an enum value, interface field or union member, the first one is kept with a WARN, where 14.2.0 kept the last. - Custom scalars in untyped arguments (#856, fixes #436 and #424): a resolver parameter declared as
Object, or aMap,Collection, array orOptionalof it (e.g.Map<String, Any?>), now gets custom scalar values as graphql-java coerced them, not their serialized form. So aUUIDis aUUIDinstead of aString, and a bean-like scalar is no longer a nestedMap. Resolvers that cast these values toStringorMapwill throwClassCastException. Declare the parameter asObjectNodeto keep the serialized form. Typed inputs with custom scalar values that Jackson couldn't convert now work too. - Unmapped input fields (#857, fixes #422): at build time, each input field that the resolver's
ObjectMappercan't map to the argument's class logs a WARN fromgraphql.kickstart.tools.UnmappedInputFieldChecker. These fields are dropped or fail at query time. Put deliberately unmapped fields in@JsonIgnoreProperties, or setunmappedInputFields(UnmappedInputFields.IGNORE)to skip the check (FAILfails the build instead). Jackson deserializers for argument types are now built with the schema instead of on the first query, so startup is a bit slower. - Input objects in directive wirings (#843, fixes #321, #385 and #731): input objects behind a list or non-null wrapper are now
GraphQLInputObjectTypeat wiring time instead of a type reference, and they're wired inside their parent instead of in SDL order. InonInputObjectField,inputField.getDirective(...),inputField.directivesandenv.directivenow return only the field's own directives, not the input object's. - Input types without a Java property (#842, fixes #479, #355 and #224): input types only reachable through an input field without a Java property are now registered, so the misleading "Expected type ... to be a GraphQLInputType" error is gone. A misspelled property like that now builds and gets the unmapped input field WARN above.
- Dictionary (#851, fixes #465): several input types can share a dictionary class. Other types sharing a class now fail at
build()with aSchemaClassScannerErrorinstead of anIllegalArgumentExceptionfromdictionary()oradd(). Entries the scan never reads, like an input type that a resolver parameter already binds, now log "Dictionary mapping was provided but never used", andgetDictionary()returns a copy instead of a live view. - Enums used only by directives (#852, fixes #823): these now build without a dictionary class. In a
SchemaDirectiveWiringtheir values areStrings, so add the enum to the dictionary to get the constants. - Syntax errors (#838, fixes #392): with several
schemaStringcalls, line numbers in syntax errors andSourceLocations count from the start of their own string. Errors from named sources (file()or the newschemaString(String, String)) are thrown asSchemaSyntaxException, which is still anInvalidSyntaxException. - JDK dynamic proxies (#853, fixes #822): a resolver behind a JDK dynamic proxy (e.g. Spring AOP without
proxyTargetClass) still fails on every query of the field, but now logs a WARN at build. Use class-based proxies (proxyTargetClass = true). This becomes an error in 15.0.0 (#868). - Error messages (#871): types in "Unable to match type definition" errors print as SDL (
[Book!]!) instead of graphql-java's AST.
New
- Union members and interface implementors are found among the subclasses of a Kotlin or Java sealed class or interface (#854, part of #200).
schemaString(String, String)names a schema source, so syntax errors say where they are (#838).unmappedInputFields(...)option, see above (#857).
Compatibility
SchemaParserOptionsgains a property, so code compiled against 14.2.0 that callsSchemaParserOptions.copy()has to be recompiled.
What's Changed
- Version Release by @github-actions[bot] in #847
- Fix line numbers in schema syntax errors and name the source by @oryan-block in #838
- Build enums used only by directives without a Java class by @oryan-block in #852
- Fail the build on compiler warnings and check the release bundle in CI by @oryan-block in #849
- Keep Kotlin on 2.3.10 by @oryan-block in #850
- Resolve nested input objects and input field directives before directive wiring by @oryan-block in #843
- Register input field types that have no Java property by @oryan-block in #842
- Let input types share a dictionary class by @oryan-block in #851
- Find union members and interface implementors among sealed subclasses by @oryan-block in #854
- Pass coerced custom scalar values through to input objects and Map arguments by @oryan-block in #856
- Merge type extensions into the types they extend by @oryan-block in #855
- Warn at build when a resolver can't be called on its JDK dynamic proxy by @oryan-block in #853
- Check input object classes against the schema with Jackson by @oryan-block in #857
- Cut comments from #857 that repeat the code or explain its history by @oryan-block in #869
- Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-bom to v1.11.0 by @renovate[bot] in #860
- Use graphql-java's TypeUtil to unwrap and print SDL types by @oryan-block in #871
- Update all non-major dependencies by @renovate[bot] in #848
- Take the release version as a workflow input and run the checks on the bump PR by @oryan-block in #872
Full Changelog: v14.2.0...v14.3.0