diff --git a/.claude/skills/verify-return-value-unwrapping/SKILL.md b/.claude/skills/verify-return-value-unwrapping/SKILL.md new file mode 100644 index 00000000..73bbd90e --- /dev/null +++ b/.claude/skills/verify-return-value-unwrapping/SKILL.md @@ -0,0 +1,192 @@ +--- +name: verify-return-value-unwrapping +description: Exhaustively check, up to a bound, that the value of a resolver method, a field with no matching getter or a typed Map reaches graphql-java fully unwrapped. Futures are awaited, generic wrappers are transformed, Optional and DataFetcherResult are handled, and list order, nulls and failures are kept, for every return type nested up to 3 containers deep. Use it before pushing any change to TypeShape (the type walk, ContainerKind, the generic wrapper rules or the Unwrapper), the data fetchers in ResolverPlan, or the GenericWrapper defaults, and whenever a bug report says graphql-java got a CompletableFuture, Optional or wrapper object as a field value. +--- + +# Verify return value unwrapping + +## The property + +A user writes a resolver method, a field with no matching getter (of any visibility) or a `Map` whose type nests containers, such as +`CompletableFuture>>`. If the schema build accepts it, then graphql-java must get +exactly the value it returned, with every container removed. Futures are waited on and generic wrappers go +through their transformers. List order and nulls are kept. A failed future or a throwing transformer fails the field. +A `Future` that isn't a `CompletionStage` fails the field with the "can't wait on" error. + +When this breaks, a production query returns `CompletableFuture@1a2b[Completed normally]` as a string, or fails with +"Expected source object to be an instance of 'Payload' but instead got 'CompletableFuture'". It only happens for the +return types and values nobody wrote a test for. + +## How the check works + +`src/test/resources/returnvalue/Check.java` lists every return type built from up to `--depth` (default 3) of these containers around a leaf: + +| Container | Value variants (the first one is the default) | +|---|---| +| `List` | 2 elements, `null`, empty | +| `Page` (a `listCollectionWithTransformer` wrapper) | 2 elements, `null`, empty | +| `CompletableFuture` | completes with the value, `null`, fails | +| `Future` | a `CompletableFuture`, `null`, a completed `FutureTask` | +| `Later` (a `withCompletionStageTransformer` wrapper whose transformer returns its `CompletableFuture`, like `Mono::toFuture`) | holds a future of the value, `null`, holds a failing future | +| `Try` (a wrapper whose transformer returns the value or throws) | success, `null`, failure | +| `DataFetcherResult` | the value, `null`, the value plus an error | +| `Optional` | present, empty | + +The leaf is `Payload` (an object type), `String`, or `Object` for a union `Item = Payload | FutureItem`. `FutureItem` +implements `Future`, so only the declared type tells a leaf from a future. Each return type runs with an all-nullable +and an all-non-null GraphQL type. + +Each return type runs as three kinds of resolver, each compiled as a Java class at runtime: + +| Kind | Generated resolver | Member and data fetcher in `ResolverPlan.kt` | +|---|---|---| +| `method` | `public field()` on the query resolver | `MethodMember`, `LightMethodFieldResolverDataFetcher` | +| `property` | `public field;` on the query resolver, which is also what a Kotlin `@JvmField` compiles to | `PropertyMember`, `PropertyFieldResolverDataFetcher` | +| `map` | `extends HashMap>`, bound to `type Holder` and returned by `Query.holder` | `MapMember`, `MapFieldResolverDataFetcher` | + +Each kind's `resolverKind` is the noun of a `ResolverKind`, and a `ResolverKind` without a kind here ends in `MODEL ERROR`. + +The check builds each schema through the public `SchemaParser` API, which rejects about a fifth of the combinations, such as +`Optional` below the top level. For every accepted one it executes the query once for each value that makes at most +`--budget` (default 2) non-default choices. Properties and Maps use `--property-budget` (default 1), only the nullable +GraphQL type and only the first-created-first completion order, because what they add is how the value is read, and the +methods already cover the rest. When the return type holds futures, it runs each value three ways: futures already completed, +and pending futures completed after the data fetcher returns, first-created first and last-created first. + +The expected result is what graphql-java returns when a plain data fetcher on the same schema returns the plain value, +or throws the failure. So graphql-java's own null handling and error format apply to both sides. When one value +holds several failures, any one of them failing the field counts as correct. + +`ReturnValueUnwrappingTest` compiles `Check.java` and `Fixtures.java` at test time and runs the check, so `mvn verify` +runs it at the default bounds on every build. About 226,000 executions run in about 18 seconds on JDK 17. + +## Run + +From the root of the checkout or worktree you want to check: + +```bash +.claude/skills/verify-return-value-unwrapping/check.sh +``` + +It prints the commit and the JDK, runs `mvn clean test -Dtest=ReturnValueUnwrappingTest` with the options below passed +as `-Dunwrapping.args`, and prints the report. On a failure it also prints the path of the Maven log. + +| Exit | Meaning | +|---|---| +| 0 | `PASS`, or `PASS apart from the known findings above` | +| 1 | `FAIL`: a return type that isn't a known finding breaks the property. `NEW`: a known finding matches more accepted return types than its line records | +| 2 | `MODEL ERROR`: the checkout or the check didn't compile, the build rejected a return type the check must exercise, a `ContainerKind` in `TypeShape.kt` has no `Container` in `Check.java`, or a `ResolverKind` in `ResolverPlan.kt` has no `Kind`, so a pass would prove nothing | +| 3 | `STALE`: a known finding matches a return type that no longer fails, or fewer accepted return types than its line records. Or the run's coverage differs from `pinnedCoverage` in `Check.java` | + +Options: `--depth N`, `--budget N`, `--property-budget N`, `--show N` (counterexamples and stale return types printed, default 15), and `--rejected`, which lists +every combination the schema build rejected, with the build's error. A depth below 3 can't build the `mustAccept` +return types, so it ends in `MODEL ERROR`. `NEW` and `STALE` apply only at the default depth and budgets, because the +counts in `known-findings.txt` and `pinnedCoverage` are for those. A run with other bounds checks values only. + +## Pinned coverage + +`pinnedCoverage` in `Check.java` records how many return types the check generates, and for each kind how many of them +the schema build rejects and how many executions run. A run at the default bounds whose counts differ is `STALE`, and the +report prints the pinned and the new counts. Without the pin, a change that makes the build reject more return types, +skips generating some shapes, or runs fewer values per return type would still print `PASS`, because nothing it stopped +running can fail. + +When the counts move, diff `--rejected` output against the last commit to see which return types the build now rejects +or accepts, and confirm the change is intended. A change to `Check.java` itself moves the counts with no change in +`--rejected`. Then copy the counts the report prints into `pinnedCoverage` in the same diff, so a reviewer sees what the +check stopped or started covering. A change that rejects one return type and accepts another of the same kind, with the +same number of executions, keeps the counts and gets past the pin. + +## Reading a counterexample + +``` +public List> field() for field: [Payload] (21 failing executions, first shown) + returns: List[CompletableFuture(Payload(v1)), FutureTask] + futures complete before the data fetcher returns + expected: {errors=[{message=Exception while fetching data (/field) : Resolver method '...' resolved to a java.util.concurrent.FutureTask, which graphql-java can't wait on. ... + got: {errors=[{message=Exception while fetching data (/field[1]/data) : Expected source object to be an instance of 'unwrapcheck.Fixtures$Payload' but instead got 'java.util.concurrent.FutureTask', ... +``` + +The first line is the resolver and the field's GraphQL type. A property prints as `public List> field;` +and a Map as `extends HashMap>> for Holder.field: [Payload]`. `returns` is the value the method returned. +`Later(CompletableFuture(x))` means a `Later` whose transformer returns a `CompletableFuture` of `x`. Only the first +failing value per return type is shown. Rerun with a higher `--show` to see more return types. + +A real bug versus a modeling error: + +- **Real bug.** `got` holds a container object (a future, `Optional`, `DataFetcherResult`, `Try`) as a value, an + "Expected source object" error, a lost or reordered element, a missing error, or a blocked data fetcher. Report it with + the counterexample. Don't change the check to make it pass. +- **Real bug in the schema build.** `expected` is itself nonsense, such as `Payload` bound to the `DataFetcherResult` + class, which returned `"unwrapcheck.Fixtures$Payload@5a77273c"` as `data`. The plain data fetcher runs on the same schema, so if the build bound the GraphQL + type to the wrong class, both sides go wrong. +- **Modeling error.** The check's own idea of the value is wrong. For example, a new container variant builds a value + that its declared type doesn't allow, or the error message the check expects for a `FutureTask` (in `build`, case + `FUTURE_TASK`) differs from a message the library changed on purpose. Confirm against the library's own tests in + `src/test/kotlin/graphql/kickstart/tools/NestedGenericWrapperTest.kt` before you edit the check. A property fails a + `FutureTask` as a `Resolver field` and a Map as a `Resolver map value`, each naming the generated class and `field`. +- **`MODEL ERROR` about rejected return types.** A change made the build reject a return type in `mustAccept` in + `Check.java`. That's either a regression in the build, which you report, or an intended change, after which you swap in + another accepted return type of the same kind. + +## Known findings + +`src/test/resources/returnvalue/known-findings.txt` lists the return types that break the property at the sync commit, one per line as +` # `. The regex is matched against the kind and the short return type, such as +`property List>`, so a pattern without a kind covers all three. The first matching line wins. +Matching return types still print as `KNOWN` with a counterexample on every run, and the check passes apart from them. + +Each line must match only return types that fail, and exactly `` of the return types the build accepts. A +matched return type that passes makes the check `STALE` and names it, so a partial fix has to narrow the line, and a later +regression in a fixed return type is a `FAIL`. A count that grows makes it `NEW`, because a return type the build used to +reject now fails under the line. What stays hidden is a known return type that starts failing in a different way, so +after a change to the code a known finding covers, read its counterexample. + +At the sync commit the file is empty. Methods, properties and typed Maps unwrap their values through the same +`TypeShape.Unwrapper`, and every return type the build accepts passes. + +The check found two method bugs when it was written, and both are fixed. One was a `DataFetcherResult` inside an +`Optional` (#939). The other was a wrapper whose transformer returns a future, directly around a declared future (#938). A +`withTransformer` registration keeps that #938 behavior, which is why `Later` is registered through +`withCompletionStageTransformer`. + +When a fix lands, the check exits 3 and names the return types that pass. Narrow the line to the rest and set its count, +or delete it when none fail, so that a regression shows up as `FAIL`. + +## What this does not cover + +- Suspend functions, subscriptions and `Publisher`, arrays, and Kotlin-declared resolver methods. The generated resolvers + are Java methods without parameters, so only `LightMethodFieldResolverDataFetcher` in `ResolverPlan.kt` runs, not + `MethodFieldResolverDataFetcher`. +- Wrappers picked by a subclass of the value (`Box` and `SpecialBox` in `NestedGenericWrapperTest`), wrappers with a type + argument index other than 0, custom `schemaWrapper`s other than the list one, transformers that return a `FutureTask`, + and DataLoader futures. +- Lists of more than 2 elements, more than 2 non-default choices per value, more than 3 containers, and completion + orders other than the two listed. A pass says nothing beyond those bounds. +- Which return types the schema build should reject. The check only exercises what the build accepts. A change in how + many it rejects fails through `pinnedCoverage`, but the check doesn't judge whether the new count is right. +- Untyped Maps, whose value type is `Object`, properties with a getter (those run as methods), non-public fields (the + generated ones are public, and the same data fetcher reads private ones), and properties and Maps on a type below the + root other than `Holder`. `ResolverCompatibilityTest` pins untyped Maps and Kotlin `@JvmField`s. + +## Coverage and sync + +Last confirmed to describe the code at commit `1b351934` (2026-11-05). It covers: + +| File | What | +|---|---| +| `src/main/kotlin/graphql/kickstart/tools/resolver/TypeShape.kt` | the walk, `ContainerKind`, `GenericWrappers`, `resolveTypeVariables`, the `Unwrapper` and its steps | +| `src/main/kotlin/graphql/kickstart/tools/resolver/ResolverPlan.kt` | `dataFetcher` (the `TypeShape.Unwrapper` per member), `returnShape`, `ResolverKind`, the members' `declaredValueType`, and the `ResolverDataFetcher` subclasses | +| `src/main/kotlin/graphql/kickstart/tools/SchemaParserOptions.kt` | `GenericWrapper` and the default wrappers in `build()` | + +To see whether a change needs another look: + +```bash +git log --oneline 1b351934..HEAD -- src/main/kotlin/graphql/kickstart/tools/resolver/TypeShape.kt src/main/kotlin/graphql/kickstart/tools/resolver/ResolverPlan.kt src/main/kotlin/graphql/kickstart/tools/SchemaParserOptions.kt +``` + +Move the sync commit forward only after you've read those changes and confirmed that the containers, variants and +expected values in `Check.java` still describe them. For example, a new default wrapper or a new kind of unwrapping +step needs a new `Container` with its variants and its plain value in `build`. A new `ContainerKind` ends in +`MODEL ERROR` until it has one, and so does a new `ResolverKind` until `Check.java` has a `Kind` with its noun. After an intended change, rerun the check, +and break the new code on purpose once in a scratch worktree to see the check fail before you trust its pass. diff --git a/.claude/skills/verify-return-value-unwrapping/check.sh b/.claude/skills/verify-return-value-unwrapping/check.sh new file mode 100755 index 00000000..144ad2a3 --- /dev/null +++ b/.claude/skills/verify-return-value-unwrapping/check.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +checkout=$(git rev-parse --show-toplevel) +log=$(mktemp "${TMPDIR:-/tmp}/verify-return-value-unwrapping.XXXXXX") + +echo "checkout $checkout at $(git -C "$checkout" rev-parse --short HEAD)$(git -C "$checkout" diff --quiet HEAD -- src || echo ' plus uncommitted src changes')" +java -version 2>&1 | head -1 + +if (cd "$checkout" && mvn -B -ntp clean test -Dtest=ReturnValueUnwrappingTest "-Dunwrapping.args=$*") > "$log" 2>&1; then + sed -n '/Running .*ReturnValueUnwrappingTest/,/Tests run:/p' "$log" | sed -e '1d' -e '$d' + rm "$log" + exit 0 +fi + +sed -n '/AssertionError: /,/^\tat /p' "$log" | sed -e '1s/.*AssertionError: //' -e '$d' +echo "Maven log: $log" +grep -q -E '^(FAIL|NEW):' "$log" && exit 1 +grep -q 'MODEL ERROR:' "$log" && exit 2 +grep -q '^STALE:' "$log" && exit 3 +tail -40 "$log" +echo "MODEL ERROR: the checkout didn't build" +exit 2 diff --git a/.claude/skills/verify-tools/SKILL.md b/.claude/skills/verify-tools/SKILL.md new file mode 100644 index 00000000..45a44bad --- /dev/null +++ b/.claude/skills/verify-tools/SKILL.md @@ -0,0 +1,89 @@ +--- +name: verify-tools +description: Prove a graphql-java-tools behavior the way a consuming app sees it. Installs this checkout into a private Maven repo, builds a schema from SDL files and resolver classes in a separate probe project through the public API, runs GraphQL operations, and saves the printed schema, JSON results and library warnings as evidence. Use to confirm a fix or feature works from the outside (not just in the library's own unit tests), or to reproduce an issue report. Run it before pushing any schema-building change to an open PR, including refactors and new or changed library warnings, whose only proof is the probe's log. +--- + +# Verify graphql-java-tools from a consumer + +`probe/` is a separate Maven project that depends on the jar installed from a checkout, so it sees only the public API, +unlike `src/test`. `mvn verify` still runs for every change. This skill proves one behavior end to end in minutes, and is +where bugfixes and small features stop. + +## Run + +`probe.sh` sits next to this file and verifies the checkout of the current directory. Every clone and worktree has its +own copy, so run it from the checkout root. To verify a commit that predates this skill, check it out in its own worktree +and run another checkout's `probe.sh` from inside it. + +```bash +.claude/skills/verify-tools/probe.sh doctor # checkout, branch, install state, lock +.claude/skills/verify-tools/probe.sh list # scenario names +.claude/skills/verify-tools/probe.sh install # clean-build the checkout into the private repo +.claude/skills/verify-tools/probe.sh run [--graphql-java ] # build the schema, run every operation +.claude/skills/verify-tools/probe.sh clean # remove this checkout's work dir, keep evidence +``` + +- `run` first installs the checkout into a private Maven repo under `$TMPDIR/verify-tools/work/-/` when + the install is missing or stale, meaning HEAD or uncommitted `pom.xml`/`src/` changes differ from the last install. It + reads `~/.m2` but never writes it. The install runs `mvn clean install`, so it empties the checkout's `target/`. Don't + run it while another build uses the same checkout. The work dir is keyed on the checkout's path, so clones and worktrees + run in parallel, even when two share a folder name. If `doctor` shows the lock held by a live pid, wait for that run. +- It builds the schema from the scenario's files, resolvers and `configure`, prints it, then executes every `*.graphql` in + `src/test/resources/compat/scenarios//` in name order, with `.variables.json` as variables. It collects + subscription events until the stream completes, for at most 10 seconds. +- Exit `0`: the schema built and every operation ran, though operations can still return GraphQL errors. `2`: the build + threw. `1`: harness failure (install log or `maven.log`) or a held lock. `64`: bad usage, such as a missing or unknown + scenario. +- `--graphql-java` swaps only the runtime graphql-java, like a user who pins another version. It doesn't recompile the + library against it. `--skip-install` runs a stale install on purpose and doesn't count as proof. + +## Evidence + +`run` prints its evidence directory, `$TMPDIR/verify-tools/evidence/-[-gj][-]/`, on its last +line. + +| File | Holds | +|---|---| +| `summary.txt` | Jars actually loaded, Java version, unused definitions, build result, errors per operation | +| `run.txt` | Checkout, commit, source fingerprint and install stamp, command, exit code | +| `schema.graphqls` | The executable schema as graphql-java prints it, generated types included | +| `.json` | The spec-shaped result, `events` for a subscription, or `threw` when `execute` threw | +| `probe.log` | WARN and above, plus INFO from `graphql.kickstart.tools`, where the library's build warnings land | +| `inspect.txt` | What the scenario's `inspect(schema)` returned | +| `build-error.txt` | Stack trace when the build threw | + +Proof standards: + +- `summary.txt`'s `graphql-java-tools jar` is inside the work dir, and `run.txt`'s fingerprint equals its install stamp. + Otherwise you tested another build. +- Quote the operation and the relevant part of `.json`. Cite `schema.graphqls` for schema shape, `probe.log` for + warnings, and `build-error.txt` with exit `2` for build failures. +- For a regression, a new warning or a clearer error, run the same scenario on the fix and on `master` (or the commit + before the fix), in two worktrees, and show both. They differ in exactly the way the issue describes. +- Report a sub-feature you didn't run as skipped, with the reason. Another scenario doesn't cover it. +- An expected value in `features/` that stops matching is a finding to report, not something to edit away. + +## Adding a scenario + +Scenarios live in the library's tests, so `mvn verify` compiles them and `CompatTest` builds each one, plus invalid +variants of it, against the last release's results. + +1. Write the SDL as `src/test/resources/compat/scenarios//schema.graphqls`. +2. Add `object : Scenario` with `name`, `files` and `resolvers` in + `src/test/kotlin/graphql/kickstart/tools/compat/scenarios/.kt`, and override `configure(builder)` for scalars, + dictionary, directives or options. Being an object in that package registers it. Classes share the package, so prefix + resolver and data classes with the scenario. Use only public API and nothing from other test packages, since the probe + compiles this directory alone. If the probe needs `internal` or test classes, a user can't reach the behavior either, + so report that. +3. Add operations as `NN-.graphql`, plus `NN-.variables.json` when they take variables. graphql-java rejects + a second `__type` in one operation and still exits `0`, so read several types through `__schema { types { ... } }`. +4. Override what the scenario needs. `operations` reuses another scenario's operation directory. `schema(parser)` takes + another build path such as `toReadOnlySchema()`. `inspect(schema)` returns evidence the printer doesn't show, and + `dumpDirectives(schema)` lists every element's applied and legacy directives. `graphQL(builder)` and + `input(builder)` add instrumentation, context or data loaders. +5. A scenario that doesn't compile breaks every checkout's run, so finish it before running. Keep a scenario that proves + a lasting feature and add its exact expected results to the matching file in `features/`. Delete a one-off + reproduction after reporting. + +`features/README.md` maps each feature to its scenarios and expected results. Delete evidence directories by hand once +reported. diff --git a/.claude/skills/verify-tools/features/README.md b/.claude/skills/verify-tools/features/README.md new file mode 100644 index 00000000..1c280f77 --- /dev/null +++ b/.claude/skills/verify-tools/features/README.md @@ -0,0 +1,45 @@ +# graphql-java-tools verification map + +Each file below is one user-visible feature, with the scenarios that prove it and their exact expected results. The +commands and proof standards are in `../SKILL.md`. Scenario data is fixed, so expected values are literal. + +A feature file has an H1 title and one paragraph on the behavior a user sees, then three H2 sections: `Sub-features` (short +IDs, one line each), `Expected results` (each scenario's `run` command and what its evidence shows), and `Gotchas` (traps +that waste or invalidate a run, and how the result looked before the fix). + +## Features + +- [Schema building](./schema-building.md): SDL files, root and nested resolvers, property and getter discovery, custom + scalars, the unused-type warning, the missing-resolver error and the read-only schema (`bookstore`, + `bookstore-missing-resolver`, `read-only-schema`). +- [Arguments and input types](./arguments-and-inputs.md): SDL defaults, enums, lists, input objects mapped to classes, + omitted versus null, parameters typed by a type variable, custom scalar arguments, recursive input objects and the WARN + for unmapped input fields (`inputs`, `unmapped-inputs`, `generic-input-resolver`, `scalar-args`, `recursive-inputs`). +- [Async resolvers and subscriptions](./async-and-subscriptions.md): `CompletableFuture`, suspend functions, and + `Publisher` subscriptions (`async`). +- [Generic wrappers](./generic-wrappers.md): wrappers and futures nested in lists and other wrappers, with and without a + `ValueUnboxer`, and in suspend resolvers (`nested-wrappers`, `nested-wrappers-unboxer`, `nested-wrappers-suspend`). +- [DataFetcherResult inside an Optional](./optional-data-fetcher-results.md): data, errors, empty, a list, the same type + returned another way, and the nested-result rejection (`optional-results`, `optional-results-mixed`, + `optional-results-list`, `optional-results-nested`). +- [Interfaces and unions](./interfaces-and-unions.md): runtime type resolution through the dictionary, including a class + whose name differs from the type, and a union that is only a member of another union (`polymorphism`, + `nested-unions`). +- [Directives and relay connections](./directives-and-relay.md): `SchemaDirectiveWiring`, `@deprecated`, `@connection` + type generation, directives and `@specifiedBy` on scalars, wirings on recursive and cross-referencing types, applied + versus legacy directive lists, undeclared directives and invalid applications (`directives`, `scalar-directives`, + `wiring-shapes`, `directive-drift`, `directive-drift-undeclared`, `directives-invalid`). +- [Schema parser options](./schema-options.md): `missingResolverDataFetcherProvider` + (`options`). +- [Type extensions](./type-extensions.md): fields, interfaces, members, values and directives of every kind of extension, + the repeat errors and the kind-mismatch warning, repeated object and input fields, and sealed subclasses found through + extensions (`type-extensions`, `type-extensions-repeated-fields`, `type-extensions-sealed`). +- [Proxied resolvers](./proxies.md): Spring JDK dynamic and CGLIB proxies, and the build error for fields a JDK proxy can't + call (`jdk-proxy`, `jdk-proxy-cglib`, `jdk-proxy-plain`). +- [Context and environment parameters](./context-and-environment.md): `contextClass`, `GraphQLContext` and + `DataFetchingEnvironment` after the schema arguments, in any order, the misbound-argument error, and resolver methods + without the source parameter (`context-and-environment`, `context-and-environment-invalid`, `context-misbound`, + `sourceless`, `sourceless-shadowed`, `sourceless-unimplemented`, `sourceless-misbound`). + +Not mapped yet: field visibility, per-field object mappers, the Guice, Javassist and Weld proxy handlers, +`includeUnusedTypes`, and comment descriptions. Add a scenario and a feature entry when a change touches one of them. diff --git a/.claude/skills/verify-tools/features/arguments-and-inputs.md b/.claude/skills/verify-tools/features/arguments-and-inputs.md new file mode 100644 index 00000000..87b9acca --- /dev/null +++ b/.claude/skills/verify-tools/features/arguments-and-inputs.md @@ -0,0 +1,95 @@ +# Arguments and input types + +Resolver methods take GraphQL arguments as ordinary parameters, in SDL order. graphql-java-tools converts scalars, enums, +lists and input objects into the parameter's declared class, applies SDL default values, and passes +`DataFetchingEnvironment` when it is the last parameter. An input object can refer to itself, or to another input object +that refers back. With `inputArgumentOptionalDetectOmission`, an `Optional` parameter tells an omitted argument (`null`) +from an explicit `null` (`Optional.empty()`). + +## Sub-features + +- `args-defaults` applies an argument's SDL default when the operation omits it. +- `args-enum-list` converts `[Genre!]` literals into a `List` of a Kotlin enum. +- `args-env` passes `DataFetchingEnvironment` as the trailing parameter. +- `args-input-object` maps a nested input object into data classes, including input field defaults. +- `args-optional-omission` passes `null` for an omitted argument, `Optional.empty()` for an explicit null, and + `Optional.of` for a value. +- `args-invalid-enum` rejects an unknown enum literal during validation, before any resolver runs. +- `args-unmapped-warn` logs a WARN at build for an input field the argument's class has no property for, here a + misspelled property under an `Optional`. +- `args-unmapped-ignored` doesn't report a field the property's `@JsonIgnoreProperties` ignores, here on an `Optional` + property. +- `args-type-variable` converts an argument whose parameter is typed by the resolver superclass's type variable into the + class the subclass binds it to. +- `args-scalars` passes a custom scalar's coerced object through unconverted, also when it's a Kotlin class without visible + properties inside an input object, converts `ID` into a `Long` parameter, and converts `[[String]]` into a + `List>` parameter. +- `args-recursive` converts an input object that refers to itself, and two that refer to each other, through lists, nested + lists and non-null types into data classes at every depth. It also builds a directive whose arguments are an input + object, an enum with a default and a list. + +## Expected results + +- **Run.** `run inputs`. Exit `0`. `summary.txt` shows `errors=0` for `01` to + `03` and `errors=1` for `04-invalid-enum`. +- **Defaults, enums, env.** `01-search.json` has + `data.defaults = "term=dune limit=10 genres=null field=search"` and + `data.explicit = "term=dune limit=2 genres=[SCIENCE, HISTORY] field=search"`. +- **Omitted vs null.** `02-nickname.json` has `omitted = "omitted"`, `explicitNull = "explicit null"` and + `given = "value Bilbo"`. +- **Input objects.** `03-add-book.json` (variables in `03-add-book.variables.json`) has `data.addBook` equal to + `{"title": "Cosmos", "genre": "SCIENCE", "tags": ["space", "classic"], "pages": 396, "language": "en"}`. `language` + comes from the input field default. `data.defaults` is `{"genre": "FICTION", "tags": [], "pages": null}`. +- **Invalid enum.** `04-invalid-enum.json` has no `data`, and one error whose message starts with + `Validation error (WrongType@[search])` and names `POETRY`. +- **Unmapped input fields.** `run unmapped-inputs`. Exit `0`. `probe.log` has + exactly one `UnmappedInputFieldChecker` WARN, starting `Input field 'ItemInput.name' has no matching property in + graphql.kickstart.tools.compat.scenarios.ItemInput` and listing `Known properties: nmae`. There is no WARN for + `InnerInput.legacy`. `01-ignored.json` has `data.ignored = "a"`. `02-typo.json` has one error containing + `Unrecognized property "name" (class graphql.kickstart.tools.compat.scenarios.ItemInput)` (`Unrecognized field` before + Jackson 3, in 14.x), which shows the reported field really fails. +- **Type variable parameters.** `run generic-input-resolver`. Exit `0`. + `summary.txt` shows `errors=0` for both operations. `02-generic.json` has + `data.generic = "generic got GreetingInput(name=a)"`, and `01-plain.json` has + `data.plain = "plain got GreetingInput(name=a)"`. +- **Scalar arguments.** `run scalar-args`. Exit `0`. `summary.txt` shows + `errors=0` for the first five operations. `01-custom-scalar.json` has `data.tag = "tag kotlin"` and + `data.tags = "tags [a, b]"` (`Tag` has no constructor Jackson can use, so this only works when the value is passed + through). `02-id.json` has `data.id = "id 43 (long)"`. `03-nested-sets.json` has + `data.nestedSets = "sets [[a, b], [c]] sizes [2, 1]"`. `04-nested-lists.json` has + `data.nestedLists = "lists [[a, a, b], [c]]"`. `05-empty-kotlin-scalar.json` has `data.tokenInput = "token input"`. + `06-marked-empty-kotlin-scalars.json` has one error and `07-optional-marked-empty-kotlin-scalars.json` two, all containing + `missing type id property '@class'` or `Cannot deserialize value of type`. Those scalars fail rather than reach the resolver + as a default instance. +- **Recursive inputs.** `run recursive-inputs`. Exit `0`, `errors=0` for both operations and an empty `probe.log`. + `01-describe.json` (variables in `01-describe.variables.json`) has `data.names = ["a", "b"]`. `data.describe` starts + `TreeFilter(name=root, and=[TreeFilter(name=a,` and ends `siblings=[[ChildFilter(parent=null, siblings=null, depth=4)], + []], depth=3))`. `data.literal` is `TreeFilter(name=x, and=null, not=null, child=ChildFilter(parent=null, + siblings=[[ChildFilter(parent=null, siblings=null, depth=2)]], depth=1))`. `schema.graphqls` has `siblings: + [[ChildFilter!]!]` and `directive @limit(labels: [String!], range: RangeInput!, unit: LimitUnit = ITEMS) on + FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION`. In `02-introspect.json`, `limit` has `range` of + `RangeInput!`, `unit` of `LimitUnit` with default `ITEMS`, and `labels` of `[String!]`. + +## Gotchas + +- Arguments bind by position, not name. A resolver whose parameters are in a different order than the SDL still builds + when the types line up, and returns swapped values. +- Without `inputArgumentOptionalDetectOmission`, an omitted argument and an explicit null both arrive as + `Optional.empty()`. This scenario turns the option on. Prove the default behavior in a separate scenario. +- `04-invalid-enum` fails in graphql-java validation. It proves the generated enum type, not the resolver's conversion. +- The unmapped input field check comes from PR #857. On a checkout without it, `unmapped-inputs` still exits `0` with the + same JSON, but `probe.log` has no `UnmappedInputFieldChecker` lines. +- `02-typo` errors because the scenario uses the default `ObjectMapper`, which fails on unknown properties. It doesn't + cover a mapper that ignores them. +- The type variable fix comes from PR #882. On a checkout without it, `generic-input-resolver` still builds and exits + `0`, but `02-generic.json` has `data: null` and an error containing `TypeVariableImpl cannot be cast to class + java.lang.Class`. +- The nested list fix comes from PR #891. On a checkout without it, `scalar-args` still exits `0`, but + `03-nested-sets.json` has an error containing `ArrayList cannot be cast to class java.util.Set`. +- The fix for a Kotlin scalar class without visible properties comes from issue #926. On a checkout without it, + `05-empty-kotlin-scalar.json` has `data.tokenInput = "token default"`, since Jackson wrote the value as `{}` and read it + back as a new instance. The same scalar written with a type id or an object id comes from issue #932. On a checkout + without it, `07-optional-marked-empty-kotlin-scalars.json` has no errors and `"typed default"` and `"id default"`. The probe doesn't cover an `ObjectNode` parameter, which needs Jackson 3 on the probe's compile + path. `CustomScalarInputTest` does. +- `recursive-inputs` registers no directive wiring. `wiring-shapes` in `directives-and-relay.md` covers wirings on a + recursive input. diff --git a/.claude/skills/verify-tools/features/async-and-subscriptions.md b/.claude/skills/verify-tools/features/async-and-subscriptions.md new file mode 100644 index 00000000..b1d4e508 --- /dev/null +++ b/.claude/skills/verify-tools/features/async-and-subscriptions.md @@ -0,0 +1,35 @@ +# Async resolvers and subscriptions + +Resolvers can return a `CompletableFuture`, be Kotlin `suspend` functions (root resolvers and `GraphQLResolver` field +resolvers alike), or, for subscription fields, return a reactive-streams `Publisher`. The schema declares the plain +result type (`String!`, `Int!`), and graphql-java-tools unwraps the async wrapper. + +## Sub-features + +- `async-future` resolves a field from a `CompletableFuture`. +- `async-suspend-root` resolves a root field from a `suspend fun` that suspends (`delay`). +- `async-suspend-nested` resolves a list of objects from a `suspend fun`, and a field on each through a suspend + `GraphQLResolver` method. +- `async-subscription` streams a `Publisher` from a `GraphQLSubscriptionResolver`, one event per element, then + completes. + +## Expected results + +- **Run.** `run async`. Exit `0`. `summary.txt` has + `operation 01-query: errors=0` and `operation 02-subscription: errors=0 events=3`. +- **Futures and suspend.** `01-query.json` has `data.future = "from a future"`, + `data.suspended = "from a suspend function"`, and + `data.shipments = [{"id": "s1", "status": "s1: delivered"}, {"id": "s2", "status": "s2: delivered"}]`. +- **Subscription.** `02-subscription.json` is + `{"events": [{"data": {"ticks": 1}}, {"data": {"ticks": 2}}, {"data": {"ticks": 3}}]}`, with no `errors` key and no + `publisherError` entry. + +## Gotchas + +- Collection stops at stream completion or after 10 seconds. A publisher that never completes prints `subscription did + not complete within 10 seconds` and records only the events seen so far, which is a finding, not a pass. +- An error from the publisher shows up as a `{"publisherError": ...}` event, not under `errors`. +- `--graphql-java` changes only the runtime graphql-java. The library jar is still the one compiled against the version + in `pom.xml`. +- The suspend timing isn't asserted. To prove a dispatcher or `coroutineContextProvider` change, add a field that + reports `Thread.currentThread().name` or the coroutine context to a new scenario. diff --git a/.claude/skills/verify-tools/features/context-and-environment.md b/.claude/skills/verify-tools/features/context-and-environment.md new file mode 100644 index 00000000..b61fc427 --- /dev/null +++ b/.claude/skills/verify-tools/features/context-and-environment.md @@ -0,0 +1,62 @@ +# Context and environment parameters + +After its schema arguments, a resolver method can take any of `DataFetchingEnvironment`, `graphql.GraphQLContext` and the +class set with `contextClass`, in any order. The custom context is read from the `GraphQLContext` map under its class. +Any other trailing parameter type fails the build with "No method found". + +## Sub-features + +- `ctx-env-both` passes the custom context and the environment to `greeting(name, context, env)`. +- `ctx-env-reversed` passes them to `farewell(name, env, context)`. +- `ctx-env-type-resolver` passes `graphql.GraphQLContext` and the environment to a `GraphQLResolver` method. +- `ctx-env-single` keeps a single environment or a single context parameter working. +- `ctx-env-invalid` rejects a trailing `String` parameter at build time. +- `ctx-env-misbound` fails the build when a schema argument would land on an environment or context parameter. +- `sourceless` binds a field resolver method that leaves out the source and takes only arguments, the environment or the + context, when no method with the source and no property matches. + +## Expected results + +- **Run.** `run context-and-environment`. Exit `0`, `01-query: errors=0`. +- **Results.** `01-query.json` has `data = {"greeting": "greeting: hi ada, from oryan", "farewell": "farewell: bye ada, + from oryan", "user": {"name": "oryan", "locale": "locale of oryan: en-CA"}, "environmentOnly": "environmentOnly", + "contextOnly": "en-CA"}`. +- **Invalid.** `run context-and-environment-invalid`. Exit `2`. + `build-error.txt` starts with `graphql.kickstart.tools.resolver.FieldResolverError: No method found ... (optionally + followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class + graphql.kickstart.tools.compat.scenarios.AppContext])`. +- **Misbound.** `run context-misbound`. Exit `2`, no operations run, and `probe.log` is empty. `build-error.txt` starts + with `graphql.kickstart.tools.resolver.FieldResolverError: Field 'Query.users' has no parameter for its argument + 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment + parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment + parameter.` The build stops at that first field, so `Query.contextArgument` and `User.thumbnail` aren't named. +- **Without the source.** + - `run sourceless`: exit `0`, `errors=0` for both operations. In `01-local-context.json` each image has + `imageBlob = "blob for [png, jpg]"` (`imageBlob(env)` reads the `localContext` that `images` returned), + `thumbnail = "png@64"` and `caption = "caption of cat"` (`dog` for the second). In `02-contexts.json` each image has + `owner = "ada"`, `locale = "en-CA"` and `signature = "signature by oryan"`. + - `run sourceless-shadowed`: exit `0`. `01-shadowed.json` has `name = "cat"` and `title = "with source cat"`, so the + source's `name` property wins over `getName(env)` and `title(image)` over `title(env)`. + - `run sourceless-unimplemented`: exit `0`. `probe.log` has `Missing resolver for field: FieldDefinition{name='preview'` + next to the development-only warning for `allowUnimplementedResolvers`, so `preview(env)` is not bound. `execute` + throws, so `01-helper.json` is `{"threw": "java.util.concurrent.CompletionException: kotlin.NotImplementedError: An + operation is not implemented: Schema resolver not implemented"}`. + - `run sourceless-misbound`: exit `2`. `thumbnail(GraphQLContext, env)` for `thumbnail(size: Int)` still fails the build. + The signatures listed for `compat/scenarios/sourceless-misbound/schema.graphqls:11` end with + `graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, )` and + `graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, )`. + +## Gotchas + +- Before #911 (commit 296ac4bf) `context-misbound` builds with exit `0` and all four operations have `errors=1`. `01` + fails with `Parameter specified as non-null is null`, `02` and `04` with + ``Cannot construct instance of `graphql.schema.DataFetchingEnvironment` ``, and `03-context-and-correct.json` has + `data = {"contextArgument": null, "greeting": "greeting: hi ada"}` with one error, for `/contextArgument`. From #890 on, + `probe.log` has 3 `SchemaClassScanner` WARNs, for `Query.users`, `Query.contextArgument` and `User.thumbnail`, none for + `Query.greeting`. Before it, `probe.log` is empty. +- Before #888 only one trailing parameter was allowed, so `context-and-environment` fails to + build on older versions with the same "No method found" error. +- Before #904 `sourceless` fails the build (exit `2`) with `No method or field found ... imageBlob` and six listed + signatures, none ending in ``. `sourceless-shadowed` and `sourceless-unimplemented` give the + same results as after it. `sourceless-misbound` still fails the build, but its error lacks the two + `(~size, )` signatures. diff --git a/.claude/skills/verify-tools/features/directives-and-relay.md b/.claude/skills/verify-tools/features/directives-and-relay.md new file mode 100644 index 00000000..4e969c04 --- /dev/null +++ b/.claude/skills/verify-tools/features/directives-and-relay.md @@ -0,0 +1,96 @@ +# Directives and relay connections + +SDL directives reach the user's code in three ways. A named `SchemaDirectiveWiring` registered with `.directive(name, …)` +can wrap the data fetcher of every field that carries the directive. `@deprecated(reason:)` shows up in introspection. A +field marked `@connection(for: "Member")` gets its `MemberConnection`, `MemberConnectionEdge` and `PageInfo` types +generated, so the SDL never declares them, and a resolver returning `graphql.relay.Connection` fills them. A +wiring also runs on interfaces, unions, enums and input objects, including ones that refer to themselves or each other. +The build checks every applied directive against its definition. It fails for an invalid application, listing each with +its source line, and for a directive with no definition unless `allowUndeclaredDirectives(true)` is set. + +## Sub-features + +- `dir-wiring-field` uppercases `@uppercase` fields on `Query` and on a nested type (`Member.name`) through a wrapped + data fetcher. +- `dir-wiring-scope` leaves fields without the directive unchanged. +- `dir-deprecated` reports `isDeprecated` and `deprecationReason` through `__type(...).fields(includeDeprecated: true)`. +- `dir-connection-types` generates `MemberConnection`, `MemberConnectionEdge` and `PageInfo` from `@connection`. +- `dir-connection-paging` returns edges with cursors and `pageInfo` from `SimpleListConnection` for `first: 2`. +- `dir-scalar` applies the directives of a scalar and its extension, runs `onScalar`, and reports `specifiedByURL` from + the SDL `@specifiedBy` or else from the provided scalar (`scalar-directives`). +- `dir-scalar-undeclared` keeps an undeclared directive on a scalar in `appliedDirectives` when + `allowUndeclaredDirectives(true)` is set (`directive-drift`). +- `dir-wiring-recursive` hands a wiring on a field of a self-referencing input object the built `GraphQLInputObjectType`, + not a `GraphQLTypeReference` (`wiring-shapes`). +- `dir-wiring-shapes` runs wirings on an interface, a union, an enum and a self-referencing object type, and lets a wiring + make a self-referencing field non-null (`wiring-shapes`). +- `dir-applied-legacy` lists every applied directive, undeclared ones included, in `appliedDirectives`, and only the + declared ones in the legacy `directives` (`directive-drift`). +- `dir-undeclared-fails` fails the build for an applied directive with no definition unless + `allowUndeclaredDirectives(true)` is set (`directive-drift-undeclared`). +- `dir-invalid-fails` fails the build for a directive applied where its definition doesn't allow it, without a required + argument, or twice when it isn't repeatable, and lists every one with its source line and column + (`directives-invalid`). + +## Expected results + +- The members are `m1` "ada", `m2` "grace", `m3` "barbara", in that order. + +- **Run.** `run directives`. Exit `0`, `errors=0` for all three operations, and + an empty `probe.log`. +- **Wiring.** `01-uppercase.json` has `data.motto = "KEEP IT SIMPLE"` and `data.oldMotto = "move fast"`. +- **Deprecated.** `02-deprecated.json` lists `motto` and `members` with `isDeprecated: false`, and `oldMotto` with + `isDeprecated: true` and `deprecationReason: "Use motto"`. +- **Connection.** `03-connection.json` has two edges, `{"id": "m1", "name": "ADA"}` and `{"id": "m2", "name": "GRACE"}`, + with non-empty cursors. `pageInfo` has `hasNextPage: true`, `hasPreviousPage: false`, `startCursor` equal to the first + edge's cursor, and `endCursor` equal to the second's. +- **Generated types.** `schema.graphqls` has `type MemberConnection { edges: [MemberConnectionEdge] pageInfo: PageInfo }` + and `type MemberConnectionEdge { cursor: String node: Member }`, and the SDL file declares neither. +- **Scalars.** `run scalar-directives`. Exit `0` and `errors=0` for both + operations. `schema.graphqls` has `"A calendar date, wired with @since(2020-01-01), wired with @unit(day)"` above + `scalar Date @since(date : "2020-01-01") @unit(name : "day") @specifiedBy(url : "https://example.com/date")`, and + `scalar DateTime @specifiedBy(url : "https://scalars.graphql.org/andimarek/date-time")`. In `01-introspect-scalars.json`, + `Date` has `specifiedByURL: "https://example.com/date"` and `DateTime` has + `"https://scalars.graphql.org/andimarek/date-time"`. `probe.log` is empty. +- **Wirings on cycles.** `run wiring-shapes`. Exit `0`, `errors=0` for both operations and an empty `probe.log`. + `schema.graphqls` has `"sees GraphQLInputObjectType TreeFilter"` on `TreeFilter.children`, `friend: Person! @required` + and `state: State! @required` where the SDL declares both nullable, and `"described"` above `Named`, `Someone`, + `Person`, `State` and `TreeFilter`. `01-trees.json` has `data.trees = 4`. `02-person.json` has + `data.person = {"name": "ada", "friend": {"name": "ada"}, "state": "ALIVE", "someone": {"name": "ada"}}` and + `data.someone = {"name": "grace"}`. +- **Applied and legacy lists.** `run directive-drift`. Exit `0` and `schema build: OK`, with no operations. In + `inspect.txt`, `field Query.search` has two `applied @undeclared`, the first with arguments typed from their literals + (`i: Int`, `f: Float`, `b: Boolean`, `l: [Int]`), then two `applied @tag`, and two `legacy @tag` but no legacy + `@undeclared`. `enum value Color.BLUE` has `applied @deprecated` and `applied @undeclared` but only + `legacy @deprecated`. `type Money` has one `applied @undeclared` with `code: String = literal "USD"` and no legacy + directive. `type Query` has `applied @tag` (`"query"`), then the extension's `@once` (`"extension"`), `@tag` and + `@undeclared`, and the same list without `@undeclared` as legacy. `probe.log` is empty. +- **Undeclared.** `run directive-drift-undeclared`. Exit `2`. `summary.txt` has `schema build: FAILED + graphql.kickstart.tools.SchemaError: Found applied directive undeclared without corresponding directive definition.`, + and `build-error.txt` starts with the same message. +- **Invalid applications.** `run directives-invalid`. Exit `2`, no operations run, and `probe.log` is empty. `summary.txt` + has `schema build: FAILED graphql.kickstart.tools.SchemaError:` followed by one line per invalid application, each + naming its line and column in `compat/scenarios/directives-invalid/schema.graphqls`, in this order. + `Directive @deprecated at line 17, column 13 ... is applied to OBJECT, but it's declared on FIELD_DEFINITION | + ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION.` + `Directive @uppercase at line 12, column 20 ... is applied to FIELD_DEFINITION, but it's declared on OBJECT.` + `Directive @auth at line 13, column 20 ... is missing its required argument 'role'.` Two + `Directive @cached at line ... isn't repeatable but is applied more than once`, at line 14, column 32 (the second + `@cached` on `members`) and line 9, column 15 (`extend schema`). `build-error.txt` starts with the same message. + +## Gotchas + +- `@connection` must be declared in the SDL like any applied directive. Without a definition, the build throws + `SchemaError: Found applied directive connection without corresponding directive definition.` unless + `allowUndeclaredDirectives(true)` is set. +- The uppercased `ADA` and `GRACE` names also prove the wiring reached a nested type's field. Lowercase names there mean + the wiring only ran on `Query`. +- `@since(2020-01-01)` proves `onScalar` reads an argument typed by the scalar the directive is applied to. `@since(null)` + means the wiring saw a type reference. +- Cursors are base64 of `simple-cursor` from graphql-java's `SimpleListConnection`. Don't hard-code them across + graphql-java versions. +- Before #895 (commit 21f3796e) `wiring-shapes` has the same `schema.graphqls`, except that `TreeFilter.children` reads + `"sees GraphQLTypeReference TreeFilter"`. +- Before #914 (commit 2114b149) `directives-invalid` builds with exit `0`, and `01-query.json` has + `data.motto = "KEEP IT SIMPLE"`, so the misplaced `@uppercase` still wires. From #885 (commit 94a98a01) on, `probe.log` + has the five messages as `SchemaParser` WARNs. Before it, `probe.log` is empty. diff --git a/.claude/skills/verify-tools/features/generic-wrappers.md b/.claude/skills/verify-tools/features/generic-wrappers.md new file mode 100644 index 00000000..ef2c57d8 --- /dev/null +++ b/.claude/skills/verify-tools/features/generic-wrappers.md @@ -0,0 +1,59 @@ +# Generic wrappers + +A resolver can return a value in a wrapper type registered with `genericWrappers(...)`, such as the scenario's `Try`, or +in a `CompletableFuture`, while the schema declares the plain type. The wrappers can sit inside a list or inside each +other, as in `List>` or `CompletableFuture>>`. graphql-java-tools unwraps every level, maps +the lists, and combines the futures below the outermost value into one, so one failed element fails the whole field. + +## Sub-features + +- `wrap-list` unwraps a `List>` into `[Payload!]!` and a `List>` into `[String!]!`. +- `wrap-future-list` unwraps a `List>` into `[Item]` and a + `List>` into `[String]`, including the futures that `DataLoader.load` returns. +- `wrap-nested` unwraps a `CompletableFuture>`, a `CompletableFuture>>` and + a `List>>`. +- `wrap-failed-element` fails the whole field, with the element's message, when one `Try` or future in a list failed. +- `wrap-controls` keeps a `List` and a `CompletableFuture>` working. +- `wrap-unboxer` gives the same results when the app's own `ValueUnboxer` already unwraps `Try` and joins futures + (`nested-wrappers-unboxer`). +- `wrap-suspend` builds and resolves suspend functions returning `List>` for `[Item]` and + `[Item!]!`, and `List` for `[String]`. The return type of a suspend function carries the wildcard + `List>` (`nested-wrappers-suspend`). + +## Expected results + +- **Run.** `run nested-wrappers`. Exit `0` and an empty `probe.log`. `summary.txt` has `errors=0` for `01` to `09` and `12`, + and `errors=1` for `10-failed-try-in-list` and `11-failed-future-in-list`. +- **Lists of wrappers.** `02-payloads.json` has `data.payloads = [{"data": "a"}, {"data": "b"}]` and + `03-payload-strings.json` has `data.payloadStrings = ["a", "b"]`. `04-items.json` has + `data.items = [{"id": "1"}, {"id": "2"}]`, one future already complete and one from `supplyAsync`, and + `05-item-names.json` has `data.itemNames = ["one", "two"]`. +- **Nested wrappers.** `06-future-of-future.json` has `data.futureOfFuture = {"id": "inner"}`. `07-future-of-tries.json` + has `data.futureOfTries = [{"data": "a"}, {"data": "b"}]` and `08-tries-of-futures.json` has + `data.triesOfFutures = [{"id": "1"}, {"id": "2"}]`. `09-loaded-items.json` has + `data.loadedItems = [{"id": "x"}, {"id": "y"}]`. +- **Failed element.** `10-failed-try-in-list.json` has `data.failedTryInList = null` and one error, + `Exception while fetching data (/failedTryInList) : payload failed`. `11-failed-future-in-list.json` has + `data.failedFutureInList = null` and one error, `Exception while fetching data (/failedFutureInList) : item failed`. +- **Controls.** `12-controls.json` has `data.plainItems = [{"id": "p1"}, {"id": "p2"}]` and `data.futureOfItems` equal to + it. +- **Unboxer.** `run nested-wrappers-unboxer`. Exit `0`. It runs the operations of `nested-wrappers`. The errors per + operation in `summary.txt` and every `.json` match the ones of `nested-wrappers`. +- **Suspend.** `run nested-wrappers-suspend`. Exit `0`, `errors=0` for all three operations and an empty `probe.log`. + `01-nullable-items.json` has `data.nullableItems = [{"id": "1"}, {"id": "2"}]`, `02-non-null-items.json` has the same + list as `data.nonNullItems`, and `03-type-variable-strings.json` has `data.typeVariableStrings = ["a", "b"]`. + +## Gotchas + +- Before #903 (commit a4736c9a) `nested-wrappers` still exits `0`. `02`, `07`, `08` and `10` have an error per element, + `Expected source object to be an instance of '' but instead got + 'graphql.kickstart.tools.compat.scenarios.Try$Success'`, and `04`, `06`, `09` and `11` the same with + `'java.util.concurrent.CompletableFuture'`. `03-payload-strings.json` has + `["Success(value=a)", "Success(value=b)"]` and `05-item-names.json` has + `java.util.concurrent.CompletableFuture@[Completed normally]` strings, both with `errors=0`. +- Before #903 `nested-wrappers-suspend` fails the build (exit `2`) with `SchemaClassScannerError: Two different classes used + for type Item`, naming `java.util.concurrent.CompletableFuture` for + `nullableItems` and `graphql.kickstart.tools.compat.scenarios.NestedItem` for `nonNullItems`. +- Before #903 `nested-wrappers-unboxer` had `errors=0` for `01` to `09`, because the app's `ValueUnboxer` did the + unwrapping. `10` and `11` were `THREW java.lang.IllegalStateException` in `summary.txt`, with `{"threw": ...}` in the + JSON, because the failed element's exception left `execute`. Now they return `errors=1` like `nested-wrappers`. diff --git a/.claude/skills/verify-tools/features/interfaces-and-unions.md b/.claude/skills/verify-tools/features/interfaces-and-unions.md new file mode 100644 index 00000000..58bfe3fb --- /dev/null +++ b/.claude/skills/verify-tools/features/interfaces-and-unions.md @@ -0,0 +1,41 @@ +# Interfaces and unions + +A field can return an interface or a union while the resolver returns a supertype (`Entity`, `Any`). graphql-java-tools +can't learn the concrete classes from those return types, so the user registers them with `.dictionary(...)`. At runtime +the object's class decides the GraphQL type. When the class name differs from the type, the user registers it with an +explicit name: `.dictionary("Writer", WriterEntity::class.java)`. + +## Sub-features + +- `poly-interface` resolves `node(id): Node` to `Novel` or `Writer` from the returned class. +- `poly-union` resolves each element of `[SearchResult!]!` (`Novel | Writer`) from a `List`. +- `poly-dictionary-name` maps the type `Writer` to the class `WriterEntity` by an explicit dictionary name. +- `poly-dictionary-class` maps `Novel` to the class `Novel` by `.dictionary(Novel::class.java)`. +- `nested-union` builds `union Result = Book | Media` with `union Media = Movie` when no field returns `Media`, and flattens + `Result` to `Book | Movie` (scenario `nested-unions`). + +## Expected results + +- The data is `Novel("n1", "Solaris")` and `WriterEntity("w1", "Stanisław Lem")`. + +- **Run.** `run polymorphism`. Exit `0`, `errors=0` for both operations, and an + empty `probe.log`. A dictionary warning there means an entry went unused. +- **Interface.** `01-node.json` has `data.novel = {"__typename": "Novel", "id": "n1", "title": "Solaris"}` and + `data.writer = {"__typename": "Writer", "name": "Stanisław Lem"}`. +- **Union.** `02-union.json` has `data.search` equal to `[{"__typename": "Novel", "title": "Solaris"}, + {"__typename": "Writer", "name": "Stanisław Lem"}]`. +- **Schema.** `schema.graphqls` has `union SearchResult = Novel | Writer` and both types implementing `Node`. +- **Nested union.** `run nested-unions`. Exit `0`, `errors=0` and an empty + `probe.log`. `01-results.json` has `data.results` equal to `[{"__typename": "Book", "title": "Solaris"}, + {"__typename": "Movie", "title": "Stalker"}]`, the `Movie` reached through `... on Media`. `schema.graphqls` has + `union Media = Movie` and `union Result = Book | Movie`. + +## Gotchas + +- Without `.dictionary(Novel::class.java)`, the build fails (exit `2`) with `SchemaClassScannerError: Object type + 'Novel' implements a known interface, but no class could be found for that type name.` To prove a dictionary change, + use a separate scenario, because this one must keep building. +- `nested-unions` fails to build (exit `2`) on checkouts without #887, with `No object type found with name 'Media' for + union`. +- `__typename` is the assertion that matters. Fields selected through the wrong inline fragment are silently absent, not + errors. diff --git a/.claude/skills/verify-tools/features/optional-data-fetcher-results.md b/.claude/skills/verify-tools/features/optional-data-fetcher-results.md new file mode 100644 index 00000000..ff197951 --- /dev/null +++ b/.claude/skills/verify-tools/features/optional-data-fetcher-results.md @@ -0,0 +1,36 @@ +# DataFetcherResult inside an Optional + +A resolver can return `Optional>` for a nullable field. graphql-java gets the `DataFetcherResult`, so +the field resolves its data and the query keeps its errors. An empty `Optional` resolves to null. A `DataFetcherResult` or an +`Optional` twice in one value fails the build. + +## Sub-features + +- `opt-result` resolves `Optional>` for `Payload` with its error, and + `Optional>` for `String`. +- `opt-result-empty` resolves `Optional.empty()` to null. +- `opt-result-mixed` builds when the same object type is also returned as a `DataFetcherResult>`. +- `opt-result-list` resolves `Optional>>` for `[Payload]`. +- `opt-result-nested` rejects `Optional>>`. + +## Expected results + +- **Run.** `run optional-results`. Exit `0` and an empty `probe.log`. `01-optional-result.json` has + `data.optionalResult = {"data": "a"}` and one error, `partial`. `02-optional-result-name.json` has + `data.optionalResultName = "a"` and `03-empty-optional-result.json` has `data.emptyOptionalResult = null`, both without + errors. +- **Mixed.** `run optional-results-mixed`. Exit `0`. `01-optional-result.json` matches the one above and + `02-result-of-optional.json` has `data.resultOfOptional = {"data": "a"}`. +- **List.** `run optional-results-list`. Exit `0`. `01-optional-result-list.json` has + `data.optionalResultList = [{"data": "a"}, {"data": "b"}]`. +- **Nested.** `run optional-results-nested`. Exit `2`. `build-error.txt` ends in + `graphql.execution.DataFetcherResult cannot be nested within itself`. + +## Gotchas + +- Before the fix (master 3f022b91) `optional-results` still exits `0`. `01` has + `data.optionalResult = {"data": "graphql.kickstart.tools.compat.scenarios.OptionalResultsPayload@"}` with no + error, and `02` has + `"DataFetcherResult{data=a, errors=[], localContext=null, extensions=null}"`. `optional-results-mixed` exits `2` with + `Two different classes used for type Payload`, `optional-results-list` exits `2` with `Java class is not a List or generic + type information was lost`, and `optional-results-nested` exits `0` with the same `Payload@` string. diff --git a/.claude/skills/verify-tools/features/proxies.md b/.claude/skills/verify-tools/features/proxies.md new file mode 100644 index 00000000..88670c84 --- /dev/null +++ b/.claude/skills/verify-tools/features/proxies.md @@ -0,0 +1,40 @@ +# Proxied resolvers + +A resolver wrapped in a Spring AOP proxy is scanned as its target class through `Spring4AopProxyHandler`. A CGLIB proxy +(`proxyTargetClass = true`) subclasses the target, so its methods work. A JDK dynamic proxy only implements the target's +interfaces, so it can't call a field that resolves to the target's own method or field. The build fails with a +`FieldResolverError` that names every such field and suggests class-based proxies, plus a getter for a field. + +## Sub-features + +- `proxy-jdk-fails` fails the build with one line per field that a JDK proxy can't call, naming the type, field, member + and proxy class, even for fields no operation queries. +- `proxy-jdk-field-getter` suggests adding a getter for a field that resolves to a public field. +- `proxy-cglib` serves methods and getters through a CGLIB proxy with no warning, but a public field reads `0`. +- `proxy-plain` serves the same resolver without a proxy and with no warning. + +## Expected results + +- **JDK proxy.** `run jdk-proxy`. Exit `2`, no operations run, and `probe.log` is empty. `build-error.txt` starts with + `graphql.kickstart.tools.resolver.FieldResolverError: Field 'Query.test' resolves to + graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxy2.$ProxyN, which isn't a + graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail.`, followed by the same + line for `Field 'Query.count'` (`ProxiedQuery.count`) and `Field 'Query.total'` (`ProxiedQuery.getTotal`), and ends + `This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. + proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field + reads to the target.` +- **CGLIB proxy.** `run jdk-proxy-cglib`. Exit `0`, empty `probe.log`, + `01-query.json` has `data = {"test": "ok", "count": 0, "total": 2}`. +- **No proxy.** `run jdk-proxy-plain`. Exit `0`, empty `probe.log`, + `01-query.json` has `data = {"test": "ok", "count": 1, "total": 2}`. + +## Gotchas + +- Before #913 (commit f4800425) `jdk-proxy` builds with exit `0`. `01-query.json` has + `data = {"test": null, "count": null, "total": null}` and three errors, `object of type jdk.proxy2.$ProxyN is not an + instance of graphql.kickstart.tools.compat.scenarios.ProxiedQuery` for `test` and `total`, and `Can not get final int + field graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count` for `count`. From #853 on, `probe.log` has one `SchemaClassScanner` WARN per field. Before it, `probe.log` is empty. +- The proxy number in `jdk.proxy2.$ProxyN` varies between runs. +- CGLIB can't override `final` members, so the resolver and its members must be `open`. A final getter is called on the + proxy itself and reads the proxy's empty field, like `count` does. +- The three scenarios share the schema and operations in `compat/scenarios/jdk-proxy/`. diff --git a/.claude/skills/verify-tools/features/schema-building.md b/.claude/skills/verify-tools/features/schema-building.md new file mode 100644 index 00000000..d794262f --- /dev/null +++ b/.claude/skills/verify-tools/features/schema-building.md @@ -0,0 +1,55 @@ +# Schema building + +A user points `SchemaParser.newParser()` at SDL files on the classpath and hands it resolver objects. graphql-java-tools +matches every SDL type to a class and every field to a resolver method, getter or property, and returns an executable +`GraphQLSchema`. When it can't find a field's implementation, it fails the build with a message that lists every +signature it tried. Types no root can reach get a warning and are dropped from the schema. + +## Sub-features + +- `build-files` loads SDL with `.file()` and `.files()` from the classpath, including `extend type`. +- `build-root-resolver` resolves `Query` fields through a `GraphQLQueryResolver`'s methods, with and without arguments. +- `build-nested-resolver` resolves a field through a `GraphQLResolver` method that takes the parent object. +- `build-properties` resolves fields through Kotlin properties and an `isX()` getter for a `Boolean!` field. +- `build-scalar` serializes a custom `GraphQLScalarType` registered with `.scalars()`. +- `build-unused-type` warns about a type no root can reach and leaves it out of the schema. +- `build-missing-resolver` fails the build with `FieldResolverError` and lists the signatures it searched. +- `build-read-only` builds a schema without mutation and subscription through `parseSchemaObjects().toReadOnlySchema()`, + with interfaces, unions and custom directives working as in the full schema. + +## Expected results + +- The `bookstore` books are `b1` "The Dispossessed" (a1, stock 3), `b2` "The Left Hand of Darkness" (a1, + stock 0) and `b3` "Use of Weapons" (a2, stock 1), and authors `a1` "Ursula K. Le Guin" and `a2` "Iain M. Banks". + +- **Build and list.** `run bookstore`. Exit `0`, and `summary.txt` has + `schema build: OK`, `unused definitions: Review`, and `operation 01-books: errors=0`. +- **Root, nested, properties, scalar.** In `01-books.json`, `data.books` has 3 entries in id order. `b1` has + `"published": "1974-05-01"` and `"inStock": true`, `b2` has `"inStock": false`, and every `author.name` matches the data + above. +- **Argument and null result.** `02-book-by-id.json` (variables `{"id": "b3"}`) has + `data.book = {"title": "Use of Weapons", "author": {"id": "a2", "name": "Iain M. Banks"}}` and `data.missing = null`, + with no `errors`. +- **Unused type.** `probe.log` contains `Schema type was defined but can never be accessed, and can be safely deleted: + Review`. `schema.graphqls` has no `type Review`. +- **Missing resolver.** `run bookstore-missing-resolver`. Exit `2`. `summary.txt` + has `schema build: FAILED graphql.kickstart.tools.resolver.FieldResolverError: No method or field found as defined in + schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2`. The 8 listed signatures start with + `graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book)`, have + `graphql.kickstart.tools.compat.scenarios.Book.isbn` sixth, and end with + `graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn()`. `build-error.txt` has the + stack trace. +- **Read-only schema.** `run read-only-schema`. Exit `0` and all three operations + have `errors=0`. `01-interface.json` has `data.animal = {"__typename": "Cat", "name": "Tom", "lives": 9}`, + `02-union.json` lists `Dog` Rex then `Cat` Tom, and `03-no-mutation.json` has `mutationType: null`. `schema.graphqls` + has `directive @tag` and `@tag(name : "public")` on the three `name` fields. Before the #896 fix the build failed with + `AssertException: There must be a type resolver for interface Animal`. + +## Gotchas + +- `bookstore-missing-resolver` loads `bookstore/schema.graphqls` too, so a change that breaks `bookstore` shows up here + first as a different build error. Run `bookstore` first. +- The signature list in the error is in search priority order. A change to resolver lookup order shows up there before + anything fails. +- `schema.graphqls` also lists graphql-java's built-in directives (`@defer`, `@oneOf`, ...). Their presence depends on + the graphql-java version, not on graphql-java-tools. diff --git a/.claude/skills/verify-tools/features/schema-options.md b/.claude/skills/verify-tools/features/schema-options.md new file mode 100644 index 00000000..94674e96 --- /dev/null +++ b/.claude/skills/verify-tools/features/schema-options.md @@ -0,0 +1,21 @@ +# Schema parser options + +`SchemaParserOptions` changes how the schema is built and what clients can see. A `missingResolverDataFetcherProvider` +builds a data fetcher for fields that have no resolver, where the build would otherwise fail. + +## Sub-features + +- `opt-missing-resolver-provider` serves a field that has no resolver method or property from the provider's data fetcher. + +## Expected results + +- **Run.** `run options`. Exit `0`. `summary.txt` has `01-fields: errors=0`. +- **Fields and typename.** `01-fields.json` has `data = {"name": "tools", "unimplemented": "no resolver for + unimplemented", "__typename": "Query"}`. + +## Gotchas + +- The provider doesn't log `Missing resolver for field`. Only `allowUnimplementedResolvers(true)` does, and it also logs + a development-only warning. Don't expect either in `probe.log` for this scenario. +- `missingResolverDataFetcher(...)` is the deprecated predecessor of the provider. Prove changes to it in a separate + scenario so this one stays free of deprecated API. diff --git a/.claude/skills/verify-tools/features/type-extensions.md b/.claude/skills/verify-tools/features/type-extensions.md new file mode 100644 index 00000000..29f876b9 --- /dev/null +++ b/.claude/skills/verify-tools/features/type-extensions.md @@ -0,0 +1,54 @@ +# Type extensions + +`extend type`, `extend interface`, `extend union`, `extend enum`, `extend input` and `extend scalar` add to the type they +extend: fields, interfaces, members, values and directives are merged into one graphql-java type, base first. Where a type +and its extensions declare a field, enum value or union member twice, or apply a non-repeatable directive again, the build +fails with a `SchemaError`. For a field, value or member it names the type, the item and its line. For a directive it names +only the directive and its line, as in `Directive @once at line 1, column 25 isn't repeatable but is applied more than +once.` An extension of a different kind than its type is +ignored with a WARN. A union, enum, interface or scalar that only has extensions is built from them. + +## Sub-features + +- `ext-interface-fields` merges the fields of `extend interface`, keeping the base `id` and its description. +- `ext-implements` makes `extend type Video implements Node` take effect. +- `ext-union-members` merges the members of `extend union`. +- `ext-enum-values` merges the values of `extend enum`, keeping the base description. +- `ext-lone-enum` builds an enum that only has extensions, from all of them. +- `ext-directives` applies the directives of every extension after those of the type. +- `ext-repeats` fails the build on a field, enum value or union member declared twice, or a non-repeatable directive + applied twice, across a type and its extensions. `type-extensions-repeated-fields` shows it for fields, and the + `repeat` and `repeat-directive` cases of `CompatTest` cover every scenario type. +- `ext-other-kind` ignores `extend union Note` of `type Note` with a WARN. +- `ext-sealed` finds the class of a union member added by `extend union`, and of an implementor added by + `extend type X implements Y`, among the subclasses of a sealed class or interface. + +## Expected results + +- **Run.** `run type-extensions`. Exit `0`, and `errors=0` for all three + operations. +- **Fields and implements.** `01-node.json` has `article` with `createdAt = "2026-10-01"` and `title = "We launched"`, and + `video` with `__typename = "Video"` and `seconds = 90`. +- **Members, values, lone enum.** `02-search-and-enums.json` has `search` with an `Article` and a `Video`, + `colors = ["RED", "BLUE", "GREEN"]` and `shades = ["LIGHT", "DARK"]`. +- **Shape.** In `03-introspection.json`, `Node` has fields `id` ("The base id"), `createdAt`, `name`. `Video` has + interfaces `["Node"]`, `SearchResult` has possible types `["Article", "Video"]`, and `Color.RED` has the description + "The first red". +- **Directives.** `schema.graphqls` has `@tag(name : "base") @tag(name : "extension")` on `Node`, `SearchResult`, `Color`, + `Filter` and `Article`, and `Article` has `@owner(team : "content")` once, before its `@tag`s. +- **Warnings.** `probe.log` has `Type 'Note' is defined as an object type, but extended as a union. The extension is + ignored.` and `Schema type was defined but can never be accessed, and can be safely deleted: Note`, and nothing else. +- **Repeated fields.** `run type-extensions-repeated-fields`. Exit `2`, and `summary.txt` has `schema build: FAILED + graphql.kickstart.tools.SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, + column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls.` +- **Sealed.** `run type-extensions-sealed`. Exit `0`. `01-pets-and-animals.json` has + `pets = [{"__typename": "Dog", "name": "Rex"}, {"__typename": "Cat", "lives": 9}]` and `animals` with a `Cow` and a + `Horse`, with no WARN in `probe.log`. + +## Gotchas + +- Before extensions were merged (master before PR #855), `type-extensions` still builds but `01` and `02` return errors: + `Node` loses `createdAt`, `Video` isn't a `Node`, and `BLUE` and `LIGHT` fail to serialize. `type-extensions-sealed` + fails validation with `Unknown type 'Dog'`. Use that as the contrast run, not as a regression in this map. +- graphql-java allows only one `__type` per introspection query, so `03` reads `__schema` instead. +- The `Note` type is unreachable on purpose, so the "can be safely deleted" WARN for it is expected. diff --git a/.claude/skills/verify-tools/probe.sh b/.claude/skills/verify-tools/probe.sh new file mode 100755 index 00000000..285c5e89 --- /dev/null +++ b/.claude/skills/verify-tools/probe.sh @@ -0,0 +1,177 @@ +#!/usr/bin/env bash +set -euo pipefail + +SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO="$(git rev-parse --show-toplevel 2>/dev/null)" || REPO="$(git -C "$SKILL_DIR" rev-parse --show-toplevel)" +ROOT="${TMPDIR:-/tmp}" +ROOT="${ROOT%/}/verify-tools" + +sha256() { if command -v sha256sum > /dev/null; then sha256sum; else shasum -a 256; fi; } + +KEY="$(basename "$REPO")-$(printf '%s' "$REPO" | sha256 | cut -c1-8)" +WORK="$ROOT/work/$KEY" +M2="$WORK/m2" +TAIL_M2="$HOME/.m2/repository" +EVIDENCE_ROOT="$ROOT/evidence" +STAMP="$WORK/installed.stamp" +SCENARIOS="$SKILL_DIR/../../../src/test/kotlin/graphql/kickstart/tools/compat/scenarios" + +die() { echo "probe: $*" >&2; exit 1; } +usage_error() { echo "probe: $*" >&2; exit 64; } + +pom_value() { sed -n "s:.*<$1>\(.*\).*:\1:p" "$REPO/pom.xml" | head -1; } +TOOLS_VERSION="$(pom_value version)" +KOTLIN_VERSION="$(pom_value kotlin.version)" + +fingerprint() { + { + git -C "$REPO" rev-parse HEAD + git -C "$REPO" diff HEAD -- pom.xml src + git -C "$REPO" ls-files --others --exclude-standard -- src | while IFS= read -r file; do + echo "$file" + cat "$REPO/$file" + done + } | sha256 | cut -c1-16 +} + +installed_jar() { echo "$M2/io/github/graphql-java-kickstart/graphql-java-tools/$TOOLS_VERSION/graphql-java-tools-$TOOLS_VERSION.jar"; } + +install_state() { + if [[ ! -f "$STAMP" || ! -f "$(installed_jar)" ]]; then echo missing + elif [[ "$(cat "$STAMP")" == "$(fingerprint)" ]]; then echo fresh + else echo stale + fi +} + +lock() { + mkdir -p "$WORK" + if ! mkdir "$WORK/lock" 2>/dev/null; then + local pid + pid="$(cat "$WORK/lock/pid" 2>/dev/null || true)" + if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then + die "another probe run (pid $pid) is using $WORK; wait for it instead of sharing the work dir" + fi + rm -rf "$WORK/lock" + mkdir "$WORK/lock" + fi + echo $$ > "$WORK/lock/pid" + trap 'rm -rf "$WORK/lock"' EXIT +} + +mvn_isolated() { + mvn -B "-Dmaven.repo.local=$M2" "-Dmaven.repo.local.tail=$TAIL_M2" "$@" +} + +cmd_install() { + local fp log + fp="$(fingerprint)" + log="$WORK/install.log" + echo "probe: installing $TOOLS_VERSION from $REPO into $M2 (log: $log)" + if ! (cd "$REPO" && mvn_isolated clean install -DskipTests > "$log" 2>&1); then + grep -E '^\[ERROR\]' "$log" | head -30 >&2 || true + die "install failed, see $log" + fi + echo "$fp" > "$STAMP" + echo "probe: installed $(installed_jar)" +} + +cmd_doctor() { + local state lock_state="free" + state="$(install_state)" + if [[ -f "$WORK/lock/pid" ]] && kill -0 "$(cat "$WORK/lock/pid")" 2>/dev/null; then + lock_state="held by pid $(cat "$WORK/lock/pid")" + fi + echo "checkout: $REPO" + echo "branch: $(git -C "$REPO" rev-parse --abbrev-ref HEAD) @ $(git -C "$REPO" rev-parse --short HEAD)" + echo "tools version: $TOOLS_VERSION (kotlin $KOTLIN_VERSION)" + echo "work dir: $WORK" + echo "install: $state ($(installed_jar))" + echo "lock: $lock_state" + echo "evidence: $EVIDENCE_ROOT" + echo "java: $(java -version 2>&1 | head -1)" + echo "maven: $(mvn -v 2>/dev/null | head -1)" + [[ -d "$TAIL_M2" ]] || echo "WARNING: $TAIL_M2 does not exist, every dependency will be downloaded into the work dir" + [[ "$state" == "fresh" ]] || echo "note: run installs the checkout first because the install is $state" +} + +cmd_list() { + grep -h 'override val name = ' "$SCENARIOS"/*.kt | sed 's/.*= "\(.*\)"/\1/' +} + +cmd_run() { + local scenario="" gj="" skip_install=false + while [[ $# -gt 0 ]]; do + case "$1" in + --graphql-java) gj="$2"; shift 2 ;; + --skip-install) skip_install=true; shift ;; + -*) usage_error "unknown option $1" ;; + *) [[ -z "$scenario" ]] || usage_error "one scenario per run"; scenario="$1"; shift ;; + esac + done + [[ -n "$scenario" ]] || usage_error "usage: probe.sh run [--graphql-java VERSION] [--skip-install]" + cmd_list | grep -qx "$scenario" || usage_error "unknown scenario '$scenario', known: $(cmd_list | tr '\n' ' ')" + + lock + local state + state="$(install_state)" + if [[ "$state" != "fresh" ]]; then + if [[ "$skip_install" == true && "$state" == "stale" ]]; then + echo "probe: WARNING install is stale, running against the previously installed jar" + else + cmd_install + fi + fi + + local evidence base n=1 build mvn_args=() exit_code + base="$EVIDENCE_ROOT/$(date +%Y%m%d-%H%M%S)-$scenario${gj:+-gj$gj}" + evidence=$base + build="$WORK/probe-target${gj:+-gj$gj}" + mkdir -p "$EVIDENCE_ROOT" + until mkdir "$evidence" 2>/dev/null; do + n=$((n + 1)) + evidence="$base-$n" + done + mvn_args=(-f "$SKILL_DIR/probe/pom.xml" "-Dtools.version=$TOOLS_VERSION" "-Dkotlin.version=$KOTLIN_VERSION" + "-Dprobe.build.dir=$build" "-Dmdep.outputFile=$build/classpath.txt") + [[ -z "$gj" ]] || mvn_args+=("-Dgraphql-java.version=$gj") + # resources:resources only copies, so an operation deleted from a scenario would keep running + rm -rf "$build"/classes/compat/scenarios/*/ + if ! mvn_isolated "${mvn_args[@]}" compile dependency:build-classpath > "$evidence/maven.log" 2>&1; then + grep -E '^\[ERROR\]|^e: ' "$evidence/maven.log" | head -30 >&2 || true + die "probe compile failed, see $evidence/maven.log" + fi + + { + echo "checkout: $REPO" + echo "commit: $(git -C "$REPO" rev-parse HEAD)" + echo "source fingerprint: $(fingerprint)" + echo "install stamp: $(cat "$STAMP")" + echo "command: probe.sh run $scenario${gj:+ --graphql-java $gj}" + } > "$evidence/run.txt" + + set +e + java "-Dprobe.out=$evidence" -cp "$build/classes:$(cat "$build/classpath.txt")" probe.MainKt "$scenario" "$evidence" \ + 2> "$evidence/stderr.txt" | tee "$evidence/stdout.txt" + exit_code="${PIPESTATUS[0]}" + set -e + echo "exit code: $exit_code" >> "$evidence/run.txt" + echo "probe: exit $exit_code, evidence in $evidence" + return "$exit_code" +} + +cmd_clean() { + if [[ -f "$WORK/lock/pid" ]] && kill -0 "$(cat "$WORK/lock/pid")" 2>/dev/null; then + die "a probe run (pid $(cat "$WORK/lock/pid")) is still using $WORK" + fi + rm -rf "$WORK" + echo "probe: removed $WORK; evidence kept in $EVIDENCE_ROOT" +} + +case "${1:-}" in + install) lock; cmd_install ;; + doctor) cmd_doctor ;; + list) cmd_list ;; + run) shift; cmd_run "$@" ;; + clean) cmd_clean ;; + *) usage_error "usage: probe.sh {doctor|list|install|run [--graphql-java VERSION] [--skip-install]|clean}" ;; +esac diff --git a/.claude/skills/verify-tools/probe/pom.xml b/.claude/skills/verify-tools/probe/pom.xml new file mode 100644 index 00000000..dbb14762 --- /dev/null +++ b/.claude/skills/verify-tools/probe/pom.xml @@ -0,0 +1,107 @@ + + + 4.0.0 + + verify + graphql-java-tools-probe + 0 + + + UTF-8 + UNSET + 2.3.10 + ${project.basedir}/target + ${project.basedir}/../../../.. + + + + + io.github.graphql-java-kickstart + graphql-java-tools + ${tools.version} + + + com.fasterxml.jackson.core + jackson-databind + 2.22.4 + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + org.springframework + spring-aop + 5.3.39 + + + ch.qos.logback + logback-classic + 1.6.5 + + + + + + graphql-java-override + + + graphql-java.version + + + + + + com.graphql-java + graphql-java + ${graphql-java.version} + + + + + + + + ${probe.build.dir} + src/main/kotlin + + + src/main/resources + + + ${checkout.dir}/src/test/resources + + compat/scenarios/** + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + 11 + + src/main/kotlin + ${checkout.dir}/src/test/kotlin/graphql/kickstart/tools/compat/scenarios + + + + + compile + + compile + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.8.1 + + + + diff --git a/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt new file mode 100644 index 00000000..f010a78a --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/kotlin/probe/Main.kt @@ -0,0 +1,116 @@ +package probe + +import com.fasterxml.jackson.core.type.TypeReference +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.SerializationFeature +import graphql.ExecutionInput +import graphql.ExecutionResult +import graphql.GraphQL +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.compat.scenarios.SCENARIOS +import graphql.kickstart.tools.compat.scenarios.parser +import graphql.schema.GraphQLSchema +import graphql.schema.idl.SchemaPrinter +import org.reactivestreams.Publisher +import org.reactivestreams.Subscriber +import org.reactivestreams.Subscription +import java.io.File +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import kotlin.system.exitProcess + +fun main(args: Array) { + if (args.size != 2) usage("expected ") + val scenario = SCENARIOS.find { it.name == args[0] } ?: usage("unknown scenario '${args[0]}'") + val out = File(args[1]).apply { mkdirs() } + val summary = StringBuilder() + fun report(line: String) { + println(line) + summary.appendLine(line) + } + + report("scenario: ${scenario.name}") + report("graphql-java-tools jar: ${jarOf(SchemaParser::class.java)}") + report("graphql-java jar: ${jarOf(GraphQL::class.java)}") + report("java: ${System.getProperty("java.version")}") + + val schema: GraphQLSchema + try { + val parser = scenario.parser().build() + schema = scenario.schema(parser) + val unused = parser.getUnusedDefinitions().map { it.name }.sorted() + if (unused.isNotEmpty()) report("unused definitions: ${unused.joinToString()}") + } catch (e: Throwable) { + File(out, "build-error.txt").writeText(e.stackTraceToString()) + report("schema build: FAILED ${e.javaClass.name}: ${e.message}") + File(out, "summary.txt").writeText(summary.toString()) + exitProcess(2) + } + File(out, "schema.graphqls").writeText(SchemaPrinter().print(schema)) + scenario.inspect(schema)?.let { File(out, "inspect.txt").writeText(it) } + report("schema build: OK") + + val graphQL = scenario.graphQL(GraphQL.newGraphQL(schema)).build() + for (operation in operationFiles(scenario.operations)) { + val name = operation.nameWithoutExtension + val variablesFile = File(operation.parentFile, "$name.variables.json") + val variables = if (variablesFile.exists()) json.readValue(variablesFile, object : TypeReference>() {}) else emptyMap() + val input = scenario.input(ExecutionInput.newExecutionInput().query(operation.readText()).variables(variables)).build() + + val result = try { + graphQL.execute(input) + } catch (e: Throwable) { + File(out, "$name.json").writeText(json.writeValueAsString(mapOf("threw" to e.toString()))) + report("operation $name: THREW $e") + continue + } + val publisher = result.getData() as? Publisher<*> + val written = LinkedHashMap() + var eventCount = "" + if (publisher != null) { + val events = collect(publisher) + written["events"] = events + result.toSpecification()["errors"]?.let { written["errors"] = it } + eventCount = " events=${events.size}" + } else { + written.putAll(result.toSpecification()) + } + File(out, "$name.json").writeText(json.writeValueAsString(written)) + report("operation $name: errors=${result.errors.size}$eventCount") + result.errors.forEach { report(" error: ${it.message}") } + } + File(out, "summary.txt").writeText(summary.toString()) +} + +private val json = ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT) + +private fun usage(problem: String): Nothing { + System.err.println("$problem\nusage: probe \nscenarios: ${SCENARIOS.joinToString { it.name }}") + exitProcess(64) +} + +private fun jarOf(clazz: Class<*>) = clazz.protectionDomain.codeSource?.location?.path ?: "unknown" + +private fun operationFiles(scenario: String): List { + val dir = Thread.currentThread().contextClassLoader.getResource("compat/scenarios/$scenario") + ?: return emptyList() + return File(dir.toURI()).listFiles { file -> file.extension == "graphql" }!!.sortedBy { it.name } +} + +private fun collect(publisher: Publisher<*>): List> { + val events = mutableListOf>() + val done = CountDownLatch(1) + publisher.subscribe(object : Subscriber { + override fun onSubscribe(subscription: Subscription) = subscription.request(Long.MAX_VALUE) + override fun onNext(event: Any?) { + synchronized(events) { events.add((event as ExecutionResult).toSpecification()) } + } + override fun onError(error: Throwable) { + synchronized(events) { events.add(mapOf("publisherError" to error.toString())) } + done.countDown() + } + override fun onComplete() = done.countDown() + }) + if (!done.await(10, TimeUnit.SECONDS)) println(" subscription did not complete within 10 seconds") + return synchronized(events) { events.toList() } +} diff --git a/.claude/skills/verify-tools/probe/src/main/resources/logback.xml b/.claude/skills/verify-tools/probe/src/main/resources/logback.xml new file mode 100644 index 00000000..d8728fbf --- /dev/null +++ b/.claude/skills/verify-tools/probe/src/main/resources/logback.xml @@ -0,0 +1,21 @@ + + + ${probe.out}/probe.log + false + + %-5level %logger{36} - %msg%n + + + + System.err + + %-5level %logger{36} - %msg%n + + + + + + + + + diff --git a/.gitignore b/.gitignore index 5b53fe18..e6539ff9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,8 @@ target/ pom.xml.releaseBackup release.properties +.mvn/jvm.config +.local/ +CLAUDE.local.md +.claude/settings.local.json +.claude/worktrees/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..f9b640e8 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,131 @@ +# graphql-java-tools + +Open-source library (`io.github.graphql-java-kickstart:graphql-java-tools`) that builds a graphql-java schema from GraphQL SDL and +resolver classes. Published to Maven Central. Kotlin, with a few Java files, targeting Java 17. + +## Layout + +- `src/main/kotlin/graphql/kickstart/tools`: `SchemaParser` and its builder and options, `MergedDefinitions.kt` (merges each + SDL type with its extensions into a `MergedType`. Other code, apart from the Relay factory, reads SDL types only through + it), `SchemaClassScanner` (matches schema types to classes), `resolver/` (`ResolverPlan.kt` finds the Java member behind each field and builds its data fetcher, `TypeShape.kt` walks + declared types and unwraps values, `ArgumentConverter.kt` converts arguments), `directive/`, + `relay/`, `proxy/` (finds the class behind a Spring, Guice, Weld or Javassist proxied resolver), `util/` +- `src/test/kotlin`: JUnit tests, one class per feature. A test for an issue goes into the class for its feature. + `EndToEndTest` and `EndToEndSpecHelper` hold the shared schema and resolvers +- `.claude/skills/verify-tools`: the probe that checks a change from a consuming app's side + +## Build and test + +```bash +mvn clean verify +``` + +Compiler warnings fail the build. CI runs `mvn verify` on JDK 17, 21 and 25. A newer local JDK can pass code that fails on +17, so run the build on JDK 17 before you push. + +Machine-specific Maven JVM flags go in `.mvn/jvm.config` and personal agent rules go in `CLAUDE.local.md`. Git ignores both. + +## Verifying + +Run the `verify-tools` skill (`.claude/skills/verify-tools/SKILL.md`) before you push any change to how the schema is built. +`mvn verify` runs the library's own tests. The probe builds a schema through the public API only, the way an app does. +Bugfixes and small features stop at this skill. + +## Compatibility + +- Public API changes must stay backwards compatible. Deprecate before removing. +- Invalid input that used to build stays accepted until the next major. Log a WARN that names the type and the item, open a + GitHub issue with the target major in its title (the repo has no milestones), and leave `// TODO in X.0.0 (#N)`. + +## GitHub + +- PRs follow `.github/pull-request-template.md` and the + [contribution guide](https://github.com/graphql-java-kickstart/graphql-java-tools/wiki/Contribution-guide). Open them as ready + for review, not drafts. Reference the issue with `Fixes #N`. +- A follow-up to an open PR goes into that PR as another commit. +- Deferred work and out-of-scope findings become GitHub issues. +- When a PR has release-note material, add it to the PR description. + +## Releases + +Follow the [Releasing a version](https://github.com/graphql-java-kickstart/graphql-java-tools/wiki/Releasing-a-version) wiki +page. `github-build.sh` and `.github/workflows/release.yml` do the version bump, tag and publish. After an X.0.0 release, +delete the `` under japicmp-maven-plugin in `pom.xml`. The version is X.0.1-SNAPSHOT by then and the API check +fails while they remain. + +After the release is published, record what it builds, so `CompatTest` checks later changes against it. Check out the +release tag in a worktree, run `mvn -B -ntp clean test -Dtest=CompatTest -Dcompat.capture`, and open a PR with the +`src/test/resources/compat//` it writes: `cases.tsv` and an empty `accepted.txt`. A later break that the release +notes list goes into that `accepted.txt` as one line: the case as `CompatTest` lists it, a tab, and why, naming the issue +(`#N`) or the release notes (`X.Y.Z release notes`). Start the case with `re:` to give a regex instead, matching at most 20 +cases, all in one scenario. Capturing fails at a `-SNAPSHOT` version, and so does the test while a capture exists for a version +the pom says isn't released yet, because a capture made on a branch hides the branch's breaks. A line that matches +no failing case fails the test. So does a case that built on the release and isn't generated any more, because a scenario +was renamed, removed or edited. Then capture the release again as the failure says, or list the case. + +## Rules that need judgment + +No check can enforce these, so each one names the mistake it prevents. + +- **Build only what was asked.** Don't add support for a case nobody asked for. Ask first. Failure: a PR made the library call + JDK proxied resolver methods through the proxy's interfaces, a shape no user had reported. A later commit replaced that + with a warning at build and deleted 282 lines (`76b67394`). +- **Check every claim in a PR body or release note at the current head.** Re-read the body after each push. A claim about + what users do needs an issue comment or a consumer's code behind it. Failure: a PR body said existing tests already + proved scalars pass through unchanged, and none of them did. +- **Add a variant to the existing test class and its shared fixtures.** Write one test per behavior and cover variants with + a table or a generated matrix, as `NestedGenericWrapperTest` does. Failure: a directive change added a test and + fixtures per variant. A later commit folded five of the failure tests into one `assertSchemaError` test and dropped two + that repeated other tests (`f8c7be76`). +- **Run verify-tools on refactors and warning changes too.** A change called "a refactor" or "only the wording" still + changes what an app's schema build does, and the unit tests don't build through the public API alone. Failure: an agent + skipped the probe on a scanner rewrite because it was a refactor. +- **Keep a comment only for a non-obvious why.** No comment that repeats the code, narrates history, or carries an issue or + PR number outside a TODO. `CommentConventionsTest` catches issue numbers and the history phrases it lists. A comment that + repeats the code, or tells history in other words, gets past it. Failure: a comment explained what `determineType` + returned, which the `namedType` default already showed, and a follow-up commit deleted it (`7448f2c6`). + +## Rule table + +Each rule comes from a mistake made in this repo more than once, mostly by agents and in a few cases by older human code. +The second column names what enforces the rule: a check that fails the build, or code or config that keeps the mistake from +happening. "docs only" means nothing does yet, so the rule depends on you reading it. + +| Rule | Enforced by | +|---|---| +| The value of a resolver method, a field with no matching getter or a typed Map is unwrapped by one rule that the schema build and the data fetcher share | `TypeShape`, whose one walk yields both the class the schema build matches and the layers that `TypeShape.Unwrapper` unwraps in the method, field and Map data fetchers. An untyped Map's values reach graphql-java as they are. A container kind can't be added without its placement rule and its value step, since both are abstract on the enum, and `ReturnValueUnwrappingTest` fails until the bounded check builds values for it | +| A resolver method's parameter layout, type variables and source are decided once, at schema build | `ResolverPlan`, which reads the field's member once and hands the scan its type shapes, the data fetcher its parameters and `UnmappedInputFieldChecker` its argument targets. Its member variants are private to `ResolverPlan.kt`, each decides its `ResolverKind`, and none builds a data fetcher. `ResolverPlan.dataFetcher` gives every member a `ResolverDataFetcher`, a sealed class whose constructor takes the `TypeShape.Unwrapper`, so a lambda or a fetcher without one doesn't compile. A new `ResolverKind` doesn't compile until the lookup's `when` handles it, a new `ExtraParameter` doesn't compile without its binder, the fixture tests in `ResolverCompatibilityTest` fail, naming the fixture to add, until they build a sample of each and see its value unwrapped, and `ReturnValueUnwrappingTest` ends in `MODEL ERROR` until the bounded check runs the new kind. `ResolverOwnershipTest` fails on member reflection outside `ResolverPlan.kt` (`java.lang.reflect` calls and signature reads, `MethodHandles`, `kotlin.reflect.full` and `kotlin.reflect.jvm` calls, `KClass` member lookups, a value typed as a `KFunction` or `KProperty`, and commons-lang3's field and method utilities, apart from the type reads in `ScanDictionary.findInputValueTypeInType(String, Class)`), on a member that depends on a data fetcher, on a library data fetcher that isn't a `ResolverDataFetcher` declared in `ResolverPlan.kt`, and on generic-wrapper or `DataFetcherResult` handling outside `TypeShape.kt`. Its exemptions name the exact classes each owning file declares. It doesn't see `Future`, `CompletionStage` or `Optional` checks outside `TypeShape.kt`, `Class.forName` lookups, `Method.getReturnType`, a `KFunction` held as `Any` and called through a cast, reflection a library does for you (graphql-java's `PropertyDataFetcher`, `java.beans.Expression`), a new helper in an owning file that reflects for another file, or a `DataFetcher { }` lambda outside `ResolverPlan.kt`. The fixture tests and the bounded check catch a value these leave wrapped only in the fetchers `ResolverPlan` builds | +| A change to how resolvers are found, bound or unwrapped keeps what a method, a property and a Map field return | `ResolverCompatibilityTest`, which compares field and Map values with a method's, and the bounded check in `ReturnValueUnwrappingTest`, which compares all three with the plain value. Neither has known findings, so a value that differs on a return type they run fails the build. The bounded check also pins how many return types it generates, and for each kind how many the build rejects and how many executions run, so a change that stops running some fails until the same diff updates `pinnedCoverage`. It doesn't judge whether a newly rejected return type should build | +| One output has one builder. Don't add a second path that builds the same thing | docs only | +| Read an SDL type's members merged with its extensions, never from the raw definition | `MergedType` in `MergedDefinitions.kt` and `DefinitionsBoundaryTest`, which fails on a raw member, directive or child-node read, an extension class, an SDL node walk or a `TypeDefinitionRegistry` call outside it. A read by reflection gets past it. `TypeExtensionTest` builds and queries a schema with an extension of every kind, so a build that leaves an extension's fields, interfaces, members, values, input fields or directives out of the built type fails it, however the code read them | +| Every kind of SDL type starts its graphql-java type from the same recipe | `MergedType.prepare`, `DefinitionsBoundaryTest` and `TypeKindRecipeTest` | +| Reuse an existing structure before you add a parallel one | docs only | +| Argument conversion goes through one entry point | `ArgumentConverter`, which `ResolverPlan` builds once per argument. `ResolverOwnershipTest` fails on a TokenBuffer or a Jackson `readValue`, `readValueAs`, `convertValue`, `updateValue`, `treeToValue` or `valueToTree` outside `ArgumentConverter.kt`, and on an `ArgumentConverter` built or called outside `ResolverPlan.kt`. Jackson's per-call retry for scalars it can't convert stays inside `ArgumentConverter` | +| An input field's Java type comes from the mapping Jackson uses, not from guessed getters | docs only | +| Every recursive walk over the type graph handles cycles, and a test covers a cycle | docs only | +| Public signatures stay binary compatible, data class `copy()` and `componentN` included | japicmp with `build/japicmp-kotlin-public.groovy` at `mvn verify`, which allows excludes and other narrowing options only at an X.0.0 version | +| Remove the plumbing a change leaves unused | Compiler warnings for unused locals, docs only for the rest | +| A new warning or build error names the type and the item and uses `SourceLocation.describe()` for its location | docs only | +| A check keyed on a class name or an exception type has a test that fails when the dependency moves it | docs only | +| Work that depends only on the schema happens at schema build, not on every fetch | docs only | +| Schema build time grows linearly with the schema | docs only | +| A subtype check has a test with a subclass, so an inverted check fails | docs only | +| Directive wirings decide which types become `GraphQLTypeReference` in one place | `TypeReferences` in `DirectiveWiringHelper` | +| An object built once at schema build holds no per-request state | docs only | +| Add a variant to the existing test class and its shared fixtures | docs only | +| Every test class in `src/test` runs, and so do its assertions | surefire's `**/*` include, so a class runs whatever its name, and `failIfNoTests`, which fails a run that executes no tests. The Kotlin test compile's `-Xassertions=always-enable` makes `assert()`, which `TestUtils.assertEquals` uses, run without `-ea`. `-DfailIfNoTests=false` turns the empty-run check off, and a test that asserts nothing still passes | +| A new test fails without the change it guards | docs only | +| A fix keeps every shape that worked on the last release | docs only | +| A test that builds a schema also queries its fields with `assertEveryFieldResolves` | docs only | +| The first commit of a fix tests the neighbouring shapes, not just the reported one | For return values, the bounded check in `ReturnValueUnwrappingTest` at `mvn verify`, which builds every nesting of up to 3 containers around each leaf type, for methods, properties and Map fields. Docs only for other shapes | +| The build passes on JDK 17, the lowest supported version | CI on JDK 17, 21 and 25 | +| Run verify-tools before you push a schema-building change | docs only | +| The packaged jar holds `module-info.class`, its non-static `requires` resolve from the runtime dependencies, and every class targets the pom's `java.version` | `build/JarCheck.java` at `mvn verify` | +| Compiler warnings fail the build | `-Werror` and `failOnWarning` in `pom.xml` | +| Check every claim in a PR body or release note at the current head | docs only | +| Keep a comment only for a non-obvious why, with no history and no issue numbers outside a TODO | `CommentConventionsTest`, which reads each comment block in the `.kt` and `.java` files under `src/main` and `src/test` and fails on an issue number or issue link outside `// TODO in X.0.0 (#N)`, a history phrase from its list, or a version such as `@since` or "since 1.2.0". `lint-allow until YYYY-MM-DD by : ` on the line skips that rule there, for at most 90 days. History in words the list doesn't have, and a comment that repeats the code, are docs only | +| Build only what was asked | docs only | +| A build you trust starts from an empty `target/`, so no class from an earlier build ships | `clean` in `probe.sh install`, docs only for your own `mvn` runs | +| Agent worktrees and local settings stay out of commits | `.gitignore` | +| Agent rules live in one committed file | This file. `CLAUDE.md` imports it | +| Invalid input that built on the last release keeps building until the next major | `CompatTest`, against the last release's results in `src/test/resources/compat` | diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..43c994c2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/build/JarCheck.java b/build/JarCheck.java new file mode 100644 index 00000000..625c166d --- /dev/null +++ b/build/JarCheck.java @@ -0,0 +1,87 @@ +import java.io.DataInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.module.Configuration; +import java.lang.module.FindException; +import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleFinder; +import java.lang.module.ResolutionException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.TreeMap; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +public class JarCheck { + public static void main(String[] args) throws IOException { + Path jar = Path.of(args[0]); + int release = Integer.parseInt(args[1]); + int expectedMajor = release + 44; + String runtimeClasspath = args[2]; + List expectedClasses = Arrays.asList(args).subList(3, args.length); + List problems = new ArrayList<>(); + + TreeMap> byMajor = new TreeMap<>(); + ModuleDescriptor descriptor = null; + try (JarFile jarFile = new JarFile(jar.toFile())) { + for (String expected : expectedClasses) { + if (jarFile.getJarEntry(expected.replace('.', '/') + ".class") == null) { + problems.add("The jar has no " + expected + ". Check in pom.xml: Kotlin and Java sources live in src/main/kotlin."); + } + } + for (JarEntry entry : Collections.list(jarFile.entries())) { + if (!entry.getName().endsWith(".class")) continue; + try (DataInputStream data = new DataInputStream(jarFile.getInputStream(entry))) { + data.readInt(); + data.readUnsignedShort(); + int major = data.readUnsignedShort(); + byMajor.computeIfAbsent(major, k -> new ArrayList<>()).add(entry.getName()); + } + } + JarEntry moduleInfo = jarFile.getJarEntry("module-info.class"); + if (moduleInfo != null) { + try (InputStream in = jarFile.getInputStream(moduleInfo)) { + descriptor = ModuleDescriptor.read(in); + } + } + } + byMajor.forEach((major, classes) -> { + if (major != expectedMajor) { + problems.add(classes.size() + " classes are Java " + (major - 44) + " bytecode (major " + major + "), expected Java " + release + + " (major " + expectedMajor + "), e.g. " + classes.get(0) + + ". Set ${java.version} on kotlin-maven-plugin and ${java.version} on maven-compiler-plugin."); + } + }); + + if (descriptor == null) { + problems.add("The jar has no module-info.class. Keep src/main/kotlin/module-info.java, which maven-compiler-plugin compiles into the jar."); + } else { + List modulePath = new ArrayList<>(); + modulePath.add(jar); + for (String entry : runtimeClasspath.split(File.pathSeparator)) { + if (!entry.isEmpty() && !Path.of(entry).equals(jar)) modulePath.add(Path.of(entry)); + } + try { + Configuration.resolve(ModuleFinder.of(modulePath.toArray(Path[]::new)), List.of(ModuleLayer.boot().configuration()), + ModuleFinder.of(), Set.of(descriptor.name())); + } catch (FindException | ResolutionException e) { + problems.add("A JPMS application with only this jar's compile and runtime dependencies can't start: " + e.getMessage() + + ". A module from a provided or optional dependency must be 'requires static' in module-info.java."); + } + } + + if (!problems.isEmpty()) { + System.err.println("Jar check failed for " + jar.getFileName() + ":"); + problems.forEach(p -> System.err.println(" " + p)); + System.exit(1); + } + int classCount = byMajor.values().stream().mapToInt(List::size).sum(); + System.out.println("Jar check passed for " + jar.getFileName() + ": " + classCount + " classes, all major " + expectedMajor + + ", module " + descriptor.name() + " resolves against the runtime classpath."); + } +} diff --git a/build/japicmp-kotlin-public.groovy b/build/japicmp-kotlin-public.groovy new file mode 100644 index 00000000..c73ffee8 --- /dev/null +++ b/build/japicmp-kotlin-public.groovy @@ -0,0 +1,224 @@ +import javassist.CtBehavior +import javassist.CtClass +import javassist.bytecode.AccessFlag +import javassist.bytecode.AnnotationsAttribute +import javassist.bytecode.InnerClassesAttribute +import javassist.bytecode.annotation.ArrayMemberValue +import javassist.bytecode.annotation.IntegerMemberValue +import javassist.bytecode.annotation.StringMemberValue +import japicmp.model.AccessModifier +import kotlin.metadata.Attributes +import kotlin.metadata.Visibility +import kotlin.metadata.jvm.JvmExtensionsKt +import kotlin.metadata.jvm.JvmMetadataUtil +import kotlin.metadata.jvm.KotlinClassMetadata + +import java.net.JarURLConnection + +// Kotlin compiles internal declarations, lambdas and anonymous objects to public bytecode, and keeps their real visibility +// only in @kotlin.Metadata. It also marks members that compiled callers still link to as synthetic. Compare only what a +// compiled Kotlin or Java caller can link to. + +class ClassSide { + boolean ownApi + String outerName + Set hidden = [] as Set + Set apiMembers = [] as Set +} + +def API = [Visibility.PUBLIC, Visibility.PROTECTED] as Set + +def readMetadata = { CtClass ctClass -> + def ann = ctClass.classFile.getAttribute(AnnotationsAttribute.visibleTag)?.getAnnotation('kotlin.Metadata') + if (ann == null) return null + def value = { String n -> ann.getMemberValue(n) } + def ints = { String n -> value(n) == null ? null : (((ArrayMemberValue) value(n)).value.collect { ((IntegerMemberValue) it).value } as int[]) } + def strs = { String n -> value(n) == null ? null : (((ArrayMemberValue) value(n)).value.collect { ((StringMemberValue) it).value } as String[]) } + def str = { String n -> value(n) == null ? null : ((StringMemberValue) value(n)).value } + def i = { String n -> value(n) == null ? null : ((IntegerMemberValue) value(n)).value } + KotlinClassMetadata.readLenient(JvmMetadataUtil.Metadata(i('k'), ints('mv'), strs('d1'), strs('d2'), str('xs'), str('pn'), i('xi'))) +} + +def outerNameOf = { CtClass ctClass -> + def inner = (InnerClassesAttribute) ctClass.classFile.getAttribute(InnerClassesAttribute.tag) + def index = inner == null ? null : (0.. (accessFlags & AccessFlag.SYNTHETIC) != 0 } + +def classSide = { CtClass ctClass -> + def side = new ClassSide(ownApi: !isSynthetic(ctClass.classFile.accessFlags), outerName: outerNameOf(ctClass)) + def md = readMetadata(ctClass) + if (md == null) return side + if (md instanceof KotlinClassMetadata.SyntheticClass) { + side.ownApi = false + return side + } + def owner = 'L' + ctClass.name.replace('.', '/') + ';' + // A caller that omits a default argument links to the synthetic name$default bridge, or the synthetic constructor + // that takes a DefaultConstructorMarker. + def defaultBridge = { declaration, signature, String receiver, String marker -> + if (!declaration.valueParameters.any { Attributes.getDeclaresDefaultValue(it) }) return null + def masks = 'I' * ((declaration.valueParameters.size() + 31).intdiv(32)) + def params = signature.descriptor.substring(1, signature.descriptor.indexOf(')')) + def name = signature.name == '' ? '' : signature.name + '$default' + name + '(' + receiver + params + masks + marker + signature.descriptor.substring(signature.descriptor.indexOf(')')) + } + def add = { declaration, signature, String bridge = null -> + if (signature == null) return + def api = declaration != null && Attributes.getVisibility(declaration) in API + if (!api) { + side.hidden << signature.name + signature.descriptor + return + } + side.apiMembers << signature.name + signature.descriptor + if (bridge != null) side.apiMembers << bridge + } + def addFunctions = { functions, String receiver -> + functions.each { f -> + def signature = JvmExtensionsKt.getSignature(f) + add(f, signature, signature == null ? null : defaultBridge(f, signature, receiver, 'Ljava/lang/Object;')) + } + } + def addProperties = { properties -> + properties.each { p -> + add(p.getter, JvmExtensionsKt.getGetterSignature(p)) + add(p.setter, JvmExtensionsKt.getSetterSignature(p)) + } + } + if (md instanceof KotlinClassMetadata.Class) { + def km = md.kmClass + addFunctions(km.functions, owner) + addProperties(km.properties) + km.constructors.each { c -> + def signature = JvmExtensionsKt.getSignature(c) + add(c, signature, signature == null ? null : defaultBridge(c, signature, '', 'Lkotlin/jvm/internal/DefaultConstructorMarker;')) + } + side.ownApi = side.ownApi && Attributes.getVisibility(km) in API + } + if (md instanceof KotlinClassMetadata.FileFacade || md instanceof KotlinClassMetadata.MultiFileClassPart) { + addFunctions(md.kmPackage.functions, '') + addProperties(md.kmPackage.properties) + // A file facade holds only top-level declarations, so with none public it has nothing to link to. + side.ownApi = side.ownApi && !side.apiMembers.isEmpty() + } + side +} + +// japicmp passes every class of both jars, filtered only by its options, so no classes means the options filter out the +// whole jar. +if (jApiClasses.isEmpty()) { + throw new IllegalStateException("japicmp-maven-plugin compared no classes, so its or leave out the " + + "whole jar and no break can fail the build. Remove them. A break planned for the next major gets an naming " + + "that member, with the version set to that major's X.0.0-SNAPSHOT.") +} + +// japicmp hands this script only the classes, so the options come from a class and the version from the pom.properties +// maven-jar-plugin puts in the jar under comparison. +def options = jApiClasses.first().@options +def narrowing = [ + '' : options.filters.excludes*.toString().unique(), + '' : options.filters.includes*.toString().unique(), + '': options.overrideCompatibilityChanges.collect { + "${it.compatibilityChange} binaryCompatible=${it.binaryCompatible}" + }, + '' : options.accessModifier == AccessModifier.PROTECTED ? [] : [options.accessModifier.name()], + '' : options.includeSynthetic ? [] : ['false'], +].findAll { name, values -> !values.isEmpty() } +if (!narrowing.isEmpty()) { + def newClass = jApiClasses.find { it.newClass.present }.newClass.get() + def jar = ((JarURLConnection) newClass.classPool.find(newClass.name).openConnection()).jarFile + def pomProperties = new Properties() + pomProperties.load(jar.getInputStream(jar.entries().find { it.name.startsWith('META-INF/maven/') && it.name.endsWith('/pom.properties') })) + def version = pomProperties.getProperty('version') + if (!(version ==~ /\d+\.0\.0(-SNAPSHOT)?/)) { + def major = version.substring(0, version.indexOf('.')) + throw new IllegalStateException("japicmp-maven-plugin narrows the API check at version ${version}, which is not an X.0.0 " + + "version:\n" + narrowing.collect { name, values -> " ${name}: ${values.join(', ')}" }.join('\n') + + "\nOnly a major's X.0.0-SNAPSHOT may narrow it, for the breaks that major plans. If these belong to the ${major}.0.0 " + + "release that just shipped, delete them. Otherwise delete them and keep the old signature as a @Deprecated overload. " + + "In Kotlin, @Deprecated(level = DeprecationLevel.HIDDEN) keeps it for compiled callers only.") + } +} + +def info = jApiClasses.collectEntries { c -> + [c.fullyQualifiedName, [old: c.oldClass.map { classSide(it) }.orElse(null), new: c.newClass.map { classSide(it) }.orElse(null)]] +} +// japicmp leaves out classes that aren't public in bytecode, such as a private Kotlin class, so a class whose outer class +// is missing here is nested in one of those. +def isApiOn +isApiOn = { String name, String sideName -> + def side = info[name]?.get(sideName) + side != null && side.ownApi && (side.outerName == null || isApiOn(side.outerName, sideName)) +} +def isApiClass = { String name -> ['old', 'new'].any { isApiOn(name, it) } } + +def memberApiOn = { ClassSide side, String signature, int accessFlags -> + !(signature in side.hidden) && (!isSynthetic(accessFlags) || signature in side.apiMembers) +} +def behaviorApiOn = { ClassSide side, CtBehavior b -> memberApiOn(side, b.methodInfo.name + b.methodInfo.descriptor, b.methodInfo.accessFlags) } +def isApiBehavior = { d, Optional oldB, Optional newB -> + oldB.map { behaviorApiOn(d.old, it) }.orElse(false) || newB.map { behaviorApiOn(d.new, it) }.orElse(false) +} +def isApiField = { f -> + f.oldFieldOptional.map { !isSynthetic(it.fieldInfo2.accessFlags) }.orElse(false) || + f.newFieldOptional.map { !isSynthetic(it.fieldInfo2.accessFlags) }.orElse(false) +} + +// japicmp ignores the list this script returns and reads the one it passed in, so edit that one in place. +def nonApiClass = { !isApiClass(it.fullyQualifiedName) } +def droppedClasses = jApiClasses.count(nonApiClass) +jApiClasses.removeIf(nonApiClass) +def droppedMembers = 0 +jApiClasses.each { c -> + def d = info[c.fullyQualifiedName] + def nonApiMethod = { !isApiBehavior(d, it.oldMethod, it.newMethod) } + def nonApiConstructor = { !isApiBehavior(d, it.oldConstructor, it.newConstructor) } + def nonApiField = { !isApiField(it) } + droppedMembers += c.methods.count(nonApiMethod) + c.constructors.count(nonApiConstructor) + c.fields.count(nonApiField) + c.methods.removeIf(nonApiMethod) + c.constructors.removeIf(nonApiConstructor) + c.fields.removeIf(nonApiField) +} +println "[japicmp-kotlin-public] dropped ${droppedClasses} non-API classes and ${droppedMembers} non-API members" + +def breaking = { element -> element.compatibilityChanges.findAll { !it.binaryCompatible }*.type } +def isDataClass = { CtClass ct -> + def md = ct == null ? null : readMetadata(ct) + md instanceof KotlinClassMetadata.Class && Attributes.isData(md.kmClass) +} +def problems = [] +info.each { name, d -> + if (isApiOn(name, 'old') && d.new != null && !d.new.ownApi) problems << " ${name}: public in the last release, now internal or private in Kotlin" +} +jApiClasses.each { c -> + def name = c.fullyQualifiedName + def simpleName = name.substring(name.lastIndexOf('.') + 1) + def lines = [] + breaking(c).each { lines << " ${name}: ${it}" } + breaking(c.superclass).each { lines << " ${name} superclass: ${it}" } + c.interfaces.each { i -> breaking(i).each { lines << " ${name} implements ${i.fullyQualifiedName}: ${it}" } } + c.constructors.each { m -> breaking(m).each { lines << " ${name}#${simpleName}(${m.parameters*.type.join(', ')}): ${it}" } } + c.methods.each { m -> breaking(m).each { lines << " ${name}#${m.name}(${m.parameters*.type.join(', ')}): ${it}" } } + c.fields.each { f -> breaking(f).each { lines << " ${name}#${f.name}: ${it}" } } + if (lines.isEmpty()) return + problems.addAll(lines) + if (isDataClass(c.oldClass.orElse(null)) && c.methods.any { it.name.startsWith('copy') && !breaking(it).isEmpty() }) { + problems << " -> ${name} is a Kotlin data class, so a new or changed property changes its constructor and copy() for " + + "compiled callers. Keep the old copy() as a @Deprecated(level = DeprecationLevel.HIDDEN) overload with the same " + + "default arguments that forwards to the new one, and keep the old constructor with @JvmOverloads or a secondary constructor." + } else if (lines.any { it.contains('$default(') || it.contains('kotlin.jvm.internal.DefaultConstructorMarker)') }) { + problems << " -> A name\$default method or a constructor ending in DefaultConstructorMarker is what Kotlin callers link to when " + + "they leave out a default argument. Keep the default argument. If the parameters changed, keep the old signature as a " + + "@Deprecated(level = DeprecationLevel.HIDDEN) overload with the same default arguments." + } +} +if (!problems.isEmpty()) { + throw new IllegalStateException("Binary-incompatible change to the public API since the last release:\n" + problems.join('\n') + + "\nCode compiled against the last release fails with NoSuchMethodError or a similar linkage error. Keep the old signature " + + "as a @Deprecated overload. In Kotlin, @Deprecated(level = DeprecationLevel.HIDDEN) keeps it for compiled callers only. " + + "If the break is planned for the next major, set the version in pom.xml to that major's X.0.0-SNAPSHOT and add the text " + + "before the colon as an under of japicmp-maven-plugin, with a TODO comment naming that major.") +} +jApiClasses diff --git a/pom.xml b/pom.xml index ffb7394a..06adcd74 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,7 @@ 26.1 1.0.4 + true false github @@ -84,6 +85,11 @@ + + com.tngtech.archunit + archunit + 1.5.1 + ch.qos.logback logback-classic @@ -180,6 +186,11 @@ + + com.tngtech.archunit + archunit + test + ch.qos.logback logback-classic @@ -218,6 +229,16 @@ -Werror + + + default-test-compile + + + -Xassertions=always-enable + + + + @@ -234,17 +255,9 @@ org.apache.maven.plugins maven-surefire-plugin 3.6.1 - - - - org.apache.maven.surefire - surefire-junit4 - 3.5.6 - - - **/*Test.* + **/* @@ -258,6 +271,11 @@ test-jar + + + logback-test.xml + + @@ -281,6 +299,83 @@ + + + org.apache.maven.plugins + maven-antrun-plugin + 3.2.0 + + + check-jar + verify + + run + + + + + + + + + + + + + + + + + + + + + + + + + + com.github.siom79.japicmp + japicmp-maven-plugin + 0.26.5 + + + \d+\.\d+\.\d+ + false + true + + true + true + + true + true + true + ${project.basedir}/build/japicmp-kotlin-public.groovy + + + + + org.jetbrains.kotlin + kotlin-metadata-jvm + ${kotlin.version} + + + + org.apache.groovy + groovy-jsr223 + 4.0.33 + + + + + verify + + cmp + + + + org.sonatype.central central-publishing-maven-plugin diff --git a/src/main/kotlin/graphql/kickstart/tools/DictionaryTypeResolver.kt b/src/main/kotlin/graphql/kickstart/tools/DictionaryTypeResolver.kt index 40a52802..4faff924 100644 --- a/src/main/kotlin/graphql/kickstart/tools/DictionaryTypeResolver.kt +++ b/src/main/kotlin/graphql/kickstart/tools/DictionaryTypeResolver.kt @@ -3,7 +3,6 @@ package graphql.kickstart.tools import graphql.TypeResolutionEnvironment import graphql.kickstart.tools.util.JavaType import graphql.kickstart.tools.util.unwrap -import graphql.language.TypeDefinition import graphql.schema.GraphQLInterfaceType import graphql.schema.GraphQLObjectType import graphql.schema.GraphQLUnionType @@ -14,7 +13,7 @@ import java.lang.reflect.ParameterizedType * @author Andrew Potter */ internal abstract class DictionaryTypeResolver( - private val dictionary: Map> + private val dictionary: Map> ) : TypeResolver { // Raw class of each parameterized entry, e.g. Box for Box, unless several entries share it private val rawClassDictionary by lazy { @@ -25,7 +24,7 @@ internal abstract class DictionaryTypeResolver( .toMap() } - private fun getTypeDefinition(clazz: Class): TypeDefinition<*>? { + private fun getTypeDefinition(clazz: Class): MergedType<*>? { return dictionary[clazz] ?: (if (clazz.superclass == null) null else getTypeDefinition(clazz.superclass)) ?: clazz.interfaces.mapNotNull { getTypeDefinition(it) }.firstOrNull() @@ -45,7 +44,7 @@ internal abstract class DictionaryTypeResolver( } internal class InterfaceTypeResolver( - dictionary: Map>, + dictionary: Map>, private val thisInterface: GraphQLInterfaceType ) : DictionaryTypeResolver( dictionary @@ -54,7 +53,7 @@ internal class InterfaceTypeResolver( } internal class UnionTypeResolver( - dictionary: Map>, + dictionary: Map>, private val thisUnion: GraphQLUnionType ) : DictionaryTypeResolver( dictionary diff --git a/src/main/kotlin/graphql/kickstart/tools/GenericTypeResolver.kt b/src/main/kotlin/graphql/kickstart/tools/GenericTypeResolver.kt deleted file mode 100644 index 4ad02eb8..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/GenericTypeResolver.kt +++ /dev/null @@ -1,97 +0,0 @@ -package graphql.kickstart.tools - -import com.fasterxml.classmate.ResolvedType -import graphql.kickstart.tools.util.JavaType -import graphql.kickstart.tools.util.ParameterizedTypeImpl -import graphql.kickstart.tools.util.Primitives -import org.apache.commons.lang3.reflect.TypeUtils -import java.lang.reflect.ParameterizedType -import java.lang.reflect.TypeVariable -import java.lang.reflect.WildcardType - -/** - * @author Andrew Potter - */ -internal class GenericTypeResolver(private val containingType: JavaType, private val options: SchemaParserOptions) { - - fun getRawClass() = getRawClass(containingType) - - fun getRawClass(type: JavaType): Class<*> = TypeUtils.getRawType(type, containingType) - - fun isAssignableFrom(type: JavaType) = TypeUtils.isAssignable(type, containingType) - - /** - * Turns a type as declared in the source (a method's return or parameter type, or a field's type) into the type - * the GraphQL type is matched against: - * - type variables are resolved relative to the containing type, - * e.g. `T` of `AbstractItem.getId()` becomes `Long` for `class Item : AbstractItem()` - * - generic wrappers are replaced by their wrapped type, e.g. `CompletableFuture` becomes `Foo` - * - wildcards are replaced by their upper bound, e.g. `? extends Foo` becomes `Foo` - * - primitives are replaced by their boxed class, e.g. `int` becomes `Integer` - */ - fun resolve(javaType: JavaType, onUnwrap: ((SchemaParserOptions.GenericWrapper) -> Unit)? = null): JavaType { - return when (val type = resolveTypeVariables(javaType)) { - is ParameterizedType -> { - val rawType = type.rawType - val wrapper = options.genericWrappers.find { it.type == rawType } - ?: return type - - val typeArguments = type.actualTypeArguments - if (typeArguments.size <= wrapper.index) { - throw IndexOutOfBoundsException("Generic type '${TypeUtils.toString(type)}' does not have a type argument at index ${wrapper.index}!") - } - - onUnwrap?.invoke(wrapper) - val unwrapsTo = wrapper.schemaWrapper.invoke(typeArguments[wrapper.index]) - resolve(unwrapsTo, onUnwrap) - } - is TypeVariable<*> -> error("Could not resolve type variable '${TypeUtils.toLongString(type)}' relative to ${TypeUtils.toString(containingType)}") - // Kotlin reflection gives a suspend function returning List the type List when Foo is open. - // A type variable bound stays as it is, since a method's own variable can't be resolved and a scalar doesn't need it - is WildcardType -> when (val bound = type.upperBounds.firstOrNull() ?: error("Unable to unwrap type, wildcard has no upper bound: $type")) { - is ParameterizedType -> resolve(bound, onUnwrap) - else -> bound - } - is Class<*> -> if (type.isPrimitive) Primitives.wrap(type) else type - else -> error("Unable to unwrap type: $type") - } - } - - fun resolveTypeVariables(type: JavaType, resolving: Set> = emptySet()): JavaType { - return when (type) { - is ParameterizedType -> { - val actualTypeArguments = type.actualTypeArguments.map { resolveTypeVariables(it, resolving) }.toTypedArray() - ParameterizedTypeImpl(type.rawType as Class<*>, actualTypeArguments, type.ownerType?.let { resolveTypeVariables(it, resolving) }) - } - is WildcardType -> TypeUtils.wildcardType() - .withUpperBounds(*type.upperBounds.map { resolveTypeVariables(it, resolving) }.toTypedArray()) - .withLowerBounds(*type.lowerBounds.map { resolveTypeVariables(it, resolving) }.toTypedArray()) - .build() - is ResolvedType -> { - if (type.typeParameters.isEmpty()) { - type.erasedType - } else { - val actualTypeArguments = type.typeParameters.map { resolveTypeVariables(it) }.toTypedArray() - ParameterizedTypeImpl(type.erasedType, actualTypeArguments, null) - } - } - is TypeVariable<*> -> { - val genericDeclaration = type.genericDeclaration - when { - // only a variable leaked from a raw type can be bound to a type containing itself (e.g. T -> List), - // erase it like the raw type does instead of expanding it forever - type in resolving -> TypeUtils.getRawType(type.bounds.first(), null) ?: Any::class.java - // the containing type binds the variables of all its supertypes - genericDeclaration is Class<*> -> generateSequence(containingType) { (it as? ParameterizedType)?.ownerType } - // an inner class can also use the variables of its outer class, those are bound by its owner type (e.g. Connection.Entry) - .firstNotNullOfOrNull { TypeUtils.getTypeArguments(it, genericDeclaration)?.get(type) } - // keep the full type argument (e.g. List) rather than its raw class so nested generics aren't lost - ?.let { resolveTypeVariables(it, resolving + type) } - ?: type - else -> type - } - } - else -> type - } - } -} diff --git a/src/main/kotlin/graphql/kickstart/tools/MergedDefinitions.kt b/src/main/kotlin/graphql/kickstart/tools/MergedDefinitions.kt new file mode 100644 index 00000000..1cce7227 --- /dev/null +++ b/src/main/kotlin/graphql/kickstart/tools/MergedDefinitions.kt @@ -0,0 +1,229 @@ +package graphql.kickstart.tools + +import graphql.Directives +import graphql.introspection.Introspection.DirectiveLocation +import graphql.kickstart.tools.util.describe +import graphql.kickstart.tools.util.getDocumentation +import graphql.kickstart.tools.util.unwrap +import graphql.language.* +import graphql.schema.* +import graphql.schema.idl.ScalarInfo + +internal class MergedDefinitions(definitions: List>) { + val directiveDefinitions: List = definitions.filterIsInstance() + val rootInfo: RootTypeInfo = RootTypeInfo.fromSchemaDefinitions(definitions.filterIsInstance()) + + val scalarNames: Set = ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS.keys + definitions.filterIsInstance().map { it.name } + + private val typeDefinitions = definitions.filterIsInstance>() + private val baseTypeNames = typeDefinitions.filter { it !is SDLExtensionDefinition }.map { it.name }.toSet() + + private val loneExtensions = typeDefinitions + .filter { it is SDLExtensionDefinition && it !is ObjectTypeDefinition && it !is InputObjectTypeDefinition && it.name !in baseTypeNames } + .distinctBy { it.name } + .toSet() + + private val sources = typeDefinitions.filter { it !is SDLExtensionDefinition || it in loneExtensions } + + private val sourcesByName = sources.associateBy { it.name } + + private val extensionsByName = typeDefinitions + .filter { it is SDLExtensionDefinition && it !in loneExtensions && !extendsOtherKind(it) } + .groupBy { it.name } + + private val typesBySource: List, MergedType<*>>> = sources.mapNotNull { source -> merge(source)?.let { source to it } } + + private val specificationScalars: List> = ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS.values.map { definition -> + definition to MergedType.Scalar(definition, extensionsByName[definition.name].orEmpty().filterIsInstance()) + } + + private val specificationScalarsByName: Map = specificationScalars.associate { (_, type) -> type.name to type } + + private val sourceOf: Map, TypeDefinition<*>> = (typesBySource + specificationScalars).associate { (source, type) -> type to source } + + val byName: Map> = typesBySource.associate { (_, type) -> type.name to type } + + val objectsWithRepeats: List = typesBySource.map { it.second }.filterIsInstance() + + val ignoredExtensionWarnings: List = typeDefinitions.filter(::extendsOtherKind).map { extension -> + "Type '${extension.name}' is defined as ${sourcesByName.getValue(extension.name).kind()}, but extended as ${extension.kind()}. The extension is ignored." + } + + fun resolve(name: String?): MergedType<*>? = specificationScalarsByName[name] ?: byName[name] + + fun definitionsOf(types: Set>): Set> = types.mapNotNullTo(linkedSetOf()) { sourceOf[it] } + + fun findUsage(reference: TypeName, types: Collection>): String? = + (types.mapNotNull { sourceOf[it] } + directiveDefinitions + extensionsByName.values.flatten()).asSequence().flatMap { definition -> + when (definition) { + is ObjectTypeDefinition -> fieldUsages(definition.name, definition.fieldDefinitions) + is InterfaceTypeDefinition -> fieldUsages(definition.name, definition.fieldDefinitions) + is InputObjectTypeDefinition -> definition.inputValueDefinitions.map { "input field '${definition.name}.${it.name}'" to it.type } + is DirectiveDefinition -> definition.inputValueDefinitions.map { "argument '${it.name}' of directive '@${definition.name}'" to it.type } + else -> emptyList() + } + }.find { (_, type) -> type.unwrap() === reference }?.first + + private fun fieldUsages(typeName: String, fields: List): List>> = fields.flatMap { field -> + listOf("field '$typeName.${field.name}'" to field.type) + + field.inputValueDefinitions.map { "argument '${it.name}' of field '$typeName.${field.name}'" to it.type } + } + + private fun merge(source: TypeDefinition<*>): MergedType<*>? { + val extensions = extensionsByName[source.name].orEmpty() + return when (source) { + is ObjectTypeDefinition -> MergedType.Object(source, extensions.filterIsInstance()) + is InterfaceTypeDefinition -> MergedType.Interface(source, extensions.filterIsInstance()) + is UnionTypeDefinition -> MergedType.Union(source, extensions.filterIsInstance()) + is EnumTypeDefinition -> MergedType.Enum(source, extensions.filterIsInstance()) + is InputObjectTypeDefinition -> MergedType.Input(source, extensions.filterIsInstance()) + is ScalarTypeDefinition -> MergedType.Scalar(source, extensions.filterIsInstance()) + else -> null + } + } + + private fun extendsOtherKind(definition: TypeDefinition<*>): Boolean { + val type = sourcesByName[definition.name] + return definition is SDLExtensionDefinition && type != null && type.kind() != definition.kind() + } +} + +private fun TypeDefinition<*>.kind(): String = when (this) { + is ObjectTypeDefinition -> "an object type" + is InterfaceTypeDefinition -> "an interface" + is UnionTypeDefinition -> "a union" + is EnumTypeDefinition -> "an enum" + is InputObjectTypeDefinition -> "an input object type" + is ScalarTypeDefinition -> "a scalar" + else -> javaClass.simpleName +} + +internal class TypeBuildContext( + val options: SchemaParserOptions, + val directives: SdlDirectives, + val customScalars: CustomScalarMap, +) + +internal sealed class MergedType>( + private val definition: TypeDefinition<*>, + extensions: List>, +) { + val name: String get() = definition.name + + val definitionClassName: String get() = definition.javaClass.simpleName + + val kindPhrase: String get() = definition.kind() + + protected val directives: List = definition.directives + extensions.flatMap { it.directives } + + protected abstract val location: DirectiveLocation + + protected abstract val declarations: List> + + protected abstract fun newBuilder(context: TypeBuildContext): B + + fun prepare(context: TypeBuildContext): B { + rejectRepeated() + val builder = newBuilder(context).name(name) + getDocumentation(definition as AbstractNode<*>, context.options)?.let { builder.description(it) } + return with(context.directives) { builder.withSdlDirectives(directives, location) } + } + + private fun rejectRepeated() { + val noun = when (this) { + is Object, is Interface, is Input -> "field" + is Enum -> "value" + is Union -> "member" + is Scalar -> return + } + val names = mutableSetOf() + val repeat = declarations.firstOrNull { !names.add(it.name) } ?: return + throw SchemaError("Type '$name' declares $noun '${repeat.name}' more than once${repeat.sourceLocation.describe()}.") + } + + sealed interface Implementing { + val fields: List + val interfaces: List> + } + + class Object( + private val definition: ObjectTypeDefinition, + private val extensions: List, + ) : MergedType(definition, extensions), Implementing { + override val fields: List = definition.fieldDefinitions + extensions.flatMap { it.fieldDefinitions } + override val interfaces: List> = definition.implements + extensions.flatMap { it.implements } + override val location = DirectiveLocation.OBJECT + override val declarations get() = fields + override fun newBuilder(context: TypeBuildContext): GraphQLObjectType.Builder = + GraphQLObjectType.newObject().definition(definition).extensionDefinitions(extensions) + } + + class Interface( + private val definition: InterfaceTypeDefinition, + private val extensions: List, + ) : MergedType(definition, extensions), Implementing { + override val fields: List = definition.fieldDefinitions + extensions.flatMap { it.fieldDefinitions } + override val interfaces: List> = definition.implements + extensions.flatMap { it.implements } + override val location = DirectiveLocation.INTERFACE + override val declarations get() = fields + override fun newBuilder(context: TypeBuildContext): GraphQLInterfaceType.Builder = + GraphQLInterfaceType.newInterface().definition(definition).extensionDefinitions(extensions) + } + + class Union( + private val definition: UnionTypeDefinition, + private val extensions: List, + ) : MergedType(definition, extensions) { + val members: List> = definition.memberTypes + extensions.flatMap { it.memberTypes } + override val location = DirectiveLocation.UNION + override val declarations get() = members.map { it as TypeName } + override fun newBuilder(context: TypeBuildContext): GraphQLUnionType.Builder = + GraphQLUnionType.newUnionType().definition(definition).extensionDefinitions(extensions) + + fun declarationTextOf(member: Type<*>): String = + (listOf(definition) + extensions).first { declaration -> declaration.memberTypes.any { it === member } }.toString() + } + + class Enum( + private val definition: EnumTypeDefinition, + private val extensions: List, + ) : MergedType(definition, extensions) { + val values: List = definition.enumValueDefinitions + extensions.flatMap { it.enumValueDefinitions } + override val location = DirectiveLocation.ENUM + override val declarations get() = values + override fun newBuilder(context: TypeBuildContext): GraphQLEnumType.Builder = + GraphQLEnumType.newEnum().definition(definition).extensionDefinitions(extensions) + } + + class Input( + private val definition: InputObjectTypeDefinition, + private val extensions: List, + ) : MergedType(definition, extensions) { + val fields: List = definition.inputValueDefinitions + extensions.flatMap { it.inputValueDefinitions } + override val location = DirectiveLocation.INPUT_OBJECT + override val declarations get() = fields + override fun newBuilder(context: TypeBuildContext): GraphQLInputObjectType.Builder = + GraphQLInputObjectType.newInputObject().definition(definition).extensionDefinitions(extensions) + } + + class Scalar( + private val definition: ScalarTypeDefinition, + private val extensions: List, + ) : MergedType(definition, extensions) { + override val location = DirectiveLocation.SCALAR + override val declarations = emptyList>() + + // like graphql-java, only the schema's directives are applied + override fun newBuilder(context: TypeBuildContext): GraphQLScalarType.Builder { + val provided = context.customScalars.getValue(name) + return GraphQLScalarType.newScalar(provided) + .definition(definition) + .extensionDefinitions(extensions) + .specifiedByUrl(specifiedByUrl() ?: provided.specifiedByUrl) + .clearDirectives() + } + + private fun specifiedByUrl(): String? = + (directives.find { it.name == Directives.SpecifiedByDirective.name }?.getArgument("url")?.value as? StringValue)?.value + } +} diff --git a/src/main/kotlin/graphql/kickstart/tools/ResolverInfo.kt b/src/main/kotlin/graphql/kickstart/tools/ResolverInfo.kt index 638bdfb8..b9fba675 100644 --- a/src/main/kotlin/graphql/kickstart/tools/ResolverInfo.kt +++ b/src/main/kotlin/graphql/kickstart/tools/ResolverInfo.kt @@ -1,6 +1,5 @@ package graphql.kickstart.tools -import graphql.kickstart.tools.resolver.FieldResolverScanner import graphql.kickstart.tools.util.GraphQLRootResolver import graphql.kickstart.tools.util.JavaType import graphql.kickstart.tools.util.eraseUnboundedWildcards @@ -8,7 +7,7 @@ import org.apache.commons.lang3.reflect.TypeUtils import java.lang.reflect.ParameterizedType internal abstract class ResolverInfo { - abstract fun getFieldSearches(): List + abstract fun getFieldSearches(): List fun getRealResolverClass(resolver: GraphQLResolver<*>, options: SchemaParserOptions) = options.proxyHandlers.find { it.canHandle(resolver) } @@ -43,10 +42,10 @@ internal class NormalResolverInfo( return type } - override fun getFieldSearches(): List { + override fun getFieldSearches(): List { return listOf( - FieldResolverScanner.Search(resolverType, this, resolver, dataClassType), - FieldResolverScanner.Search(dataClassType, this, null) + ResolverSearch(resolverType, this, resolver, dataClassType), + ResolverSearch(dataClassType, this, null) ) } } @@ -60,11 +59,11 @@ internal class MultiResolverInfo( private val dataClass: JavaType ) : ResolverInfo() { - override fun getFieldSearches(): List { + override fun getFieldSearches(): List { return resolverInfoList .asSequence() - .map { FieldResolverScanner.Search(it.resolverType, this, it.resolver, it.dataClassType) } - .plus(FieldResolverScanner.Search(dataClass, this, null)) + .map { ResolverSearch(it.resolverType, this, it.resolver, it.dataClassType) } + .plus(ResolverSearch(dataClass, this, null)) .toList() } } @@ -75,16 +74,29 @@ internal class RootResolverInfo( val isSubscription: Boolean = false ) : ResolverInfo() { override fun getFieldSearches() = - resolvers.map { FieldResolverScanner.Search(getRealResolverClass(it, options), this, it) } + resolvers.map { ResolverSearch(getRealResolverClass(it, options), this, it) } } internal class DataClassResolverInfo(private val dataClass: JavaType) : ResolverInfo() { override fun getFieldSearches() = - listOf(FieldResolverScanner.Search(dataClass, this, null)) + listOf(ResolverSearch(dataClass, this, null)) } internal class MissingResolverInfo : ResolverInfo() { - override fun getFieldSearches(): List = listOf() + override fun getFieldSearches(): List = listOf() +} + +internal data class ResolverSearch( + val type: JavaType, + val resolverInfo: ResolverInfo, + val source: Any?, + val requiredFirstParameterType: Class<*>? = null +) { + val isSubscription get() = resolverInfo is RootResolverInfo && resolverInfo.isSubscription + + val firstArgumentIndex get() = if (requiredFirstParameterType != null) 1 else 0 + + fun withoutSourceParameter() = copy(requiredFirstParameterType = null) } internal class ResolverError(message: String, cause: Throwable? = null) : RuntimeException(message, cause) diff --git a/src/main/kotlin/graphql/kickstart/tools/ScanDictionary.kt b/src/main/kotlin/graphql/kickstart/tools/ScanDictionary.kt index a4d5c764..656a667b 100644 --- a/src/main/kotlin/graphql/kickstart/tools/ScanDictionary.kt +++ b/src/main/kotlin/graphql/kickstart/tools/ScanDictionary.kt @@ -1,8 +1,8 @@ package graphql.kickstart.tools +import graphql.kickstart.tools.resolver.TypeShape import graphql.kickstart.tools.util.JavaType import graphql.kickstart.tools.util.unwrap -import graphql.kickstart.tools.util.withExtensions import graphql.language.* import graphql.schema.idl.ScalarInfo import org.slf4j.Logger @@ -13,16 +13,14 @@ import java.lang.reflect.Method internal class ScanDictionary( private val options: SchemaParserOptions, private val log: Logger, - private val typeExtensions: TypeExtensions, - private val definitionsByName: Map>, + private val typesByName: Map>, private val typeClassMatcher: TypeClassMatcher, private val initialDictionary: Map, - private val enqueue: (ObjectTypeDefinition, JavaType) -> Unit, - private val handleFoundScalarType: (ScalarTypeDefinition) -> Unit, - private val dictionary: MutableMap, DictionaryEntry> = mutableMapOf(), -) : Map, ScanDictionary.EntryView> by dictionary { - private val interfaceDefinitionsByName = definitionsByName.values.filterIsInstance().associateBy { it.name } - private val enumsWithoutClass = mutableMapOf() + private val enqueue: (MergedType.Object, JavaType) -> Unit, + private val handleFoundScalarType: (MergedType.Scalar) -> Unit, + private val dictionary: MutableMap, DictionaryEntry> = mutableMapOf(), +) : Map, ScanDictionary.EntryView> by dictionary { + private val enumsWithoutClass = mutableMapOf() fun handleFoundType(match: TypeClassMatcher.Match) = when (match) { is TypeClassMatcher.ScalarMatch -> handleFoundScalarType(match.type) @@ -32,7 +30,7 @@ internal class ScanDictionary( /** * Enter a found type into the dictionary if it doesn't exist yet, add a reference pointing back to where it was discovered. */ - fun handleFoundType(type: TypeDefinition<*>, javaType: JavaType?, reference: Reference) { + fun handleFoundType(type: MergedType<*>, javaType: JavaType?, reference: Reference) { val realEntry = dictionary.getOrPut(type) { DictionaryEntry() } var typeWasSet = false @@ -62,14 +60,15 @@ internal class ScanDictionary( /** * Handle a newly found type, adding it to the list of actually used types and putting it in the scanning queue if it's an object type. */ - private fun handleNewType(graphQLType: TypeDefinition<*>, javaType: JavaType) { + private fun handleNewType(graphQLType: MergedType<*>, javaType: JavaType) { when (graphQLType) { - is ObjectTypeDefinition -> { + is MergedType.Object -> { enqueue(graphQLType, javaType) scanInterfacesOfType(graphQLType) } - is InputObjectTypeDefinition -> handleInputObjectFields(graphQLType, javaType) + is MergedType.Input -> handleInputObjectFields(graphQLType, javaType) + else -> {} } } @@ -77,10 +76,9 @@ internal class ScanDictionary( * Finds the types of the input object's fields through the properties of its class. A null [javaType] means the input object * has no known class, e.g. because it's only reachable through a Map. */ - private fun handleInputObjectFields(graphQLType: InputObjectTypeDefinition, javaType: JavaType?) { + private fun handleInputObjectFields(graphQLType: MergedType.Input, javaType: JavaType?) { val clazz = javaType?.unwrap() - graphQLType.withExtensions(typeExtensions) - .flatMap { it.inputValueDefinitions } + graphQLType.fields .forEach { inputValueDefinition -> val inputGraphQLType = inputValueDefinition.type.unwrap() if (ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS.containsKey(inputGraphQLType.name)) { @@ -94,11 +92,12 @@ internal class ScanDictionary( return@forEach } - handleFoundType(typeClassMatcher.match(TypeClassMatcher.PotentialMatch.parameterType( + handleFoundType(typeClassMatcher.match(TypeShape.parameterType( // a class from the dictionary is for the unwrapped type, not for its list or non-null wrapper if (propertyType != null) inputValueDefinition.type else inputGraphQLType, inputValueJavaType, - GenericTypeResolver(javaType ?: inputValueJavaType, options), + javaType ?: inputValueJavaType, + options, InputObjectReference(inputValueDefinition) ))) } @@ -108,10 +107,10 @@ internal class ScanDictionary( * Without a Java property for an input field its type can still be built, as long as it doesn't need a class of its own. * At runtime the value is whatever the input object's class (or the Map) deserializes it into. */ - private fun handleInputValueWithoutJavaType(graphQLType: InputObjectTypeDefinition, inputValueDefinition: InputValueDefinition, inputGraphQLType: TypeName, clazz: Class<*>?) { - when (val definition = definitionsByName[inputGraphQLType.name]) { - is ScalarTypeDefinition -> handleFoundScalarType(definition) - is InputObjectTypeDefinition -> { + private fun handleInputValueWithoutJavaType(graphQLType: MergedType.Input, inputValueDefinition: InputValueDefinition, inputGraphQLType: TypeName, clazz: Class<*>?) { + when (val definition = typesByName[inputGraphQLType.name]) { + is MergedType.Scalar -> handleFoundScalarType(definition) + is MergedType.Input -> { val isNewType = !dictionary.containsKey(definition) // registered without a class, so a class found for it later still gets set and scanned handleFoundType(definition, null, InputObjectReference(inputValueDefinition)) @@ -120,7 +119,7 @@ internal class ScanDictionary( } } // the enum class may still be found through another field, so this is only reported once scanning is done - is EnumTypeDefinition -> enumsWithoutClass.putIfAbsent(definition, enumWithoutClassMessage(definition, graphQLType, inputValueDefinition, clazz)) + is MergedType.Enum -> enumsWithoutClass.putIfAbsent(definition, enumWithoutClassMessage(definition, graphQLType, inputValueDefinition, clazz)) // undefined types and output types are reported by the SchemaParser else -> {} } @@ -133,7 +132,7 @@ internal class ScanDictionary( private fun isLibraryClass(clazz: Class<*>) = listOf("java.", "kotlin.", JACKSON_PACKAGE_PREFIX).any { clazz.name.startsWith(it) } - private fun enumWithoutClassMessage(enumType: EnumTypeDefinition, graphQLType: InputObjectTypeDefinition, inputValueDefinition: InputValueDefinition, clazz: Class<*>?): String { + private fun enumWithoutClassMessage(enumType: MergedType.Enum, graphQLType: MergedType.Input, inputValueDefinition: InputValueDefinition, clazz: Class<*>?): String { val field = inputValueDefinition.name val reason = when { clazz == null -> "no class was found for input type '${graphQLType.name}'" @@ -150,10 +149,10 @@ internal class ScanDictionary( ?.let { throw SchemaClassScannerError(it.value) } } - fun scanInterfacesOfType(graphQLType: ObjectTypeDefinition) { - graphQLType.withExtensions(typeExtensions).flatMap { it.implements }.forEach { + fun scanInterfacesOfType(graphQLType: MergedType.Object) { + graphQLType.interfaces.forEach { if (it is TypeName) { - handleFoundType(interfaceDefinitionsByName[it.name] + handleFoundType(typesByName[it.name] as? MergedType.Interface ?: throw SchemaClassScannerError("Object type ${graphQLType.name} declared interface ${it.name}, but no interface with that name was found in the schema!"), null, InterfaceReference(graphQLType)) } } @@ -238,11 +237,11 @@ internal class ScanDictionary( override fun getDescription() = "unused type" } - private class InterfaceReference(private val type: ObjectTypeDefinition) : Reference() { + private class InterfaceReference(private val type: MergedType.Object) : Reference() { override fun getDescription() = "interface declarations of ${type.name}" } - class UnionMemberReference(private val union: UnionTypeDefinition) : Reference() { + class UnionMemberReference(private val union: MergedType.Union) : Reference() { override fun getDescription() = "member of union ${union.name}" } diff --git a/src/main/kotlin/graphql/kickstart/tools/ScannedSchemaObjects.kt b/src/main/kotlin/graphql/kickstart/tools/ScannedSchemaObjects.kt index 1a60dce9..133851a5 100644 --- a/src/main/kotlin/graphql/kickstart/tools/ScannedSchemaObjects.kt +++ b/src/main/kotlin/graphql/kickstart/tools/ScannedSchemaObjects.kt @@ -1,12 +1,8 @@ package graphql.kickstart.tools -import graphql.kickstart.tools.resolver.FieldResolver +import graphql.kickstart.tools.resolver.ResolverPlan import graphql.kickstart.tools.util.JavaType -import graphql.language.EnumTypeDefinition import graphql.language.FieldDefinition -import graphql.language.ObjectTypeDefinition -import graphql.language.SDLNamedDefinition -import graphql.language.TypeDefinition import graphql.schema.GraphQLScalarType /** @@ -14,24 +10,33 @@ import graphql.schema.GraphQLScalarType */ internal data class ScannedSchemaObjects( val dictionary: TypeClassDictionary, - val definitions: Set>, - val typeExtensions: TypeExtensions, + val definitions: MergedDefinitions, + val types: Set>, val customScalars: CustomScalarMap, - val rootInfo: RootTypeInfo, - val fieldResolversByType: Map>, - val unusedDefinitions: Set>, - val directiveOnlyEnums: Set + val resolverPlansByType: Map>, + val unusedTypes: Set>, + val directiveOnlyEnums: Set ) -internal class TypeClassDictionary(val classByType: Map, JavaType>) { - val typeByClass: Map> = classByType.entries - .groupBy({ it.value }, { it.key }) - .mapValues { (javaType, types) -> - types.singleOrNull() ?: throw SchemaClassScannerError( - "Class '${javaType.typeName}' is used for types ${types.joinToString { "'${it.name}'" }}, but only input object types can share a class!" - ) +internal class TypeClassDictionary(val classByType: Map, JavaType>) { + val typeByClass: Map> + + init { + requireOnlyInputTypesShareAClass(classByType) { javaType, types -> + "Class '${javaType.typeName}' is used for types ${types.joinToString { "'${it.name}'" }}, but only input object types can share a class!" + } + typeByClass = classByType.entries.associate { it.value to it.key } + } + + companion object { + fun requireOnlyInputTypesShareAClass(classByType: Map, J>, message: (J, List>) -> String) { + classByType.entries + .filter { it.key !is MergedType.Input } + .groupBy({ it.value }, { it.key }) + .entries.firstOrNull { it.value.size > 1 } + ?.let { (javaType, types) -> throw SchemaClassScannerError(message(javaType, types)) } } + } } internal typealias CustomScalarMap = Map -internal typealias TypeExtensions = Map>> diff --git a/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt b/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt index 5a63f30d..dfbe38b4 100644 --- a/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt +++ b/src/main/kotlin/graphql/kickstart/tools/SchemaClassScanner.kt @@ -5,34 +5,27 @@ import graphql.kickstart.tools.ScanDictionary.FieldTypeReference import graphql.kickstart.tools.ScanDictionary.InitialDictionaryEntry import graphql.kickstart.tools.ScanDictionary.UnionMemberReference import graphql.kickstart.tools.ScanDictionary.UnusedTypeReference -import graphql.kickstart.tools.resolver.FieldResolver import graphql.kickstart.tools.resolver.FieldResolverError -import graphql.kickstart.tools.resolver.FieldResolverScanner -import graphql.kickstart.tools.resolver.MethodFieldResolver -import graphql.kickstart.tools.resolver.PropertyFieldResolver +import graphql.kickstart.tools.resolver.ResolverPlan import graphql.kickstart.tools.util.* import graphql.language.* import graphql.schema.idl.ScalarInfo -import graphql.schema.idl.TypeUtil import org.apache.commons.lang3.ClassUtils import org.slf4j.LoggerFactory -import java.lang.reflect.Field -import java.lang.reflect.Member -import java.lang.reflect.Modifier /** * @author Andrew Potter */ internal class SchemaClassScanner( initialDictionary: Map>, - allDefinitions: List>, + private val definitions: MergedDefinitions, resolvers: List>, private val scalars: CustomScalarMap, private val options: SchemaParserOptions ) { private val log = LoggerFactory.getLogger(javaClass) - private val rootInfo = RootTypeInfo.fromSchemaDefinitions(allDefinitions.filterIsInstance()) + private val rootInfo = definitions.rootInfo private val queryResolvers = resolvers.filterIsInstance() private val mutationResolvers = resolvers.filterIsInstance() @@ -41,54 +34,32 @@ internal class SchemaClassScanner( private val resolverInfos = resolvers.asSequence().minus(queryResolvers).minus(mutationResolvers).minus(subscriptionResolvers).map { NormalResolverInfo(it, options) }.toList() private val initialDictionary = initialDictionary.mapValues { InitialDictionaryEntry(it.value) } - private val directiveDefinitions = allDefinitions.filterIsInstance() - private val scalarDefinitions = allDefinitions.filterIsInstance() - - private val typeDefinitions = allDefinitions.filterIsInstance>() - private val baseTypeNames = typeDefinitions.filter { it !is SDLExtensionDefinition }.map { it.name }.toSet() - - private val loneExtensions = typeDefinitions - .filter { it is SDLExtensionDefinition && it !is ObjectTypeDefinition && it !is InputObjectTypeDefinition && it.name !in baseTypeNames } - .distinctBy { it.name } - - private val definitionsByName = typeDefinitions.filter { it !is SDLExtensionDefinition || it in loneExtensions }.associateBy { it.name } - private val typeExtensions: TypeExtensions = typeDefinitions - .filter { it is SDLExtensionDefinition && it !in loneExtensions && !extendsOtherKind(it) } - .groupBy { it.name } - private val objectDefinitions = allDefinitions.filterIsInstance().filter { it !is ObjectTypeExtensionDefinition } - private val objectDefinitionsByName = objectDefinitions.associateBy { it.name } - - private val scalarNames = ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS.keys + scalarDefinitions.map { it.name } - private val fieldResolverScanner = FieldResolverScanner(options, scalarNames) - private val typeClassMatcher = TypeClassMatcher(definitionsByName) - private val unvalidatedTypes = mutableSetOf>() + private val directiveDefinitions = definitions.directiveDefinitions + private val typesByName = definitions.byName + private val objectTypesByName = definitions.objectsWithRepeats.associateBy { it.name } + + private val resolverPlans = ResolverPlan.Finder(options, definitions.scalarNames) + private val typeClassMatcher = TypeClassMatcher(definitions) + private val unvalidatedTypes = mutableSetOf>() private val queue = linkedSetOf() - private val dictionary = ScanDictionary(options, log, typeExtensions, definitionsByName, typeClassMatcher, this.initialDictionary, ::enqueue, ::handleFoundScalarType) - private val sealedSubclassMatcher = SealedSubclassMatcher(dictionary, typeExtensions) + private val dictionary = ScanDictionary(options, log, typesByName, typeClassMatcher, this.initialDictionary, ::enqueue, ::handleFoundScalarType) + private val sealedSubclassMatcher = SealedSubclassMatcher(dictionary) - private val fieldResolversByType = mutableMapOf>() - private val notCallableOnResolver = mutableListOf() + private val resolverPlansByType = mutableMapOf>() + private val notCallableOnResolver = mutableListOf() init { initialDictionary.forEach { (name, clazz) -> - if (!definitionsByName.containsKey(name)) { + if (!typesByName.containsKey(name)) { throw SchemaClassScannerError("Class in supplied dictionary '${clazz.name}' specified type name '$name', but a type definition with that name was not found!") } } - typeDefinitions.filter { extendsOtherKind(it) }.forEach { extension -> - val definition = definitionsByName.getValue(extension.name) - log.warn("Type '${extension.name}' is defined as ${definition.kind()}, but extended as ${extension.kind()}. The extension is ignored.") - } + definitions.ignoredExtensionWarnings.forEach { log.warn(it) } - initialDictionary - .filterKeys { definitionsByName[it] !is InputObjectTypeDefinition } - .entries.groupBy({ it.value }, { it.key }) - .forEach { (clazz, names) -> - if (names.size > 1) { - throw SchemaClassScannerError("Class in supplied dictionary '${clazz.name}' specified type names ${names.joinToString { "'$it'" }}, but only input object types can share a class!") - } - } + TypeClassDictionary.requireOnlyInputTypesShareAClass(initialDictionary.mapKeys { typesByName.getValue(it.key) }) { clazz, types -> + "Class in supplied dictionary '${clazz.name}' specified type names ${types.joinToString { "'${it.name}'" }}, but only input object types can share a class!" + } if (options.allowUnimplementedResolvers) { log.warn("Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production.") @@ -101,7 +72,7 @@ internal class SchemaClassScanner( fun scanForClasses(): ScannedSchemaObjects { // Figure out what query, mutation and subscription types are called - val rootTypeHolder = RootTypesHolder(options, rootInfo, definitionsByName, queryResolvers, mutationResolvers, subscriptionResolvers) + val rootTypeHolder = RootTypesHolder(options, rootInfo, typesByName, queryResolvers, mutationResolvers, subscriptionResolvers) handleRootType(rootTypeHolder.query) handleRootType(rootTypeHolder.mutation) @@ -123,9 +94,6 @@ internal class SchemaClassScanner( handleDictionaryTypes(getAllObjectTypeMembersOfDiscoveredUnions()) { "Object type '${it.name}' is a member of a known union, but no class could be found for that type name. Please pass a class for type '${it.name}' in the parser's dictionary." } if (scanQueue()) continue - // Look for unions and interfaces used only by interface fields last, so types that can be reached some other way - // are still discovered in the same order as before. With includeUnusedTypes the unused types loop below already - // picks these up one at a time, scanning in between, so leave that path unchanged. if (!options.includeUnusedTypes && handleInterfaceFieldTypes()) continue break @@ -137,7 +105,7 @@ internal class SchemaClassScanner( if (options.includeUnusedTypes) { // One type at a time, since scanning it can discover other unused types along with their classes while (true) { - val unusedDefinition = (definitionsByName.values - (dictionary.keys.toSet() + unvalidatedTypes)) + val unusedDefinition = (typesByName.values - (dictionary.keys.toSet() + unvalidatedTypes)) .filter { definition -> definition.name != "PageInfo" } .firstOrNull { canIncludeUnusedType(it) } ?: break @@ -152,19 +120,19 @@ internal class SchemaClassScanner( return validateAndCreateResult(rootTypeHolder) } - private fun canIncludeUnusedType(definition: TypeDefinition<*>): Boolean = when (definition) { - is ObjectTypeDefinition, is InterfaceTypeDefinition, is UnionTypeDefinition -> true + private fun canIncludeUnusedType(definition: MergedType<*>): Boolean = when (definition) { + is MergedType.Object, is MergedType.Interface, is MergedType.Union -> true // Enums can't be built without a class, so the ones missing from the dictionary are only reported as unused - is EnumTypeDefinition -> initialDictionary.containsKey(definition.name) + is MergedType.Enum -> initialDictionary.containsKey(definition.name) else -> false } - private fun handleUnusedType(type: TypeDefinition<*>) { + private fun handleUnusedType(type: MergedType<*>) { val initialEntry = initialDictionary[type.name] when { initialEntry != null -> dictionary.handleFoundType(type, initialEntry.get(), DictionaryReference()) // Interfaces and unions are resolved through the classes of their implementations, so they don't need one - type is InterfaceTypeDefinition || type is UnionTypeDefinition -> dictionary.handleFoundType(type, null, UnusedTypeReference()) + type is MergedType.Interface || type is MergedType.Union -> dictionary.handleFoundType(type, null, UnusedTypeReference()) else -> throw SchemaClassScannerError("Object type '${type.name}' is unused and includeUnusedTypes is true. Please pass a class for type '${type.name}' in the parser's dictionary.") } } @@ -205,15 +173,15 @@ internal class SchemaClassScanner( private fun handleDirectiveInput(inputType: Type<*>) { val inputTypeName = inputType.unwrap().name - val typeDefinition = ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS[inputTypeName] - ?: definitionsByName[inputTypeName] + val typeDefinition = definitions.resolve(inputTypeName) ?: error("No ${TypeDefinition::class.java.simpleName} for type name $inputTypeName") when (typeDefinition) { - is ScalarTypeDefinition -> handleFoundScalarType(typeDefinition) - is EnumTypeDefinition -> handleDirectiveEnum(typeDefinition) - is InputObjectTypeDefinition -> handleDictionaryTypes(listOf(typeDefinition)) { + is MergedType.Scalar -> handleFoundScalarType(typeDefinition) + is MergedType.Enum -> handleDirectiveEnum(typeDefinition) + is MergedType.Input -> handleDictionaryTypes(listOf(typeDefinition)) { "Input object type '${it.name}' is used in a directive, but no class could be found for that type name. Please pass a class for type '${it.name}' in the parser's dictionary." } + else -> {} } } @@ -222,7 +190,7 @@ internal class SchemaClassScanner( * it goes into [unvalidatedTypes] and, unless a field uses it too, is built with its value names as values, see * [validateAndCreateResult]. */ - private fun handleDirectiveEnum(type: EnumTypeDefinition) { + private fun handleDirectiveEnum(type: MergedType.Enum) { if (dictionary.containsKey(type)) { return } @@ -236,17 +204,16 @@ internal class SchemaClassScanner( } /** - * The names of the types used by the fields, arguments and input fields of [definitions], including fields added by extensions. + * The names of the types used by the fields, arguments and input fields of [types]. */ - private fun typeNamesUsedByFields(definitions: Set>): Set { - return definitions - .flatMap { it.withExtensions(typeExtensions) } - .flatMap { definition -> - when (definition) { - is ImplementingTypeDefinition<*> -> definition.fieldDefinitions.flatMap { field -> + private fun typeNamesUsedByFields(types: Set>): Set { + return types + .flatMap { type -> + when (type) { + is MergedType.Implementing -> type.fields.flatMap { field -> field.inputValueDefinitions.map { it.type } + field.type } - is InputObjectTypeDefinition -> definition.inputValueDefinitions.map { it.type } + is MergedType.Input -> type.fields.map { it.type } else -> emptyList() } } @@ -274,12 +241,12 @@ internal class SchemaClassScanner( it.value.javaType != null && it.value.typeClass() != Any::class.java && !Map::class.java.isAssignableFrom(it.value.typeClass()) - && it.key !is InputObjectTypeDefinition - && it.key !is UnionTypeDefinition + && it.key !is MergedType.Input + && it.key !is MergedType.Union }.mapValues { it.value.javaType!! } ) // SchemaParser builds the scalars, this only checks that each one was provided - val scalars = observedDefinitions.filterIsInstance() + val scalars = observedDefinitions.filterIsInstance() .filter { // Filter for any defined scalars OR scalars that aren't defined but also aren't standard scalars.containsKey(it.name) || !ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS.containsKey(it.name) @@ -288,42 +255,40 @@ internal class SchemaClassScanner( ?: throw SchemaClassScannerError("Expected a user-defined GraphQL scalar type with name '${definition.name}' but found none!")) } - val unusedDefinitions = (definitionsByName.values - observedDefinitions).toSet() + val unusedDefinitions = (typesByName.values - observedDefinitions).toSet() unusedDefinitions .filter { definition -> definition.name != "PageInfo" } .forEach { definition -> log.warn("Schema type was defined but can never be accessed, and can be safely deleted: ${definition.name}") } - val fieldResolvers = fieldResolversByType.flatMap { entry -> entry.value.map { it.value } } - val observedNormalResolverInfos = fieldResolvers.map { it.resolverInfo }.filterIsInstance().toSet() - val observedMultiResolverInfos = fieldResolvers.map { it.resolverInfo }.filterIsInstance().flatMap { it.resolverInfoList }.toSet() + val resolverPlans = resolverPlansByType.flatMap { entry -> entry.value.map { it.value } } + val observedNormalResolverInfos = resolverPlans.map { it.resolverInfo }.filterIsInstance().toSet() + val observedMultiResolverInfos = resolverPlans.map { it.resolverInfo }.filterIsInstance().flatMap { it.resolverInfoList }.toSet() (resolverInfos - observedNormalResolverInfos - observedMultiResolverInfos).forEach { resolverInfo -> log.warn("Resolver was provided but no methods on it were used in data fetchers, and can be safely deleted: ${resolverInfo.resolver}") } - validateRootResolversWereUsed(rootTypeHolder.query, fieldResolvers) - validateRootResolversWereUsed(rootTypeHolder.mutation, fieldResolvers) - validateRootResolversWereUsed(rootTypeHolder.subscription, fieldResolvers) - - val definitions = observedDefinitions + directiveDefinitions + validateRootResolversWereUsed(rootTypeHolder.query, resolverPlans) + validateRootResolversWereUsed(rootTypeHolder.mutation, resolverPlans) + validateRootResolversWereUsed(rootTypeHolder.subscription, resolverPlans) // The enums in unvalidatedTypes come from directives without a class, so they can only be built when no field uses them. // A field hands the enum's values to user code even when the scanner found no class through it, e.g. an input field bound // to a Map or an unimplemented field's argument. val typeNamesUsedByFields = typeNamesUsedByFields(observedDefinitions) - val directiveOnlyEnums = unvalidatedTypes.filterIsInstance().filter { it.name !in typeNamesUsedByFields }.toSet() + val directiveOnlyEnums = unvalidatedTypes.filterIsInstance().filter { it.name !in typeNamesUsedByFields }.toSet() - return ScannedSchemaObjects(dictionary, definitions, typeExtensions, scalars, rootInfo, fieldResolversByType.toMap(), unusedDefinitions, directiveOnlyEnums) + return ScannedSchemaObjects(dictionary, definitions, observedDefinitions, scalars, resolverPlansByType.toMap(), unusedDefinitions, directiveOnlyEnums) } - private fun validateRootResolversWereUsed(rootType: RootType?, fieldResolvers: List) { + private fun validateRootResolversWereUsed(rootType: RootType?, resolverPlans: List) { if (rootType == null) { return } - val observedRootTypes = fieldResolvers.asSequence().filter { it.resolverInfo is RootResolverInfo && it.resolverInfo == rootType.resolverInfo }.map { it.search.type }.toSet() + val observedRootTypes = resolverPlans.asSequence().filter { it.resolverInfo is RootResolverInfo && it.resolverInfo == rootType.resolverInfo }.map { it.search.type }.toSet() rootType.resolvers.forEach { resolver -> if (rootType.resolverInfo.getRealResolverClass(resolver, options) !in observedRootTypes) { log.warn("Root ${rootType.name} resolver was provided but no methods on it were used in data fetchers for GraphQL type '${rootType.type.name}'! Either remove the ${rootType.resolverInterface.name} interface from the resolver or remove the resolver entirely: $resolver") @@ -331,22 +296,20 @@ internal class SchemaClassScanner( } } - private fun getAllObjectTypesImplementingDiscoveredInterfaces(): List { - return dictionary.keys.filterIsInstance().map { iface -> - objectDefinitions.filter { obj -> - obj.withExtensions(typeExtensions).flatMap { it.implements }.filterIsInstance().any { it.name == iface.name } + private fun getAllObjectTypesImplementingDiscoveredInterfaces(): List { + return dictionary.keys.filterIsInstance().map { iface -> + definitions.objectsWithRepeats.filter { obj -> + obj.interfaces.filterIsInstance().any { it.name == iface.name } } }.flatten().distinctBy { it.name } } - private fun getAllObjectTypeMembersOfDiscoveredUnions(): List { - val unionTypeNames = dictionary.keys.filterIsInstance().map { union -> union.name }.toSet() - return dictionary.keys.filterIsInstance().map { union -> - union.withExtensions(typeExtensions).flatMap { definition -> - definition.memberTypes.filterIsInstance().filter { !unionTypeNames.contains(it.name) }.map { - objectDefinitionsByName[it.name] - ?: throw SchemaClassScannerError("No object type found with name '${it.name}' for union: $definition") - } + private fun getAllObjectTypeMembersOfDiscoveredUnions(): List { + val unionTypeNames = dictionary.keys.filterIsInstance().map { union -> union.name }.toSet() + return dictionary.keys.filterIsInstance().map { union -> + union.members.filterIsInstance().filter { !unionTypeNames.contains(it.name) }.map { + objectTypesByName[it.name] + ?: throw SchemaClassScannerError("No object type found with name '${it.name}' for union: ${union.declarationTextOf(it)}") } }.flatten().distinct() } @@ -355,10 +318,10 @@ internal class SchemaClassScanner( * Unions can list other unions as members. Returns whether any new unions were found. */ private fun handleNestedUnions(): Boolean { - val newUnions = dictionary.keys.filterIsInstance().flatMap { union -> - union.withExtensions(typeExtensions).flatMap { it.memberTypes }.filterIsInstance() - .map { definitionsByName[it.name] } - .filterIsInstance() + val newUnions = dictionary.keys.filterIsInstance().flatMap { union -> + union.members.filterIsInstance() + .map { typesByName[it.name] } + .filterIsInstance() .filter { !dictionary.containsKey(it) } .map { it to UnionMemberReference(union) } } @@ -372,10 +335,10 @@ internal class SchemaClassScanner( * union or interface may not be reachable from any object field. Returns whether any new types were found. */ private fun handleInterfaceFieldTypes(): Boolean { - val newTypes = dictionary.keys.filterIsInstance().flatMap { iface -> - iface.withExtensions(typeExtensions).flatMap { it.fieldDefinitions }.mapNotNull { field -> - val type = definitionsByName[field.type.unwrap().name] - if ((type is UnionTypeDefinition || type is InterfaceTypeDefinition) && !dictionary.containsKey(type)) { + val newTypes = dictionary.keys.filterIsInstance().flatMap { iface -> + iface.fields.mapNotNull { field -> + val type = typesByName[field.type.unwrap().name] + if ((type is MergedType.Union || type is MergedType.Interface) && !dictionary.containsKey(type)) { type to FieldTypeReference("${iface.name}.${field.name}") } else { null @@ -387,8 +350,8 @@ internal class SchemaClassScanner( return newTypes.isNotEmpty() } - private fun handleDictionaryTypes(types: List>, failureMessage: (TypeDefinition<*>) -> String) { - val typesWithoutClass = mutableListOf>() + private fun handleDictionaryTypes(types: List>, failureMessage: (MergedType<*>) -> String) { + val typesWithoutClass = mutableListOf>() types.forEach { type -> val dictionaryContainsType = dictionary.filter { it.key.name == type.name }.isNotEmpty() if (!unvalidatedTypes.contains(type) && !dictionaryContainsType) { @@ -401,7 +364,7 @@ internal class SchemaClassScanner( } } - val sealedMatches = typesWithoutClass.filterIsInstance().mapNotNull { sealedSubclassMatcher.sealedSubclassMatches(it).singleOrNull() } + val sealedMatches = typesWithoutClass.filterIsInstance().mapNotNull { sealedSubclassMatcher.sealedSubclassMatches(it).singleOrNull() } if (sealedMatches.isEmpty()) { typesWithoutClass.firstOrNull()?.let { throw SchemaClassScannerError(failureMessage(it) + sealedSubclassMatcher.sealedSubclassHint(it)) } } @@ -451,36 +414,18 @@ internal class SchemaClassScanner( private fun isResolverForSupertype(resolverInfo: NormalResolverInfo, dataClass: Class<*>) = resolverInfo.dataClassType != Any::class.java && resolverInfo.dataClassType.isAssignableFrom(dataClass) - private fun scanResolverInfoForPotentialMatches(type: ObjectTypeDefinition, resolverInfo: ResolverInfo) { - type.withExtensions(typeExtensions).flatMap { it.fieldDefinitions }.forEach { field -> - val fieldResolver = fieldResolverScanner.findFieldResolver(field, resolverInfo) - collectIfNotCallableOnResolver(type, fieldResolver) + private fun scanResolverInfoForPotentialMatches(type: MergedType.Object, resolverInfo: ResolverInfo) { + type.fields.forEach { field -> + val plan = resolverPlans.find(field, resolverInfo) + plan.notCallableOnResolver(type.name)?.let { notCallableOnResolver += it } - fieldResolversByType.getOrPut(type) { mutableMapOf() }[fieldResolver.field] = fieldResolver + resolverPlansByType.getOrPut(type) { mutableMapOf() }[plan.field] = plan - fieldResolver.scanForMatches().forEach { potentialMatch -> - dictionary.handleFoundType(typeClassMatcher.match(potentialMatch)) + plan.typeShapes().forEach { shape -> + dictionary.handleFoundType(typeClassMatcher.match(shape)) } - requireParameterForEachArgument(type, fieldResolver) - } - } - - private fun collectIfNotCallableOnResolver(type: ObjectTypeDefinition, fieldResolver: FieldResolver) { - val source = fieldResolver.search.source ?: return - val member: Member = when (fieldResolver) { - is MethodFieldResolver -> fieldResolver.method - is PropertyFieldResolver -> fieldResolver.property - else -> return + plan.requireParameterForEachArgument(type.name) } - if (Modifier.isStatic(member.modifiers) || member.declaringClass.isInstance(source)) { - return - } - - notCallableOnResolver += NotCallableOnResolver( - "Field '${type.name}.${fieldResolver.field.name}' resolves to ${member.declaringClass.name}.${member.name}, but the resolver is a " + - "${source.javaClass.name}, which isn't a ${member.declaringClass.name}, so every query of the field will fail.", - member is Field - ) } private fun throwIfNotCallableOnResolver() { @@ -495,57 +440,20 @@ internal class SchemaClassScanner( ) } - private fun requireParameterForEachArgument(type: ObjectTypeDefinition, fieldResolver: FieldResolver) { - if (fieldResolver !is MethodFieldResolver) { - return - } - - fieldResolver.field.inputValueDefinitions.forEachIndexed { index, argument -> - val parameter = fieldResolver.getMethodParameterType(index)?.let(fieldResolver.typeResolver::getRawClass) ?: return@forEachIndexed - if (!fieldResolverScanner.isContextParameter(parameter, argument)) { - return@forEachIndexed - } - - val method = fieldResolver.method - throw FieldResolverError( - "Field '${type.name}.${fieldResolver.field.name}' has no parameter for its argument '${argument.name}: " + - "${TypeUtil.simplePrint(argument.type)}' in ${method.declaringClass.name}.${method.name}, so the ${parameter.simpleName} " + - "parameter gets the argument instead. Add a parameter for each argument, in order, before the ${parameter.simpleName} parameter." - ) - } - } - - private fun handleFoundScalarType(type: ScalarTypeDefinition) { + private fun handleFoundScalarType(type: MergedType.Scalar) { unvalidatedTypes.add(type) } - private fun extendsOtherKind(definition: TypeDefinition<*>): Boolean { - val type = definitionsByName[definition.name] - return definition is SDLExtensionDefinition && type != null && type.kind() != definition.kind() - } - - private fun TypeDefinition<*>.kind(): String = when (this) { - is ObjectTypeDefinition -> "an object type" - is InterfaceTypeDefinition -> "an interface" - is UnionTypeDefinition -> "a union" - is EnumTypeDefinition -> "an enum" - is InputObjectTypeDefinition -> "an input object type" - is ScalarTypeDefinition -> "a scalar" - else -> javaClass.simpleName - } - - private fun enqueue(graphQLType: ObjectTypeDefinition, javaType: JavaType) { + private fun enqueue(graphQLType: MergedType.Object, javaType: JavaType) { queue.add(QueueItem(graphQLType, javaType)) } - private data class QueueItem(val type: ObjectTypeDefinition, val clazz: JavaType) - - private data class NotCallableOnResolver(val message: String, val isField: Boolean) + private data class QueueItem(val type: MergedType.Object, val clazz: JavaType) private class RootTypesHolder( options: SchemaParserOptions, rootInfo: RootTypeInfo, - definitionsByName: Map>, + typesByName: Map>, queryResolvers: List, mutationResolvers: List, subscriptionResolvers: List @@ -554,9 +462,9 @@ internal class SchemaClassScanner( private val mutationName = rootInfo.getMutationName() private val subscriptionName = rootInfo.getSubscriptionName() - private val queryDefinition = definitionsByName[queryName] - private val mutationDefinition = definitionsByName[mutationName] - private val subscriptionDefinition = definitionsByName[subscriptionName] + private val queryDefinition = typesByName[queryName] + private val mutationDefinition = typesByName[mutationName] + private val subscriptionDefinition = typesByName[subscriptionName] private val queryResolverInfo = RootResolverInfo(queryResolvers, options) private val mutationResolverInfo = RootResolverInfo(mutationResolvers, options) @@ -566,7 +474,7 @@ internal class SchemaClassScanner( val mutation = createRootType("mutation", mutationDefinition, mutationName, rootInfo.isMutationRequired(), mutationResolvers, GraphQLMutationResolver::class.java, mutationResolverInfo) val subscription = createRootType("subscription", subscriptionDefinition, subscriptionName, rootInfo.isSubscriptionRequired(), subscriptionResolvers, GraphQLSubscriptionResolver::class.java, subscriptionResolverInfo) - private fun createRootType(name: String, type: TypeDefinition<*>?, typeName: String, required: Boolean, resolvers: List, resolverInterface: Class<*>, resolverInfo: RootResolverInfo): RootType? { + private fun createRootType(name: String, type: MergedType<*>?, typeName: String, required: Boolean, resolvers: List, resolverInterface: Class<*>, resolverInfo: RootResolverInfo): RootType? { if (type == null) { if (required) { throw SchemaClassScannerError("Type definition for root $name type '$typeName' not found!") @@ -575,8 +483,8 @@ internal class SchemaClassScanner( return null } - if (type !is ObjectTypeDefinition) { - throw SchemaClassScannerError("Expected root query type's type to be ${ObjectTypeDefinition::class.java.simpleName}, but it was ${type.javaClass.simpleName}") + if (type !is MergedType.Object) { + throw SchemaClassScannerError("Expected root query type's type to be ${ObjectTypeDefinition::class.java.simpleName}, but it was ${type.definitionClassName}") } // Find query resolver class @@ -588,7 +496,7 @@ internal class SchemaClassScanner( } } - internal class RootType(val name: String, val type: ObjectTypeDefinition, val resolvers: List, val resolverInterface: Class<*>, val resolverInfo: RootResolverInfo) + internal class RootType(val name: String, val type: MergedType.Object, val resolvers: List, val resolverInterface: Class<*>, val resolverInfo: RootResolverInfo) } internal class SchemaClassScannerError(message: String, throwable: Throwable? = null) : RuntimeException(message, throwable) diff --git a/src/main/kotlin/graphql/kickstart/tools/SchemaParser.kt b/src/main/kotlin/graphql/kickstart/tools/SchemaParser.kt index a49b9aa1..5f941d24 100644 --- a/src/main/kotlin/graphql/kickstart/tools/SchemaParser.kt +++ b/src/main/kotlin/graphql/kickstart/tools/SchemaParser.kt @@ -1,24 +1,14 @@ package graphql.kickstart.tools -import graphql.Directives import graphql.introspection.Introspection import graphql.introspection.Introspection.DirectiveLocation.ARGUMENT_DEFINITION -import graphql.introspection.Introspection.DirectiveLocation.ENUM import graphql.introspection.Introspection.DirectiveLocation.ENUM_VALUE import graphql.introspection.Introspection.DirectiveLocation.FIELD_DEFINITION import graphql.introspection.Introspection.DirectiveLocation.INPUT_FIELD_DEFINITION -import graphql.introspection.Introspection.DirectiveLocation.INPUT_OBJECT -import graphql.introspection.Introspection.DirectiveLocation.INTERFACE -import graphql.introspection.Introspection.DirectiveLocation.OBJECT -import graphql.introspection.Introspection.DirectiveLocation.SCALAR -import graphql.introspection.Introspection.DirectiveLocation.UNION import graphql.kickstart.tools.directive.DirectiveWiringHelper -import graphql.kickstart.tools.resolver.MethodFieldResolver import graphql.kickstart.tools.util.describe -import graphql.kickstart.tools.util.extensionsOf import graphql.kickstart.tools.util.getDocumentation import graphql.kickstart.tools.util.unwrap -import graphql.kickstart.tools.util.withExtensions import graphql.language.* import graphql.schema.* import graphql.schema.idl.RuntimeWiring @@ -45,21 +35,21 @@ class SchemaParser internal constructor( private val dictionary = scanResult.dictionary private val definitions = scanResult.definitions - private val typeExtensions = scanResult.typeExtensions + private val types = scanResult.types private val customScalars = scanResult.customScalars - private val rootInfo = scanResult.rootInfo - private val fieldResolversByType = scanResult.fieldResolversByType - private val unusedDefinitions = scanResult.unusedDefinitions + private val rootInfo = definitions.rootInfo + private val resolverPlansByType = scanResult.resolverPlansByType + private val unusedDefinitions = definitions.definitionsOf(scanResult.unusedTypes) private val directiveOnlyEnums = scanResult.directiveOnlyEnums - private val objectDefinitions = definitions.filterIsInstance() - private val inputObjectDefinitions = definitions.filterIsInstance() - private val enumDefinitions = definitions.filterIsInstance() - private val interfaceDefinitions = definitions.filterIsInstance() - private val directiveDefinitions = definitions.filterIsInstance() + private val objectDefinitions = types.filterIsInstance() + private val inputObjectDefinitions = types.filterIsInstance() + private val enumDefinitions = types.filterIsInstance() + private val interfaceDefinitions = types.filterIsInstance() + private val directiveDefinitions = definitions.directiveDefinitions - private val unionDefinitions = definitions.filterIsInstance() - private val scalarDefinitions = definitions.filterIsInstance().filter { it.name in customScalars }.associateBy { it.name } + private val unionDefinitions = types.filterIsInstance() + private val scalarDefinitions = types.filterIsInstance().filter { it.name in customScalars }.associateBy { it.name } private val permittedTypesForObject: Set = (objectDefinitions.map { it.name } + enumDefinitions.map { it.name } + @@ -67,12 +57,13 @@ class SchemaParser internal constructor( unionDefinitions.map { it.name }).toSet() private val permittedTypesForInputObject: Set = (inputObjectDefinitions.map { it.name } + enumDefinitions.map { it.name }).toSet() - private val typeReferenceErrors = TypeReferenceErrors(definitions, unusedDefinitions, typeExtensions) + private val typeReferenceErrors = TypeReferenceErrors(definitions, types, scanResult.unusedTypes) private val codeRegistryBuilder = GraphQLCodeRegistry.newCodeRegistry() private val directiveWiringHelper = DirectiveWiringHelper(runtimeWiring, codeRegistryBuilder) private lateinit var sdlDirectives: SdlDirectives + private lateinit var typeBuildContext: TypeBuildContext /** * Parses the given schema with respect to the given dictionary and returns GraphQL objects. @@ -86,6 +77,7 @@ class SchemaParser internal constructor( // type references, so that an input object used by a directive applied to it doesn't contain itself determineType(GraphQLInputType::class, it, permittedTypesForInputObject) as GraphQLInputType } + typeBuildContext = TypeBuildContext(options, sdlDirectives, customScalars) val scalars = scalarDefinitions.values.map { createScalar(it) } inputObjectDefinitions.forEach { if (inputObjects.none { io -> io.name == it.name }) { @@ -127,7 +119,7 @@ class SchemaParser internal constructor( val wiredInputObjects = wiredObjects.dictionary.filterIsInstance().associateBy { it.name } val checker = UnmappedInputFieldChecker(wiredInputObjects, options.unmappedInputFields) objectDefinitions.forEach { type -> - fieldResolversByType[type].orEmpty().values.filterIsInstance().forEach { checker.check(type.name, it) } + resolverPlansByType[type].orEmpty().values.forEach { checker.check(type.name, it) } } checker.report() } @@ -160,32 +152,22 @@ class SchemaParser internal constructor( @Suppress("unused") fun getUnusedDefinitions(): Set> = unusedDefinitions - private fun createObject(objectDefinition: ObjectTypeDefinition, interfaces: List, inputObjects: List): GraphQLObjectType { - val name = objectDefinition.name - val extensions = typeExtensions.extensionsOf(name) - val directives = sdlDirectives.directivesOf(objectDefinition, extensions) - val fieldDefinitions = objectDefinition.withExtensions(typeExtensions).flatMap { it.fieldDefinitions } - rejectRepeated(name, "field", fieldDefinitions) - val builder = GraphQLObjectType.newObject() - .name(name) - .definition(objectDefinition) - .extensionDefinitions(extensions) - .description(getDocumentation(objectDefinition, options)) - .withSdlDirectives(directives, OBJECT) + private fun createObject(objectDefinition: MergedType.Object, interfaces: List, inputObjects: List): GraphQLObjectType { + val builder = objectDefinition.prepare(typeBuildContext) .apply { - objectDefinition.withExtensions(typeExtensions).flatMap { it.implements }.forEach { implementsDefinition -> + objectDefinition.interfaces.forEach { implementsDefinition -> val interfaceName = (implementsDefinition as TypeName).name withInterface(interfaces.find { it.name == interfaceName } ?: throw SchemaError("Expected interface type with name '$interfaceName' but found none!")) } } .apply { - fieldDefinitions.forEach { fieldDefinition -> + objectDefinition.fields.forEach { fieldDefinition -> field { field -> createField(field, fieldDefinition, inputObjects) codeRegistryBuilder.dataFetcher( FieldCoordinates.coordinates(objectDefinition.name, fieldDefinition.name), - fieldResolversByType[objectDefinition]?.get(fieldDefinition)?.createDataFetcher() + resolverPlansByType[objectDefinition]?.get(fieldDefinition)?.dataFetcher() ?: throw SchemaError("No resolver method found for object type '${objectDefinition.name}' and field '${fieldDefinition.name}', this is most likely a bug with graphql-java-tools") ) @@ -200,59 +182,38 @@ class SchemaParser internal constructor( return builder.build() } - private fun createInputObject(definition: InputObjectTypeDefinition, inputObjects: List, + private fun createInputObject(definition: MergedType.Input, inputObjects: List, inputObjectsInProgress: MutableSet): GraphQLInputObjectType { - val extensionDefinitions = typeExtensions.extensionsOf(definition.name) - val directives = sdlDirectives.directivesOf(definition, extensionDefinitions) - val inputValueDefinitions = definition.withExtensions(typeExtensions).flatMap { it.inputValueDefinitions } - rejectRepeated(definition.name, "field", inputValueDefinitions) - + val builder = definition.prepare(typeBuildContext) inputObjectsInProgress.add(definition.name) - val builder = GraphQLInputObjectType.newInputObject() - .name(definition.name) - .definition(definition) - .extensionDefinitions(extensionDefinitions) - .description(getDocumentation(definition, options)) - .withSdlDirectives(directives, INPUT_OBJECT) - .apply { - inputValueDefinitions.forEach { fieldDefinition -> - field( - GraphQLInputObjectField.newInputObjectField() - .name(fieldDefinition.name) - .definition(fieldDefinition) - .description(getDocumentation(fieldDefinition, options)) - .apply { fieldDefinition.defaultValue?.let { v -> defaultValueLiteral(v) } } - .apply { sdlDirectives.getDeprecated(fieldDefinition.directives)?.let { deprecate(it) } } - .type(determineInputType(fieldDefinition.type, inputObjects, inputObjectsInProgress)) - .withSdlDirectives(fieldDefinition.directives, INPUT_FIELD_DEFINITION) - .build() - ) - } - } + definition.fields.forEach { fieldDefinition -> + builder.field( + GraphQLInputObjectField.newInputObjectField() + .name(fieldDefinition.name) + .definition(fieldDefinition) + .description(getDocumentation(fieldDefinition, options)) + .apply { fieldDefinition.defaultValue?.let { v -> defaultValueLiteral(v) } } + .apply { sdlDirectives.getDeprecated(fieldDefinition.directives)?.let { deprecate(it) } } + .type(determineInputType(fieldDefinition.type, inputObjects, inputObjectsInProgress)) + .withSdlDirectives(fieldDefinition.directives, INPUT_FIELD_DEFINITION) + .build() + ) + } return builder.build() } - private fun createEnumObject(definition: EnumTypeDefinition): GraphQLEnumType { + private fun createEnumObject(definition: MergedType.Enum): GraphQLEnumType { val name = definition.name // enums only used by directives can do without a class, see SchemaClassScanner.handleDirectiveEnum val enumClass = dictionary.classByType[definition]?.unwrap() if (enumClass == null && definition !in directiveOnlyEnums) throw SchemaError("Expected enum with name '$name' but found none!") if (enumClass != null && !enumClass.isEnum) throw SchemaError("Type '$name' is declared as an enum in the GraphQL schema but is not a Java enum!") - val extensions = typeExtensions.extensionsOf(name) - val directives = sdlDirectives.directivesOf(definition, extensions) - val values = definition.withExtensions(typeExtensions).flatMap { it.enumValueDefinitions } - rejectRepeated(name, "value", values) - val builder = GraphQLEnumType.newEnum() - .name(name) - .definition(definition) - .extensionDefinitions(extensions) - .description(getDocumentation(definition, options)) - .withSdlDirectives(directives, ENUM) + val builder = definition.prepare(typeBuildContext) .apply { - values.forEach { valueDefinition -> + definition.values.forEach { valueDefinition -> val enumName = valueDefinition.name val enumValue = if (enumClass == null) { enumName @@ -277,41 +238,17 @@ class SchemaParser internal constructor( return builder.build() } - private fun createScalar(definition: ScalarTypeDefinition): GraphQLScalarType { - val name = definition.name - val provided = customScalars.getValue(name) - val extensions = typeExtensions.extensionsOf(name) - val directives = sdlDirectives.directivesOf(definition, extensions) - val builder = GraphQLScalarType.newScalar(provided) - .definition(definition) - .extensionDefinitions(extensions) - .description(getDocumentation(definition, options) ?: provided.description) - .specifiedByUrl(getSpecifiedByUrl(directives) ?: provided.specifiedByUrl) - // like graphql-java, only the schema's directives are applied - .clearDirectives() - .withSdlDirectives(directives, SCALAR) - - return builder.build() - } + private fun createScalar(definition: MergedType.Scalar): GraphQLScalarType = definition.prepare(typeBuildContext).build() - private fun createInterfaceObject(interfaceDefinition: InterfaceTypeDefinition, inputObjects: List): GraphQLInterfaceType { - val extensions = typeExtensions.extensionsOf(interfaceDefinition.name) - val directives = sdlDirectives.directivesOf(interfaceDefinition, extensions) - val fieldDefinitions = interfaceDefinition.withExtensions(typeExtensions).flatMap { it.fieldDefinitions } - rejectRepeated(interfaceDefinition.name, "field", fieldDefinitions) - val builder = GraphQLInterfaceType.newInterface() - .name(interfaceDefinition.name) - .definition(interfaceDefinition) - .extensionDefinitions(extensions) - .description(getDocumentation(interfaceDefinition, options)) - .withSdlDirectives(directives, INTERFACE) + private fun createInterfaceObject(interfaceDefinition: MergedType.Interface, inputObjects: List): GraphQLInterfaceType { + val builder = interfaceDefinition.prepare(typeBuildContext) .apply { - fieldDefinitions.forEach { fieldDefinition -> + interfaceDefinition.fields.forEach { fieldDefinition -> field { field -> createField(field, fieldDefinition, inputObjects) } } } .apply { - interfaceDefinition.withExtensions(typeExtensions).flatMap { it.implements }.forEach { implementsDefinition -> + interfaceDefinition.interfaces.forEach { implementsDefinition -> val interfaceName = (implementsDefinition as TypeName).name withInterface(GraphQLTypeReference(interfaceName)) } @@ -320,16 +257,8 @@ class SchemaParser internal constructor( return builder.build() } - private fun createUnionObject(definition: UnionTypeDefinition, types: List): GraphQLUnionType { - val extensions = typeExtensions.extensionsOf(definition.name) - val directives = sdlDirectives.directivesOf(definition, extensions) - rejectRepeated(definition.name, "member", definition.withExtensions(typeExtensions).flatMap { it.memberTypes }.map { it as TypeName }) - val builder = GraphQLUnionType.newUnionType() - .name(definition.name) - .definition(definition) - .extensionDefinitions(extensions) - .description(getDocumentation(definition, options)) - .withSdlDirectives(directives, UNION) + private fun createUnionObject(definition: MergedType.Union, types: List): GraphQLUnionType { + val builder = definition.prepare(typeBuildContext) .apply { getLeafUnionObjects(definition, types).forEach { possibleType(it) } } @@ -338,18 +267,18 @@ class SchemaParser internal constructor( } private fun getLeafUnionObjects( - definition: UnionTypeDefinition, + definition: MergedType.Union, types: List, - path: List = listOf(definition), + path: List = listOf(definition), ): List { val name = definition.name val leafObjects = mutableListOf() - definition.withExtensions(typeExtensions).flatMap { it.memberTypes }.forEach { + definition.members.forEach { val typeName = (it as TypeName).name // Is this a nested union? If so, expand - val nestedUnion: UnionTypeDefinition? = unionDefinitions.find { otherDefinition -> typeName == otherDefinition.name } + val nestedUnion: MergedType.Union? = unionDefinitions.find { otherDefinition -> typeName == otherDefinition.name } if (nestedUnion != null) { if (nestedUnion in path) { @@ -365,12 +294,6 @@ class SchemaParser internal constructor( return leafObjects } - private fun rejectRepeated(typeName: String, kind: String, declarations: List>) { - val names = mutableSetOf() - val repeat = declarations.firstOrNull { !names.add(it.name) } ?: return - throw SchemaError("Type '$typeName' declares $kind '${repeat.name}' more than once${repeat.sourceLocation.describe()}.") - } - private fun createField(field: GraphQLFieldDefinition.Builder, fieldDefinition: FieldDefinition, inputObjects: List): GraphQLFieldDefinition.Builder { return field .name(fieldDefinition.name) @@ -401,9 +324,6 @@ class SchemaParser internal constructor( private fun > B.withSdlDirectives(directives: List, location: Introspection.DirectiveLocation): B = with(sdlDirectives) { withSdlDirectives(directives, location) } - private fun getSpecifiedByUrl(directives: List): String? = - (directives.find { it.name == Directives.SpecifiedByDirective.name }?.getArgument("url")?.value as? StringValue)?.value - // custom scalars are in the dictionary, so they're referenced by name like the other types private fun scalarType(name: String?): GraphQLInputType? = scalarDefinitions[name]?.let { GraphQLTypeReference(it.name) } ?: GRAPHQL_SCALARS[name] diff --git a/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt b/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt index 448228c2..35727c57 100644 --- a/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt +++ b/src/main/kotlin/graphql/kickstart/tools/SchemaParserBuilder.kt @@ -163,7 +163,7 @@ class SchemaParserBuilder { val definitions = appendDynamicDefinitions(parseDefinitions()) val customScalars = scalars.associateBy { it.name } - return SchemaClassScanner(dictionary.toMap(), definitions, resolvers, customScalars, options) + return SchemaClassScanner(dictionary.toMap(), MergedDefinitions(definitions), resolvers, customScalars, options) .scanForClasses() } diff --git a/src/main/kotlin/graphql/kickstart/tools/SdlDirectives.kt b/src/main/kotlin/graphql/kickstart/tools/SdlDirectives.kt index ee531bf3..92dbc42e 100644 --- a/src/main/kotlin/graphql/kickstart/tools/SdlDirectives.kt +++ b/src/main/kotlin/graphql/kickstart/tools/SdlDirectives.kt @@ -28,9 +28,6 @@ internal class SdlDirectives( createDirectives() } - fun directivesOf(definition: TypeDefinition<*>, extensions: List>): List = - definition.directives + extensions.flatMap { it.directives } - fun failOnProblems() { if (problems.isNotEmpty()) throw SchemaError(problems.joinToString("\n")) } diff --git a/src/main/kotlin/graphql/kickstart/tools/SealedSubclassMatcher.kt b/src/main/kotlin/graphql/kickstart/tools/SealedSubclassMatcher.kt index 671e940d..713999ae 100644 --- a/src/main/kotlin/graphql/kickstart/tools/SealedSubclassMatcher.kt +++ b/src/main/kotlin/graphql/kickstart/tools/SealedSubclassMatcher.kt @@ -3,21 +3,15 @@ package graphql.kickstart.tools import graphql.kickstart.tools.ScanDictionary.SealedSubclassReference import graphql.kickstart.tools.util.JavaType import graphql.kickstart.tools.util.unwrap -import graphql.kickstart.tools.util.withExtensions -import graphql.language.InterfaceTypeDefinition -import graphql.language.ObjectTypeDefinition -import graphql.language.TypeDefinition import graphql.language.TypeName -import graphql.language.UnionTypeDefinition import org.apache.commons.lang3.reflect.TypeUtils import java.lang.reflect.ParameterizedType internal class SealedSubclassMatcher( - private val dictionary: Map, ScanDictionary.EntryView>, - private val typeExtensions: TypeExtensions, + private val dictionary: Map, ScanDictionary.EntryView>, ) { - fun sealedSubclassHint(type: TypeDefinition<*>): String { - if (type !is ObjectTypeDefinition) { + fun sealedSubclassHint(type: MergedType<*>): String { + if (type !is MergedType.Object) { return "" } @@ -35,7 +29,7 @@ internal class SealedSubclassMatcher( } } - fun sealedSubclassMatches(type: ObjectTypeDefinition): List = + fun sealedSubclassMatches(type: MergedType.Object): List = sealedTypesOf(type) .flatMap { sealedType -> sealedSubclasses(sealedType.unwrap()) @@ -44,12 +38,12 @@ internal class SealedSubclassMatcher( } .distinctBy { it.javaType.unwrap() } - private fun sealedTypesOf(type: ObjectTypeDefinition): List = + private fun sealedTypesOf(type: MergedType.Object): List = dictionary .filterKeys { definition -> when (definition) { - is UnionTypeDefinition -> definition.withExtensions(typeExtensions).flatMap { it.memberTypes }.filterIsInstance().any { it.name == type.name } - is InterfaceTypeDefinition -> type.withExtensions(typeExtensions).flatMap { it.implements }.filterIsInstance().any { it.name == definition.name } + is MergedType.Union -> definition.members.filterIsInstance().any { it.name == type.name } + is MergedType.Interface -> type.interfaces.filterIsInstance().any { it.name == definition.name } else -> false } } diff --git a/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt b/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt index fff48337..853acae5 100644 --- a/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt +++ b/src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt @@ -1,139 +1,33 @@ package graphql.kickstart.tools -import graphql.execution.DataFetcherResult -import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper -import graphql.kickstart.tools.util.GraphQLLangType +import graphql.kickstart.tools.resolver.TypeShape import graphql.kickstart.tools.util.JavaType -import graphql.kickstart.tools.util.isSubtypeOf import graphql.language.* -import graphql.schema.idl.ScalarInfo -import graphql.schema.idl.TypeUtil -import java.lang.reflect.ParameterizedType -import java.util.* /** * @author Andrew Potter */ -internal class TypeClassMatcher(private val definitionsByName: Map>) { +internal class TypeClassMatcher(private val definitions: MergedDefinitions) { - fun match(potentialMatch: PotentialMatch): Match { - val unwrapping = potentialMatch.unwrapping - return when (val graphQLType = unwrapping.graphQLType) { + fun match(shape: TypeShape): Match { + return when (val graphQLType = shape.leafGraphQLType) { is TypeName -> { - val typeDefinition = ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS[graphQLType.name] - ?: definitionsByName[graphQLType.name] - ?: throw potentialMatch.error("No ${TypeDefinition::class.java.simpleName} for type name ${graphQLType.name}") - if (typeDefinition is ScalarTypeDefinition) { + val typeDefinition = definitions.resolve(graphQLType.name) + ?: throw shape.error("No ${TypeDefinition::class.java.simpleName} for type name ${graphQLType.name}") + if (typeDefinition is MergedType.Scalar) { ScalarMatch(typeDefinition) } else { - ValidMatch(typeDefinition, unwrapping.javaType, potentialMatch.reference) + ValidMatch(typeDefinition, shape.leafJavaType, shape.reference) } } - is TypeDefinition<*> -> ValidMatch(graphQLType, unwrapping.javaType, potentialMatch.reference) - else -> throw potentialMatch.error("Unknown type: ${unwrapping.javaType.javaClass.name}") + else -> throw shape.error("Unknown type: ${shape.leafJavaType.javaClass.name}") } } internal sealed interface Match - internal data class ScalarMatch(val type: ScalarTypeDefinition) : Match + internal data class ScalarMatch(val type: MergedType.Scalar) : Match - internal data class ValidMatch(val type: TypeDefinition<*>, val javaType: JavaType, val reference: ScanDictionary.Reference) : Match - - internal enum class Location(val prettyName: String) { - RETURN_TYPE("return type"), - PARAMETER_TYPE("parameter"), - } - - internal data class PotentialMatch( - val graphQLType: GraphQLLangType, - val javaType: JavaType, - val typeResolver: GenericTypeResolver, - val reference: ScanDictionary.Reference, - val location: Location - ) { - val unwrapping: Unwrapping by lazy { unwrap(graphQLType, javaType, root = true, mutableListOf()) } - - fun error(msg: String) = SchemaClassScannerError("Unable to match type definition (${TypeUtil.simplePrint(graphQLType)}) for reference $reference with java type ($javaType): $msg") - - private fun unwrap(graphQLType: GraphQLLangType, javaType: JavaType, root: Boolean, unwrapped: MutableList): Unwrapping { - val onUnwrap = { wrapper: GenericWrapper -> unwrapped += Unwrapped.Wrapper(wrapper) } - var realType = typeResolver.resolve(javaType, onUnwrap) - var data = false - var optional = false - - while (realType is ParameterizedType) { - when { - realType.isSubtypeOf(DataFetcherResult::class.java) -> { - if (location != Location.RETURN_TYPE) { - throw error("${DataFetcherResult::class.java.name} can only be used as a return type") - } - if (data) { - throw error("${DataFetcherResult::class.java.name} cannot be nested within itself") - } - data = true - unwrapped += Unwrapped.Data - } - - realType.isSubtypeOf(Optional::class.java) -> { - if (location == Location.RETURN_TYPE && !root) { - throw error("${Optional::class.java.name} can only be used at the top level of a return type") - } - if (optional) { - throw error("${Optional::class.java.name} cannot be nested within itself") - } - optional = true - unwrapped += Unwrapped.Present - } - - else -> break - } - realType = typeResolver.resolve(realType.actualTypeArguments.first(), onUnwrap) - } - - // Match graphql type to java type. - return when (graphQLType) { - is NonNullType -> { - if (optional) { - throw error("graphql type is marked as nonnull but ${Optional::class.java.name} was used") - } - unwrap(graphQLType.type, realType, root = false, unwrapped) - } - - is ListType -> when { - realType is ParameterizedType && realType.isSubtypeOf(Iterable::class.java) -> { - unwrapped += Unwrapped.Elements - unwrap(graphQLType.type, realType.actualTypeArguments.first(), root = false, unwrapped) - } - realType is Class<*> && realType.isArray -> - unwrap(graphQLType.type, realType.componentType, root = false, unwrapped) - // e.g. a property map value: the element type is unknown, so match it as Object too - realType == Any::class.java -> - unwrap(graphQLType.type, realType, root = false, unwrapped) - else -> - throw error("Java class is not a List or generic type information was lost: $realType") - } - - else -> Unwrapping(unwrapped, graphQLType, realType) - } - } - - companion object { - fun returnValue(graphQLType: GraphQLLangType, javaType: JavaType, typeResolver: GenericTypeResolver, reference: ScanDictionary.Reference) = - PotentialMatch(graphQLType, javaType, typeResolver, reference, Location.RETURN_TYPE) - - fun parameterType(graphQLType: GraphQLLangType, javaType: JavaType, typeResolver: GenericTypeResolver, reference: ScanDictionary.Reference) = - PotentialMatch(graphQLType, javaType, typeResolver, reference, Location.PARAMETER_TYPE) - } - } - - internal class Unwrapping(val unwrapped: List, val graphQLType: GraphQLLangType, val javaType: JavaType) - - internal sealed interface Unwrapped { - class Wrapper(val wrapper: GenericWrapper) : Unwrapped - object Data : Unwrapped - object Present : Unwrapped - object Elements : Unwrapped - } + internal data class ValidMatch(val type: MergedType<*>, val javaType: JavaType, val reference: ScanDictionary.Reference) : Match } diff --git a/src/main/kotlin/graphql/kickstart/tools/TypeReferenceErrors.kt b/src/main/kotlin/graphql/kickstart/tools/TypeReferenceErrors.kt index 679cfbe5..36da3e70 100644 --- a/src/main/kotlin/graphql/kickstart/tools/TypeReferenceErrors.kt +++ b/src/main/kotlin/graphql/kickstart/tools/TypeReferenceErrors.kt @@ -1,69 +1,47 @@ package graphql.kickstart.tools import graphql.kickstart.tools.util.describe -import graphql.kickstart.tools.util.unwrap -import graphql.language.* +import graphql.language.TypeName import graphql.schema.GraphQLInputType import kotlin.reflect.KClass internal class TypeReferenceErrors( - private val definitions: Set>, - private val unusedDefinitions: Set>, - private val typeExtensions: TypeExtensions, + private val definitions: MergedDefinitions, + private val types: Set>, + private val unusedTypes: Set>, ) { fun unexpectedTypeError(typeName: TypeName, expectedType: KClass<*>): SchemaError { val isInput = expectedType == GraphQLInputType::class - val definition = unusedDefinitions.find { it.name == typeName.name } - ?: definitions.filterIsInstance>().find { it.name == typeName.name } - val outputOnlyKind = when (definition) { - is ObjectTypeDefinition -> "an object type" - is InterfaceTypeDefinition -> "an interface" - is UnionTypeDefinition -> "a union" - else -> null - } + val definition = unusedTypes.find { it.name == typeName.name } + ?: types.find { it.name == typeName.name } + val outputOnlyKind = definition?.takeIf { it is MergedType.Object || it is MergedType.Interface || it is MergedType.Union }?.kindPhrase val problem = when { definition == null -> "is not defined in the schema." isInput && outputOnlyKind != null -> "is $outputOnlyKind, which can't be used as an input type. Input types are input objects, enums and scalars." - !isInput && definition is InputObjectTypeDefinition -> + !isInput && definition is MergedType.Input -> "is an input object type, which can't be used as an output type. Output types are object types, interfaces, unions, enums and scalars." - definition in unusedDefinitions -> + definition in unusedTypes -> "is defined in the schema, but was not reached while scanning the resolvers and the classes they use, so it wasn't built. " + unreachedTypeHint(definition) else -> "can't be used as ${if (isInput) "an input" else "an output"} type." } - val usage = findUsage(typeName)?.let { " used by $it" }.orEmpty() + val usage = definitions.findUsage(typeName, types)?.let { " used by $it" }.orEmpty() return SchemaError("Type '${typeName.name}'$usage${typeName.sourceLocation.describe()} $problem") } // what makes the scanner reach the type depends on its kind, see SchemaClassScanner.canIncludeUnusedType - private fun unreachedTypeHint(definition: TypeDefinition<*>): String = when (definition) { - is InterfaceTypeDefinition, is UnionTypeDefinition -> + private fun unreachedTypeHint(definition: MergedType<*>): String = when (definition) { + is MergedType.Interface, is MergedType.Union -> "Return it from a resolver method or one of those classes, or set SchemaParserOptions.includeUnusedTypes." - is EnumTypeDefinition -> + is MergedType.Enum -> "Use it in a resolver method or one of those classes, or set SchemaParserOptions.includeUnusedTypes and pass its enum class in the parser's dictionary." - is InputObjectTypeDefinition -> + is MergedType.Input -> "Use it in an argument of a resolver method, directly or through another input type. SchemaParserOptions.includeUnusedTypes doesn't include input types." - is ScalarTypeDefinition -> + is MergedType.Scalar -> "Use it in a resolver method or one of those classes. SchemaParserOptions.includeUnusedTypes doesn't include scalars." - else -> + is MergedType.Object -> "Return it from a resolver method or one of those classes, or set SchemaParserOptions.includeUnusedTypes and pass a class for it in the parser's dictionary." } - - // determineType only gets the type reference, so the definition using it is looked up for the error message - private fun findUsage(typeName: TypeName): String? = (definitions + typeExtensions.values.flatten()).asSequence().flatMap { definition -> - when (definition) { - is ObjectTypeDefinition -> fieldUsages(definition.name, definition.fieldDefinitions) - is InterfaceTypeDefinition -> fieldUsages(definition.name, definition.fieldDefinitions) - is InputObjectTypeDefinition -> definition.inputValueDefinitions.map { "input field '${definition.name}.${it.name}'" to it.type } - is DirectiveDefinition -> definition.inputValueDefinitions.map { "argument '${it.name}' of directive '@${definition.name}'" to it.type } - else -> emptyList() - } - }.find { (_, type) -> type.unwrap() === typeName }?.first - - private fun fieldUsages(typeName: String, fields: List): List>> = fields.flatMap { field -> - listOf("field '$typeName.${field.name}'" to field.type) + - field.inputValueDefinitions.map { "argument '${it.name}' of field '$typeName.${field.name}'" to it.type } - } } diff --git a/src/main/kotlin/graphql/kickstart/tools/UnmappedInputFieldChecker.kt b/src/main/kotlin/graphql/kickstart/tools/UnmappedInputFieldChecker.kt index dcee5d8b..c1f374e6 100644 --- a/src/main/kotlin/graphql/kickstart/tools/UnmappedInputFieldChecker.kt +++ b/src/main/kotlin/graphql/kickstart/tools/UnmappedInputFieldChecker.kt @@ -1,6 +1,6 @@ package graphql.kickstart.tools -import graphql.kickstart.tools.resolver.MethodFieldResolver +import graphql.kickstart.tools.resolver.ResolverPlan import graphql.kickstart.tools.util.unwrap import graphql.schema.GraphQLInputObjectField import graphql.schema.GraphQLInputObjectType @@ -32,14 +32,13 @@ internal class UnmappedInputFieldChecker( private val messages = linkedMapOf() - fun check(objectType: String, resolver: MethodFieldResolver) { - resolver.field.inputValueDefinitions.forEachIndexed { index, argument -> - val inputObject = inputObjects[argument.type.unwrap().name] ?: return@forEachIndexed - val usage = "argument '${argument.name}' of field '$objectType.${resolver.field.name}'" + fun check(objectType: String, plan: ResolverPlan) { + plan.argumentTargets.forEach { (argument, parameterType) -> + val inputObject = inputObjects[argument.type.unwrap().name] ?: return@forEach + val usage = "argument '${argument.name}' of field '$objectType.${plan.field.name}'" try { - val parameterType = resolver.getMethodParameterType(index) ?: return@forEachIndexed - val reads = StrictReads(resolver.objectMapper) + val reads = StrictReads(plan.objectMapper) val deserializer = reads.context.findRootValueDeserializer(reads.mapper.typeFactory.constructType(parameterType)) checkFields(reads, deserializer, null, inputObject, usage) } catch (e: VirtualMachineError) { diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/FieldResolver.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/FieldResolver.kt deleted file mode 100644 index 4cc378fd..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/resolver/FieldResolver.kt +++ /dev/null @@ -1,49 +0,0 @@ -package graphql.kickstart.tools.resolver - -import graphql.kickstart.tools.* -import graphql.language.FieldDefinition -import graphql.schema.DataFetcher -import graphql.schema.DataFetchingEnvironment - -/** - * @author Andrew Potter - */ -internal abstract class FieldResolver( - val field: FieldDefinition, - val search: FieldResolverScanner.Search, - val options: SchemaParserOptions -) { - val resolverInfo: ResolverInfo = search.resolverInfo - val typeResolver = GenericTypeResolver(search.type, options) - - abstract fun scanForMatches(): List - - abstract fun createDataFetcher(): DataFetcher<*> - - /** - * Add source resolver depending on whether or not this is a resolver method - */ - protected fun createSourceResolver(): SourceResolver { - return if (this.search.source != null) { - SourceResolver { _, _ -> this.search.source } - } else { - SourceResolver { environment, sourceObject -> - // if source object is known, environment is null as an optimization (LightDataFetcher) - val source = sourceObject - ?: environment?.getSource() - ?: throw ResolverError("Expected DataFetchingEnvironment and source object to not be null!") - - if (!this.typeResolver.isAssignableFrom(source.javaClass)) { - throw ResolverError("Expected source object to be an instance of '${this.typeResolver.getRawClass().name}' but instead got '${source.javaClass.name}'") - } - - source - } - } - } -} - -fun interface SourceResolver { - - fun resolve(environment: DataFetchingEnvironment?, source: Any?): Any -} diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/FieldResolverScanner.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/FieldResolverScanner.kt deleted file mode 100644 index 561096b6..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/resolver/FieldResolverScanner.kt +++ /dev/null @@ -1,292 +0,0 @@ -package graphql.kickstart.tools.resolver - -import graphql.GraphQLContext -import graphql.Scalars -import graphql.kickstart.tools.ResolverInfo -import graphql.kickstart.tools.RootResolverInfo -import graphql.kickstart.tools.SchemaParserOptions -import graphql.kickstart.tools.util.* -import graphql.language.FieldDefinition -import graphql.language.InputValueDefinition -import graphql.schema.DataFetchingEnvironment -import graphql.schema.idl.ScalarInfo -import kotlinx.coroutines.channels.ReceiveChannel -import org.apache.commons.lang3.ClassUtils -import org.apache.commons.lang3.reflect.FieldUtils -import org.apache.commons.lang3.reflect.TypeUtils -import org.reactivestreams.Publisher -import org.slf4j.LoggerFactory -import java.lang.reflect.* -import kotlin.reflect.full.extensionReceiverParameter -import kotlin.reflect.jvm.kotlinFunction - -/** - * @author Andrew Potter - */ -internal class FieldResolverScanner(val options: SchemaParserOptions, private val scalarNames: Set) { - - private val log = LoggerFactory.getLogger(javaClass) - - private val allowedTrailingParameterTypes = listOfNotNull(DataFetchingEnvironment::class.java, GraphQLContext::class.java, options.contextClass) - - private val methodsByNameCache = mutableMapOf, Boolean>, Map>>() - - fun findFieldResolver(field: FieldDefinition, resolverInfo: ResolverInfo): FieldResolver { - val searches = resolverInfo.getFieldSearches() - - val scanProperties = field.inputValueDefinitions.isEmpty() - val found = searches.mapNotNull { search -> findFieldResolver(field, search, scanProperties) } - - if (resolverInfo is RootResolverInfo && found.size > 1) { - throw FieldResolverError("Found more than one matching resolver for field '$field': $found") - } - - return found.firstOrNull() - ?: missingFieldResolver(field) - ?: findSourcelessFieldResolver(field, searches) - ?: throw FieldResolverError(getMissingFieldMessage(field, searches, scanProperties)) - } - - private fun findFieldResolver(field: FieldDefinition, search: Search, scanProperties: Boolean): FieldResolver? { - val method = findResolverMethod(field, search) - if (method != null) { - return MethodFieldResolver(field, search, options, method.apply(trySetAccessible(field, search.type)), scalarNames) - } - - if (scanProperties) { - val property = findResolverProperty(field, search) - if (property != null) { - return PropertyFieldResolver(field, search, options, property.apply(trySetAccessible(field, search.type))) - } - } - - if (Map::class.java.isAssignableFrom(search.type.unwrap())) { - return MapFieldResolver(field, search, options, search.type.unwrap()) - } - - return null - } - - private fun trySetAccessible(field: FieldDefinition, type: JavaType): AccessibleObject.() -> Unit = { - try { - isAccessible = true - } catch (e: RuntimeException) { - log.warn("Unable to make field ${type.unwrap().name}#${field.name} accessible. " + - "Be sure to provide a resolver or open the enclosing module if possible.") - } - } - - private fun missingFieldResolver(field: FieldDefinition): FieldResolver? { - return if (options.allowUnimplementedResolvers || options.missingResolverDataFetcherProvider != null) { - if (options.allowUnimplementedResolvers) { - log.warn("Missing resolver for field: $field") - } - - MissingFieldResolver(field, options) - } else { - null - } - } - - private fun findSourcelessFieldResolver(field: FieldDefinition, searches: List): FieldResolver? = - searches.firstNotNullOfOrNull { search -> - val sourceType = search.requiredFirstParameterType ?: return@firstNotNullOfOrNull null - val sourceless = search.withoutSourceParameter() - findMethodByName(field, sourceless) { isSourcelessMethod(it, field, sourceless, sourceType) }?.let { method -> - MethodFieldResolver(field, sourceless, options, method.apply(trySetAccessible(field, search.type)), scalarNames) - } - } - - private fun isSourcelessMethod(method: Method, field: FieldDefinition, search: Search, sourceType: Class<*>): Boolean { - val arguments = field.inputValueDefinitions - val parameterTypes = method.parameterTypes - - return method.parameterCountWithoutContinuation() > arguments.size && - arguments.indices.none { isContextParameter(parameterTypes[it], arguments[it]) } && - (arguments.isEmpty() || !couldTakeSource(parameterTypes[0], sourceType)) && - verifyMethodArguments(method, arguments.size, search) - } - - private fun couldTakeSource(parameterType: Class<*>, sourceType: Class<*>) = - sourceType.isAssignableFrom(parameterType) || parameterType.isAssignableFrom(sourceType) - - // the context class can also be an argument's type (e.g. a Map for an input object), so only spec scalars count for it - fun isContextParameter(parameter: Class<*>, argument: InputValueDefinition): Boolean = - parameter in allowedTrailingParameterTypes && - (parameter != options.contextClass || argument.type.unwrap().name in ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS) - - private fun findResolverMethod(field: FieldDefinition, search: Search): Method? { - val argumentCount = field.inputValueDefinitions.size + search.firstArgumentIndex - return findMethodByName(field, search) { verifyMethodArguments(it, argumentCount, search) } - } - - private inline fun findMethodByName(field: FieldDefinition, search: Search, matches: (Method) -> Boolean): Method? { - val methodsByName = getMethodsByName(search) - val name = field.name - val capitalizedName = name.replaceFirstChar(Char::titlecase) - - // Check for the following one by one: - // 1. Method with exact field name - // 2. Method that returns a boolean with "is" style getter - // 3. Method with "get" style getter - // 4. Method with "getField" style getter - // 5. Method with "get" style getter with the field name converted from snake_case to camelCased. ex: key_ops -> getKeyOps() - return listOfNotNull( - name, - if (isBoolean(field.type)) "is$capitalizedName" else null, - "get$capitalizedName", - "getField$capitalizedName", - "get${name.snakeToCamelCase()}" - ).firstNotNullOfOrNull { methodName -> - methodsByName[methodName]?.find { matches(it) } - } - } - - // root fields are searched on every root resolver, so each class's methods are only indexed once - private fun getMethodsByName(search: Search): Map> = - methodsByNameCache.getOrPut(search.type.unwrap() to search.isSubscription) { - getAllMethods(search).groupBy { it.name } - } - - private fun getAllMethods(search: Search): List { - val type = search.type.unwrap() - val declaredMethods = type.declaredNonProxyMethods - val superClassesMethods = ClassUtils.getAllSuperclasses(type).flatMap { it.methods.toList() } - val interfacesMethods = ClassUtils.getAllInterfaces(type).flatMap { it.methods.toList() } - - return (declaredMethods + superClassesMethods + interfacesMethods) - .asSequence() - .filter { !it.isSynthetic } - .filter { !Modifier.isPrivate(it.modifiers) } - // discard any methods that are coming off the root of the class hierarchy - // to avoid issues with duplicate method declarations - .filter { it.declaringClass != Any::class.java } - // subscription resolvers must return a publisher - .filter { !search.isSubscription || resolverMethodReturnsPublisher(it) } - .toList() - } - - private fun resolverMethodReturnsPublisher(method: Method) = - // suspend functions and unbounded type variables are erased to Object, so the actual return type is unknown here - method.returnType == Any::class.java - || Publisher::class.java.isAssignableFrom(method.returnType) - || resolverMethodReturnsPublisherFuture(method) - || receiveChannelToPublisherWrapper(method) - - private fun resolverMethodReturnsPublisherFuture(method: Method) = - method.genericReturnType.futureValueType() - ?.let { if (it is WildcardType) it.upperBounds.first() else it } - ?.let { TypeUtils.isAssignable(it, Publisher::class.java) } == true - - private fun receiveChannelToPublisherWrapper(method: Method) = - ReceiveChannel::class.java.isAssignableFrom(method.returnType) - && options.genericWrappers.any { wrapper -> - val isReceiveChannelWrapper = wrapper.type == method.returnType - // lambdas are erased to return Object, so this only checks that the transformer can return a Publisher - val hasPublisherTransformer = wrapper - .transformer.javaClass - .declaredMethods - .filter { it.name == "invoke" } - .any { it.returnType.isAssignableFrom(Publisher::class.java) } - isReceiveChannelWrapper && hasPublisherTransformer - } - - private fun isBoolean(type: GraphQLLangType) = type.unwrap().name == Scalars.GraphQLBoolean.name - - private fun verifyMethodArguments(method: Method, requiredCount: Int, search: Search): Boolean { - val appropriateFirstParameter = if (search.requiredFirstParameterType != null) { - method.genericParameterTypes.firstOrNull()?.let { - it.eraseUnboundedWildcards() == search.requiredFirstParameterType || method.declaringClass.typeParameters.contains(it) - } ?: false - } else { - // an extension receiver can only take the source object - !isExtensionFunction(method) - } - - val methodParameterCount = method.parameterCountWithoutContinuation() - - val correctParameterCount = methodParameterCount >= requiredCount && - method.parameterTypes.slice(requiredCount until methodParameterCount).all { it in allowedTrailingParameterTypes } - return correctParameterCount && appropriateFirstParameter - } - - private fun isExtensionFunction(method: Method): Boolean { - return try { - method.kotlinFunction?.extensionReceiverParameter != null - } catch (e: InternalError) { - false - } - } - - private fun findResolverProperty(field: FieldDefinition, search: Search) = - FieldUtils.getAllFields(search.type.unwrap()).find { it.name == field.name } - - private fun getMissingFieldMessage(field: FieldDefinition, searches: List, scannedProperties: Boolean): String { - val signatures = mutableListOf("") - val isBoolean = isBoolean(field.type) - var isSubscription = false - - searches.forEach { search -> - signatures.addAll(getMissingMethodSignatures(field, search, isBoolean, scannedProperties)) - isSubscription = isSubscription || search.isSubscription - } - searches.filter { it.requiredFirstParameterType != null }.forEach { search -> - signatures.addAll(getMissingMethodSignatures(field, search.withoutSourceParameter(), isBoolean, false, "")) - } - - val sourceName = field.sourceLocation?.sourceName ?: "" - val sourceLocation = field.sourceLocation?.let { "$sourceName:${it.line}" } ?: "" - - return "No method${if (scannedProperties) " or field" else ""} found as defined in schema $sourceLocation with any of the following signatures " + - "(optionally followed by any of $allowedTrailingParameterTypes), in priority order:\n${signatures.joinToString("\n ")}" + - if (isSubscription) "\n\nNote that a Subscription data fetcher must return a Publisher of events" else "" - } - - private fun getMissingMethodSignatures( - field: FieldDefinition, - search: Search, - isBoolean: Boolean, - scannedProperties: Boolean, - trailingParameter: String? = null - ): List { - val baseType = search.type.unwrap() - val signatures = mutableListOf() - val args = mutableListOf() - val sep = ", " - - if (search.requiredFirstParameterType != null) { - args.add(search.requiredFirstParameterType.name) - } - - args.addAll(field.inputValueDefinitions.map { "~${it.name}" }) - trailingParameter?.let(args::add) - - val argString = args.joinToString(sep) - - signatures.add("${baseType.name}.${field.name}($argString)") - if (isBoolean) { - signatures.add("${baseType.name}.is${field.name.replaceFirstChar(Char::titlecase)}($argString)") - } - signatures.add("${baseType.name}.get${field.name.replaceFirstChar(Char::titlecase)}($argString)") - if (scannedProperties) { - signatures.add("${baseType.name}.${field.name}") - } - - return signatures - } - - data class Search( - val type: JavaType, - val resolverInfo: ResolverInfo, - val source: Any?, - val requiredFirstParameterType: Class<*>? = null - ) { - val isSubscription get() = resolverInfo is RootResolverInfo && resolverInfo.isSubscription - - val firstArgumentIndex get() = if (requiredFirstParameterType != null) 1 else 0 - - fun withoutSourceParameter() = copy(requiredFirstParameterType = null) - } -} - -internal class FieldResolverError(msg: String) : RuntimeException(msg) diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/MapFieldResolver.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/MapFieldResolver.kt deleted file mode 100644 index 79b5bb4f..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/resolver/MapFieldResolver.kt +++ /dev/null @@ -1,69 +0,0 @@ -package graphql.kickstart.tools.resolver - -import com.fasterxml.classmate.TypeResolver -import graphql.kickstart.tools.ScanDictionary -import graphql.kickstart.tools.SchemaParserOptions -import graphql.kickstart.tools.TypeClassMatcher -import graphql.kickstart.tools.util.JavaType -import graphql.language.FieldDefinition -import graphql.schema.DataFetcher -import graphql.schema.DataFetchingEnvironment -import graphql.schema.GraphQLFieldDefinition -import graphql.schema.LightDataFetcher -import java.util.function.Supplier - -/** - * @author Nick Weedon - * - * The MapFieldResolver implements the Map (i.e. property map) specific portion of the logic within the GraphQL PropertyDataFetcher class. - */ -internal class MapFieldResolver( - field: FieldDefinition, - search: FieldResolverScanner.Search, - options: SchemaParserOptions, - mapClass: JavaType -) : FieldResolver(field, search, options) { - - private var mapGenericValue: JavaType = getMapGenericType(mapClass) - - /** - * Takes a type which implements Map and tries to find the - * value type of that map. For some reason, mapClass is losing - * its generics somewhere along the way and is always a raw - * type. - */ - private fun getMapGenericType(mapClass: JavaType): JavaType { - val resolvedType = TypeResolver().resolve(mapClass) - val typeParameters = resolvedType.typeParametersFor(Map::class.java) - - return typeParameters.elementAtOrElse(1) { Any::class.java } - } - - override fun createDataFetcher(): DataFetcher<*> { - return MapFieldResolverDataFetcher(createSourceResolver(), field.name) - } - - override fun scanForMatches(): List { - return listOf(TypeClassMatcher.PotentialMatch.returnValue(field.type, mapGenericValue, typeResolver, ScanDictionary.FieldTypeReference(field.name))) - } - - override fun toString() = "MapFieldResolver{key=${field.name}}" -} - -internal class MapFieldResolverDataFetcher( - private val sourceResolver: SourceResolver, - private val key: String -) : LightDataFetcher { - - override fun get(fieldDefinition: GraphQLFieldDefinition, sourceObject: Any?, environmentSupplier: Supplier): Any? { - if (sourceObject is Map<*, *>) { - return sourceObject[key] - } else { - throw RuntimeException("MapFieldResolver attempt to fetch a field from an object instance that was not a map") - } - } - - override fun get(environment: DataFetchingEnvironment): Any? { - return get(environment.fieldDefinition, sourceResolver.resolve(environment, null)) { environment } - } -} diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/MethodFieldResolver.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/MethodFieldResolver.kt deleted file mode 100644 index 7457dfc4..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/resolver/MethodFieldResolver.kt +++ /dev/null @@ -1,274 +0,0 @@ -package graphql.kickstart.tools.resolver - -import graphql.GraphQLContext -import graphql.kickstart.tools.* -import graphql.kickstart.tools.util.JavaType -import graphql.kickstart.tools.util.coroutineScope -import graphql.kickstart.tools.util.futureValueType -import graphql.kickstart.tools.util.isSuspendFunction -import graphql.kickstart.tools.util.parameterCountWithoutContinuation -import graphql.kickstart.tools.util.typeArgument -import graphql.kickstart.tools.util.unwrap -import graphql.language.* -import graphql.schema.DataFetcher -import graphql.schema.DataFetchingEnvironment -import graphql.schema.GraphQLFieldDefinition -import graphql.schema.LightDataFetcher -import kotlinx.coroutines.CoroutineStart -import kotlinx.coroutines.ensureActive -import kotlinx.coroutines.future.future -import org.apache.commons.lang3.reflect.TypeUtils -import org.reactivestreams.Publisher -import tools.jackson.databind.ObjectMapper -import java.lang.reflect.InvocationTargetException -import java.lang.reflect.Method -import java.util.* -import java.util.concurrent.Future -import java.util.function.Supplier -import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn -import kotlin.reflect.jvm.javaType -import kotlin.reflect.jvm.kotlinFunction - -/** - * @author Andrew Potter - */ -internal class MethodFieldResolver( - field: FieldDefinition, - search: FieldResolverScanner.Search, - options: SchemaParserOptions, - val method: Method, - private val scalarNames: Set -) : FieldResolver(field, search, options) { - - private val isSuspendFunction = method.isSuspendFunction() - private val numberOfParameters = method.parameterCountWithoutContinuation() - - internal val objectMapper: ObjectMapper by lazy { options.objectMapperProvider.provide(field) } - - override fun createDataFetcher(): DataFetcher<*> { - val args = mutableListOf() - val mapper = objectMapper - - if (this.search.requiredFirstParameterType != null) { - val expectedType = this.search.requiredFirstParameterType - - args.add { environment -> - val source = environment.getSource() - ?: throw ResolverError("Expected source object to not be null!") - if (!expectedType.isAssignableFrom(source.javaClass)) { - throw ResolverError("Source type (${source.javaClass.name}) is not expected type (${expectedType.name})!") - } - - source - } - } - - // Add an argument for each argument defined in the GraphQL schema - this.field.inputValueDefinitions.forEachIndexed { index, definition -> - - val parameterType = this.getMethodParameterType(index) - ?: throw ResolverError("Missing method type at position ${this.getJavaMethodParameterIndex(index)}, this is most likely a bug with graphql-java-tools") - - val isNonNull = definition.type is NonNullType - val isOptional = this.typeResolver.getRawClass(parameterType) == Optional::class.java - val argumentConverter = ArgumentConverter(mapper, parameterType) - val parameterClass = parameterType.unwrap() - val isConcreteScalar = isConcreteScalarType(definition.type, parameterType) - - args.add { environment -> - val argumentPresent = environment.arguments.containsKey(definition.name) - if (!argumentPresent && isNonNull) { - throw ResolverError("Missing required argument with name '${definition.name}', this is most likely a bug with graphql-java-tools") - } - - val value = environment.arguments[definition.name] - - if (value == null && isOptional) { - if (options.inputArgumentOptionalDetectOmission && !environment.containsArgument(definition.name)) { - return@add null - } - return@add Optional.empty() - } - - if (value == null || !isConcreteScalar || !parameterClass.isInstance(value)) { - return@add argumentConverter.convert(value) - } - - return@add value - } - } - - // Add DataFetchingEnvironment/Context arguments, stopping before the Continuation parameter of a suspend function - val firstTrailingParameter = field.inputValueDefinitions.size + search.firstArgumentIndex - method.parameterTypes.slice(firstTrailingParameter until numberOfParameters).forEach { parameterType -> - when (parameterType) { - GraphQLContext::class.java -> args.add { environment -> environment.graphQlContext } - - options.contextClass -> args.add { environment -> - environment.graphQlContext.get(parameterType) ?: throw ResolverError( - "Resolver method '${method.declaringClass.name}.${method.name}' has a parameter of the context class " + - "'${parameterType.name}', but the GraphQLContext has no value for it. Put it in the GraphQLContext under " + - "the class key when building the ExecutionInput, for example " + - "graphQLContext(mapOf(${parameterType.simpleName}::class.java to context))." - ) - } - - else -> args.add { environment -> environment } - } - } - - // the class the return type unwraps to, so a value that happens to implement Future isn't mistaken for a wrapper. - // Object (e.g. for a union) can't tell them apart, so then every future of a method whose return type is Future is checked - val valueClass = (TypeUtils.getRawType(getResolvedReturnType(), null) ?: Any::class.java) - .takeUnless { it == Any::class.java && TypeUtils.getRawType(returnType, null) == Future::class.java } - val unwrapper = ReturnValueUnwrapper.create(method, returnValueMatch.unwrapping, valueClass, isSuspendFunction, search.isSubscription, options.genericWrappers) - - return if (numberOfParameters > 0 || isSuspendFunction) { - // requires arguments and environment or is a suspend function - MethodFieldResolverDataFetcher(createSourceResolver(), this.method, args, options, isSuspendFunction, unwrapper) - } else { - // if there are no parameters an optimized version of the data fetcher can be used - LightMethodFieldResolverDataFetcher(createSourceResolver(), this.method, unwrapper) - } - } - - /** - * A concrete scalar type is a scalar type where values always coerce to the same Java type. The ID scalar type is not concrete - * because values can be coerced to multiple different Java types (eg. String, Long, UUID). All values of a non-concrete scalar - * type must be converted to the target method parameter type. - */ - private fun isConcreteScalarType(type: Type<*>, genericParameterType: JavaType): Boolean { - return when (type) { - is ListType -> genericParameterType.typeArgument(List::class.java) - ?.let { isConcreteScalarType(type.type, it) } ?: false - - is TypeName -> type.name in scalarNames && type.name != "ID" - is NonNullType -> isConcreteScalarType(type.type, genericParameterType) - else -> false - } - } - - override fun scanForMatches(): List { - return field.inputValueDefinitions.mapIndexed { i, inputDefinition -> - TypeClassMatcher.PotentialMatch.parameterType(inputDefinition.type, getMethodParameterType(i)!!, typeResolver, ScanDictionary.MethodParameterReference(method, i)) - } + listOf(returnValueMatch) - } - - // generic wrappers only match their exact type, so a Publisher implementation (e.g. Flux), or a future of one, - // is matched as a plain Publisher of its events - private fun JavaType.asPublisher(): JavaType = - (futureValueType() ?: this).typeArgument(Publisher::class.java) - ?.let { TypeUtils.parameterize(Publisher::class.java, it) } - ?: this - - // the declared return type with type variables resolved, e.g. Future for get(): T in a subclass of Base> - private val returnType: JavaType by lazy { - val declaredType = try { - method.kotlinFunction?.returnType?.javaType ?: method.genericReturnType - } catch (e: InternalError) { - method.genericReturnType - } - typeResolver.resolveTypeVariables(declaredType) - } - - private val returnValueMatch by lazy { - TypeClassMatcher.PotentialMatch.returnValue(field.type, matchedReturnType(), typeResolver, ScanDictionary.ReturnValueReference(method)) - } - - private fun matchedReturnType(): JavaType = if (search.isSubscription) returnType.asPublisher() else returnType - - private fun getResolvedReturnType(): JavaType = typeResolver.resolve(matchedReturnType()) - - private fun getJavaMethodParameterIndex(index: Int) = index + search.firstArgumentIndex - - internal fun getMethodParameterType(index: Int): JavaType? { - val methodIndex = getJavaMethodParameterIndex(index) - val parameters = method.parameterTypes - - return if (parameters.size > methodIndex) { - typeResolver.resolveTypeVariables(method.genericParameterTypes[methodIndex]) - } else { - null - } - } - - override fun toString() = "MethodFieldResolver{method=$method}" -} - -internal class MethodFieldResolverDataFetcher( - private val sourceResolver: SourceResolver, - private val method: Method, - private val args: List, - private val options: SchemaParserOptions, - private val isSuspendFunction: Boolean, - private val unwrapper: ReturnValueUnwrapper -) : DataFetcher { - - override fun get(environment: DataFetchingEnvironment): Any? { - val source = sourceResolver.resolve(environment, null) - val args = this.args.map { it(environment) }.toTypedArray() - - return if (isSuspendFunction) { - // start undispatched so DataLoader loads are queued before graphql-java dispatches them, - // which runs the block even if the context is already cancelled, hence ensureActive - environment.coroutineScope().future(options.coroutineContextProvider.provide(), CoroutineStart.UNDISPATCHED) { - ensureActive() - invokeSuspend(source, method, args)?.let { unwrapper.unwrapSuspending(it) { environment } } - } - } else { - invoke(method, source, args)?.let { unwrapper.unwrap(it) { environment } } - } - } - - /** - * Function that returns the object used to fetch the data. It can be a DataFetcher or an entity. - */ - @Suppress("unused") - fun getWrappedFetchingObject(environment: DataFetchingEnvironment): Any { - return sourceResolver.resolve(environment, null) - } -} - -/** - * Similar to [MethodFieldResolverDataFetcher] but for light data fetchers which do not require the environment to be supplied unless generic wrappers are used. - */ -internal class LightMethodFieldResolverDataFetcher( - private val sourceResolver: SourceResolver, - private val method: Method, - private val unwrapper: ReturnValueUnwrapper -) : LightDataFetcher { - - override fun get(fieldDefinition: GraphQLFieldDefinition?, sourceObject: Any?, environmentSupplier: Supplier): Any? { - val source = sourceResolver.resolve(null, sourceObject) - - return invoke(method, source, emptyArray())?.let { unwrapper.unwrap(it, environmentSupplier) } - } - - override fun get(environment: DataFetchingEnvironment): Any? { - return get(environment.fieldDefinition, sourceResolver.resolve(environment, null)) { environment } - } - - /** - * Function that returns the object used to fetch the data. It can be a DataFetcher or an entity. - */ - @Suppress("unused") - fun getWrappedFetchingObject(environment: DataFetchingEnvironment): Any { - return sourceResolver.resolve(environment, null) - } -} - -private suspend inline fun invokeSuspend(target: Any, resolverMethod: Method, args: Array): Any? { - return suspendCoroutineUninterceptedOrReturn { continuation -> - invoke(resolverMethod, target, args + continuation) - } -} - -private fun invoke(method: Method, instance: Any, args: Array): Any? { - try { - return method.invoke(instance, *args) - } catch (e: InvocationTargetException) { - throw e.cause ?: RuntimeException("Unknown error occurred while invoking resolver method") - } -} - -internal typealias ArgumentPlaceholder = (DataFetchingEnvironment) -> Any? diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/MissingFieldResolver.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/MissingFieldResolver.kt deleted file mode 100644 index 652af687..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/resolver/MissingFieldResolver.kt +++ /dev/null @@ -1,18 +0,0 @@ -package graphql.kickstart.tools.resolver - -import graphql.kickstart.tools.MissingResolverInfo -import graphql.kickstart.tools.SchemaParserOptions -import graphql.kickstart.tools.TypeClassMatcher -import graphql.language.FieldDefinition -import graphql.schema.DataFetcher - -internal class MissingFieldResolver( - field: FieldDefinition, - options: SchemaParserOptions -) : FieldResolver(field, FieldResolverScanner.Search(Any::class.java, MissingResolverInfo(), null), options) { - - private val missingResolverDataFetcherProvider: MissingResolverDataFetcherProvider = options.missingResolverDataFetcherProvider - ?: MissingResolverDataFetcherProvider { _, _ -> DataFetcher { TODO("Schema resolver not implemented") } } - override fun scanForMatches(): List = listOf() - override fun createDataFetcher(): DataFetcher<*> = missingResolverDataFetcherProvider.createDataFetcher(field, options) -} diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/PropertyFieldResolver.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/PropertyFieldResolver.kt deleted file mode 100644 index 1e6cb062..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/resolver/PropertyFieldResolver.kt +++ /dev/null @@ -1,54 +0,0 @@ -package graphql.kickstart.tools.resolver - -import graphql.kickstart.tools.ScanDictionary -import graphql.kickstart.tools.SchemaParserOptions -import graphql.kickstart.tools.TypeClassMatcher -import graphql.language.FieldDefinition -import graphql.schema.DataFetcher -import graphql.schema.DataFetchingEnvironment -import graphql.schema.GraphQLFieldDefinition -import graphql.schema.LightDataFetcher -import java.lang.reflect.Field -import java.util.function.Supplier - -/** - * @author Andrew Potter - */ -internal class PropertyFieldResolver( - field: FieldDefinition, - search: FieldResolverScanner.Search, - options: SchemaParserOptions, - val property: Field -) : FieldResolver(field, search, options) { - - override fun createDataFetcher(): DataFetcher<*> { - return PropertyFieldResolverDataFetcher(createSourceResolver(), property) - } - - override fun scanForMatches(): List { - return listOf( - TypeClassMatcher.PotentialMatch.returnValue( - field.type, - property.genericType, - typeResolver, - ScanDictionary.FieldTypeReference(property.toString()) - ) - ) - } - - override fun toString() = "PropertyFieldResolver{property=$property}" -} - -internal class PropertyFieldResolverDataFetcher( - private val sourceResolver: SourceResolver, - private val field: Field -) : LightDataFetcher { - - override fun get(fieldDefinition: GraphQLFieldDefinition, sourceObject: Any?, environmentSupplier: Supplier): Any? { - return field.get(sourceResolver.resolve(null, sourceObject)) - } - - override fun get(environment: DataFetchingEnvironment): Any? { - return get(environment.fieldDefinition, sourceResolver.resolve(environment, null)) { environment } - } -} diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/ResolverPlan.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/ResolverPlan.kt new file mode 100644 index 00000000..7d59234c --- /dev/null +++ b/src/main/kotlin/graphql/kickstart/tools/resolver/ResolverPlan.kt @@ -0,0 +1,652 @@ +package graphql.kickstart.tools.resolver + +import com.fasterxml.classmate.TypeResolver +import graphql.GraphQLContext +import graphql.Scalars +import graphql.kickstart.tools.MissingResolverInfo +import graphql.kickstart.tools.ResolverError +import graphql.kickstart.tools.ResolverInfo +import graphql.kickstart.tools.ResolverSearch +import graphql.kickstart.tools.RootResolverInfo +import graphql.kickstart.tools.ScanDictionary +import graphql.kickstart.tools.SchemaParserOptions +import graphql.kickstart.tools.util.GraphQLLangType +import graphql.kickstart.tools.util.JavaType +import graphql.kickstart.tools.util.coroutineScope +import graphql.kickstart.tools.util.eraseUnboundedWildcards +import graphql.kickstart.tools.util.snakeToCamelCase +import graphql.kickstart.tools.util.unwrap +import graphql.language.FieldDefinition +import graphql.language.InputValueDefinition +import graphql.language.NonNullType +import graphql.schema.DataFetcher +import graphql.schema.DataFetchingEnvironment +import graphql.schema.GraphQLFieldDefinition +import graphql.schema.LightDataFetcher +import graphql.schema.idl.ScalarInfo +import graphql.schema.idl.TypeUtil +import kotlinx.coroutines.CoroutineStart +import kotlinx.coroutines.ensureActive +import kotlinx.coroutines.future.future +import org.apache.commons.lang3.ClassUtils +import org.apache.commons.lang3.reflect.FieldUtils +import org.apache.commons.lang3.reflect.TypeUtils +import org.slf4j.LoggerFactory +import tools.jackson.databind.ObjectMapper +import java.lang.reflect.AccessibleObject +import java.lang.reflect.Field +import java.lang.reflect.InvocationTargetException +import java.lang.reflect.Method +import java.lang.reflect.Modifier +import java.lang.reflect.Proxy +import java.util.* +import java.util.function.Supplier +import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn +import kotlin.reflect.full.extensionReceiverParameter +import kotlin.reflect.jvm.javaType +import kotlin.reflect.jvm.kotlinFunction + +internal class ResolverPlan private constructor( + val field: FieldDefinition, + val search: ResolverSearch, + private val options: SchemaParserOptions, + private val member: Member? +) { + val resolverInfo: ResolverInfo get() = search.resolverInfo + + // provided at parse time, so the user's provider doesn't run for a schema that fails to scan + val objectMapper: ObjectMapper by lazy { options.objectMapperProvider.provide(field) } + + val argumentTargets: List get() = (member as? MethodMember)?.arguments.orEmpty() + + private val returnShape by lazy { + member?.let { TypeShape.returnType(field.type, it.declaredValueType, search.isSubscription, search.type, options, it.reference) } + } + + // each shape is walked only when the scanner gets to it, so an earlier match's dictionary error is reported first + fun typeShapes(): Sequence = sequence { + (member as? MethodMember)?.let { yieldAll(it.parameterShapes()) } + returnShape?.let { yield(it) } + } + + fun dataFetcher(): DataFetcher<*> = + member?.let(::fetcherOf) ?: (options.missingResolverDataFetcherProvider ?: notImplemented).createDataFetcher(field, options) + + private fun fetcherOf(member: Member): ResolverDataFetcher { + val source = sourceResolver() + val unwrapper = TypeShape.Unwrapper(returnShape!!, member.kind, member.name, member.isSuspend) + return when (member) { + is MethodMember -> { + val slots = member.slots(objectMapper) + if (slots.isNotEmpty() || member.isSuspend) { + MethodFieldResolverDataFetcher(source, member.method, slots, member.isSuspend, options, unwrapper) + } else { + LightMethodFieldResolverDataFetcher(source, member.method, unwrapper) + } + } + + is PropertyMember -> PropertyFieldResolverDataFetcher(source, member.property, unwrapper) + is MapMember -> MapFieldResolverDataFetcher(source, member.key, unwrapper) + } + } + + private fun sourceResolver(): SourceResolver { + val resolver = search.source + if (resolver != null) { + return SourceResolver { _, _ -> resolver } + } + + val type = search.type + return SourceResolver { environment, sourceObject -> + val source = sourceObject + ?: environment?.getSource() + ?: throw ResolverError("Expected DataFetchingEnvironment and source object to not be null!") + + if (!TypeUtils.isAssignable(source.javaClass, type)) { + throw ResolverError("Expected source object to be an instance of '${TypeUtils.getRawType(type, type).name}' but instead got '${source.javaClass.name}'") + } + + source + } + } + + fun notCallableOnResolver(objectType: String): NotCallableOnResolver? { + val source = search.source ?: return null + val javaMember = member?.javaMember ?: return null + if (Modifier.isStatic(javaMember.modifiers) || javaMember.declaringClass.isInstance(source)) { + return null + } + + return NotCallableOnResolver( + "Field '$objectType.${field.name}' resolves to ${javaMember.declaringClass.name}.${javaMember.name}, but the resolver is a " + + "${source.javaClass.name}, which isn't a ${javaMember.declaringClass.name}, so every query of the field will fail.", + javaMember is Field + ) + } + + fun requireParameterForEachArgument(objectType: String) { + val member = member as? MethodMember ?: return + val method = member.method + member.arguments.forEach { argument -> + val parameter = TypeUtils.getRawType(argument.type, search.type) ?: return@forEach + if (!ExtraParameter.takesArgumentSlot(parameter, argument.definition, options)) { + return@forEach + } + + throw FieldResolverError( + "Field '$objectType.${field.name}' has no parameter for its argument '${argument.definition.name}: " + + "${TypeUtil.simplePrint(argument.definition.type)}' in ${method.declaringClass.name}.${method.name}, so the ${parameter.simpleName} " + + "parameter gets the argument instead. Add a parameter for each argument, in order, before the ${parameter.simpleName} parameter." + ) + } + } + + override fun toString() = member.toString() + + data class ArgumentTarget(val definition: InputValueDefinition, val type: JavaType) + + data class NotCallableOnResolver(val message: String, val isField: Boolean) + + class Finder(private val options: SchemaParserOptions, private val scalarNames: Set) { + + // apps raise or silence these warnings by logger name in their logging config + private val log = LoggerFactory.getLogger("graphql.kickstart.tools.resolver.FieldResolverScanner") + + private val methodsByNameCache = mutableMapOf, Boolean>, Map>>() + + fun find(field: FieldDefinition, resolverInfo: ResolverInfo): ResolverPlan { + val searches = resolverInfo.getFieldSearches() + + val scanProperties = field.inputValueDefinitions.isEmpty() + val found = searches.mapNotNull { search -> findMember(field, search, scanProperties)?.let { plan(field, search, it) } } + + if (resolverInfo is RootResolverInfo && found.size > 1) { + throw FieldResolverError("Found more than one matching resolver for field '$field': $found") + } + + return found.firstOrNull() + ?: missingResolver(field) + ?: findSourcelessResolver(field, searches) + ?: throw FieldResolverError(getMissingFieldMessage(field, searches, scanProperties)) + } + + private fun plan(field: FieldDefinition, search: ResolverSearch, member: Member?) = ResolverPlan(field, search, options, member) + + private fun findMember(field: FieldDefinition, search: ResolverSearch, scanProperties: Boolean): Member? = + ResolverKind.entries.firstNotNullOfOrNull { kind -> + when (kind) { + ResolverKind.METHOD -> findResolverMethod(field, search) + ?.let { MethodMember(field, search, it.accessible(field, search.type), options, scalarNames) } + + ResolverKind.FIELD -> if (scanProperties) { + findResolverProperty(field, search)?.let { PropertyMember(it.accessible(field, search.type)) } + } else { + null + } + + ResolverKind.MAP_VALUE -> if (Map::class.java.isAssignableFrom(search.type.unwrap())) MapMember(field, search) else null + } + } + + private fun T.accessible(field: FieldDefinition, type: JavaType): T = apply { + try { + isAccessible = true + } catch (e: RuntimeException) { + log.warn("Unable to make field ${type.unwrap().name}#${field.name} accessible. " + + "Be sure to provide a resolver or open the enclosing module if possible.") + } + } + + private fun missingResolver(field: FieldDefinition): ResolverPlan? { + return if (options.allowUnimplementedResolvers || options.missingResolverDataFetcherProvider != null) { + if (options.allowUnimplementedResolvers) { + log.warn("Missing resolver for field: $field") + } + + plan(field, ResolverSearch(Any::class.java, MissingResolverInfo(), null), null) + } else { + null + } + } + + private fun findSourcelessResolver(field: FieldDefinition, searches: List): ResolverPlan? = + searches.firstNotNullOfOrNull { search -> + val sourceType = search.requiredFirstParameterType ?: return@firstNotNullOfOrNull null + val sourceless = search.withoutSourceParameter() + findMethodByName(field, sourceless) { isSourcelessMethod(it, field, sourceless, sourceType) }?.let { method -> + plan(field, sourceless, MethodMember(field, sourceless, method.accessible(field, search.type), options, scalarNames)) + } + } + + private fun isSourcelessMethod(method: Method, field: FieldDefinition, search: ResolverSearch, sourceType: Class<*>): Boolean { + val arguments = field.inputValueDefinitions + val parameterTypes = method.parameterTypes + + return method.parameterCountWithoutContinuation() > arguments.size && + arguments.indices.none { ExtraParameter.takesArgumentSlot(parameterTypes[it], arguments[it], options) } && + (arguments.isEmpty() || !couldTakeSource(parameterTypes[0], sourceType)) && + verifyMethodArguments(method, arguments.size, search) + } + + private fun couldTakeSource(parameterType: Class<*>, sourceType: Class<*>) = + sourceType.isAssignableFrom(parameterType) || parameterType.isAssignableFrom(sourceType) + + private fun findResolverMethod(field: FieldDefinition, search: ResolverSearch): Method? { + val argumentCount = field.inputValueDefinitions.size + search.firstArgumentIndex + return findMethodByName(field, search) { verifyMethodArguments(it, argumentCount, search) } + } + + private inline fun findMethodByName(field: FieldDefinition, search: ResolverSearch, matches: (Method) -> Boolean): Method? { + val methodsByName = getMethodsByName(search) + val name = field.name + val capitalizedName = name.replaceFirstChar(Char::titlecase) + + return listOfNotNull( + name, + if (isBoolean(field.type)) "is$capitalizedName" else null, + "get$capitalizedName", + "getField$capitalizedName", + "get${name.snakeToCamelCase()}" + ).firstNotNullOfOrNull { methodName -> + methodsByName[methodName]?.find { matches(it) } + } + } + + private fun getMethodsByName(search: ResolverSearch): Map> = + methodsByNameCache.getOrPut(search.type.unwrap() to search.isSubscription) { + getAllMethods(search).groupBy { it.name } + } + + private fun getAllMethods(search: ResolverSearch): List { + val type = search.type.unwrap() + val declaredMethods = if (Proxy.isProxyClass(type)) emptyList() else type.declaredMethods.toList() + val superClassesMethods = ClassUtils.getAllSuperclasses(type).flatMap { it.methods.toList() } + val interfacesMethods = ClassUtils.getAllInterfaces(type).flatMap { it.methods.toList() } + + return (declaredMethods + superClassesMethods + interfacesMethods) + .asSequence() + .filter { !it.isSynthetic } + .filter { !Modifier.isPrivate(it.modifiers) } + .filter { it.declaringClass != Any::class.java } + .filter { !search.isSubscription || returnsPublisher(it.returnType, it.genericReturnType, options.genericWrappers) } + .toList() + } + + private fun isBoolean(type: GraphQLLangType) = type.unwrap().name == Scalars.GraphQLBoolean.name + + private fun verifyMethodArguments(method: Method, requiredCount: Int, search: ResolverSearch): Boolean { + val appropriateFirstParameter = if (search.requiredFirstParameterType != null) { + method.genericParameterTypes.firstOrNull()?.let { + it.eraseUnboundedWildcards() == search.requiredFirstParameterType || method.declaringClass.typeParameters.contains(it) + } ?: false + } else { + !isExtensionFunction(method) + } + + val methodParameterCount = method.parameterCountWithoutContinuation() + + val correctParameterCount = methodParameterCount >= requiredCount && + method.parameterTypes.slice(requiredCount until methodParameterCount).all { ExtraParameter.of(it, options) != null } + return correctParameterCount && appropriateFirstParameter + } + + private fun isExtensionFunction(method: Method): Boolean { + return try { + method.kotlinFunction?.extensionReceiverParameter != null + } catch (e: InternalError) { + false + } + } + + private fun findResolverProperty(field: FieldDefinition, search: ResolverSearch) = + FieldUtils.getAllFields(search.type.unwrap()).find { it.name == field.name } + + private fun getMissingFieldMessage(field: FieldDefinition, searches: List, scannedProperties: Boolean): String { + val signatures = mutableListOf("") + val isBoolean = isBoolean(field.type) + var isSubscription = false + + searches.forEach { search -> + signatures.addAll(getMissingMethodSignatures(field, search, isBoolean, scannedProperties)) + isSubscription = isSubscription || search.isSubscription + } + searches.filter { it.requiredFirstParameterType != null }.forEach { search -> + signatures.addAll(getMissingMethodSignatures(field, search.withoutSourceParameter(), isBoolean, false, "")) + } + + val sourceName = field.sourceLocation?.sourceName ?: "" + val sourceLocation = field.sourceLocation?.let { "$sourceName:${it.line}" } ?: "" + + return "No method${if (scannedProperties) " or field" else ""} found as defined in schema $sourceLocation with any of the following signatures " + + "(optionally followed by any of ${ExtraParameter.types(options)}), in priority order:\n${signatures.joinToString("\n ")}" + + if (isSubscription) "\n\nNote that a Subscription data fetcher must return a Publisher of events" else "" + } + + private fun getMissingMethodSignatures( + field: FieldDefinition, + search: ResolverSearch, + isBoolean: Boolean, + scannedProperties: Boolean, + trailingParameter: String? = null + ): List { + val baseType = search.type.unwrap() + val signatures = mutableListOf() + val args = mutableListOf() + val sep = ", " + + if (search.requiredFirstParameterType != null) { + args.add(search.requiredFirstParameterType.name) + } + + args.addAll(field.inputValueDefinitions.map { "~${it.name}" }) + trailingParameter?.let(args::add) + + val argString = args.joinToString(sep) + + signatures.add("${baseType.name}.${field.name}($argString)") + if (isBoolean) { + signatures.add("${baseType.name}.is${field.name.replaceFirstChar(Char::titlecase)}($argString)") + } + signatures.add("${baseType.name}.get${field.name.replaceFirstChar(Char::titlecase)}($argString)") + if (scannedProperties) { + signatures.add("${baseType.name}.${field.name}") + } + + return signatures + } + } + + private companion object { + val notImplemented = MissingResolverDataFetcherProvider { _, _ -> DataFetcher { TODO("Schema resolver not implemented") } } + } +} + +internal enum class ResolverKind(val noun: String, val holdCompletionStage: String, val unwrapsUntypedValues: Boolean = true) { + METHOD("method", "Return a CompletionStage, such as a CompletableFuture, from the method or its generic wrapper transformer instead."), + FIELD("field", "Assign a CompletionStage, such as a CompletableFuture, to the field, or return one from its generic wrapper transformer instead."), + MAP_VALUE( + "map value", "Put a CompletionStage, such as a CompletableFuture, in the map, or return one from its generic wrapper transformer instead.", + unwrapsUntypedValues = false + ) +} + +internal enum class ExtraParameter(private val bindingPrecedence: Int) { + ENVIRONMENT(bindingPrecedence = 2) { + override fun type(options: SchemaParserOptions): Class<*> = DataFetchingEnvironment::class.java + override fun takesArgumentSlotOf(argument: InputValueDefinition) = true + override fun bind(parameterType: Class<*>, method: Method): (DataFetchingEnvironment) -> Any? = { environment -> environment } + }, + GRAPHQL_CONTEXT(bindingPrecedence = 0) { + override fun type(options: SchemaParserOptions): Class<*> = GraphQLContext::class.java + override fun takesArgumentSlotOf(argument: InputValueDefinition) = true + override fun bind(parameterType: Class<*>, method: Method): (DataFetchingEnvironment) -> Any? = { environment -> environment.graphQlContext } + }, + CONTEXT_CLASS(bindingPrecedence = 1) { + override fun type(options: SchemaParserOptions): Class<*>? = options.contextClass + + // the context class can also be an argument's type (e.g. a Map for an input object), so only spec scalars count for it + override fun takesArgumentSlotOf(argument: InputValueDefinition) = + argument.type.unwrap().name in ScalarInfo.GRAPHQL_SPECIFICATION_SCALARS_DEFINITIONS + + override fun bind(parameterType: Class<*>, method: Method): (DataFetchingEnvironment) -> Any? = { environment -> + environment.graphQlContext.get(parameterType) ?: throw ResolverError( + "Resolver method '${method.declaringClass.name}.${method.name}' has a parameter of the context class " + + "'${parameterType.name}', but the GraphQLContext has no value for it. Put it in the GraphQLContext under " + + "the class key when building the ExecutionInput, for example " + + "graphQLContext(mapOf(${parameterType.simpleName}::class.java to context))." + ) + } + }; + + abstract fun type(options: SchemaParserOptions): Class<*>? + + abstract fun takesArgumentSlotOf(argument: InputValueDefinition): Boolean + + abstract fun bind(parameterType: Class<*>, method: Method): (DataFetchingEnvironment) -> Any? + + companion object { + private val byBindingPrecedence = entries.sortedBy { it.bindingPrecedence } + + fun types(options: SchemaParserOptions): List> = entries.mapNotNull { it.type(options) } + + fun of(parameterType: Class<*>, options: SchemaParserOptions): ExtraParameter? = + byBindingPrecedence.find { it.type(options) == parameterType } + + fun takesArgumentSlot(parameterType: Class<*>, argument: InputValueDefinition, options: SchemaParserOptions): Boolean { + val matching = entries.filter { it.type(options) == parameterType } + return matching.isNotEmpty() && matching.all { it.takesArgumentSlotOf(argument) } + } + } +} + +internal class FieldResolverError(msg: String) : RuntimeException(msg) + +private sealed class Member(val kind: ResolverKind) { + abstract val name: String + abstract val declaredValueType: JavaType + abstract val reference: ScanDictionary.Reference + abstract val javaMember: java.lang.reflect.Member? + open val isSuspend get() = false +} + +private class MethodMember( + field: FieldDefinition, + private val search: ResolverSearch, + val method: Method, + private val options: SchemaParserOptions, + private val scalarNames: Set +) : Member(ResolverKind.METHOD) { + override val isSuspend = method.isSuspendFunction() + + override val name get() = "${method.declaringClass.name}.${method.name}" + override val javaMember get() = method + override val reference get() = ScanDictionary.ReturnValueReference(method) + + override val declaredValueType: JavaType + get() { + val declaredType = try { + method.kotlinFunction?.returnType?.javaType ?: method.genericReturnType + } catch (e: InternalError) { + method.genericReturnType + } + return resolveTypeVariables(declaredType, search.type) + } + + val arguments: List = field.inputValueDefinitions.mapIndexed { index, definition -> + ResolverPlan.ArgumentTarget(definition, resolveTypeVariables(method.genericParameterTypes[index + search.firstArgumentIndex], search.type)) + } + + fun parameterShapes(): Sequence = arguments.asSequence().mapIndexed { index, (definition, type) -> + TypeShape.parameterType(definition.type, type, search.type, options, ScanDictionary.MethodParameterReference(method, index)) + } + + fun slots(mapper: ObjectMapper): Array<(DataFetchingEnvironment) -> Any?> { + val slots = mutableListOf<(DataFetchingEnvironment) -> Any?>() + + search.requiredFirstParameterType?.let { expectedType -> + slots.add { environment -> + val source = environment.getSource() + ?: throw ResolverError("Expected source object to not be null!") + if (!expectedType.isAssignableFrom(source.javaClass)) { + throw ResolverError("Source type (${source.javaClass.name}) is not expected type (${expectedType.name})!") + } + + source + } + } + + arguments.forEach { slots.add(argumentSlot(it, mapper)) } + + method.parameterTypes.slice(slots.size until method.parameterCountWithoutContinuation()).forEach { parameterType -> + slots.add(ExtraParameter.of(parameterType, options)!!.bind(parameterType, method)) + } + + return slots.toTypedArray() + } + + private fun argumentSlot(argument: ResolverPlan.ArgumentTarget, mapper: ObjectMapper): (DataFetchingEnvironment) -> Any? { + val definition = argument.definition + val isNonNull = definition.type is NonNullType + val isOptional = isOptionalParameter(argument.type, search.type) + val argumentConverter = ArgumentConverter(mapper, argument.type) + val parameterClass = argument.type.unwrap() + val isConcreteScalar = isConcreteScalarType(definition.type, argument.type, scalarNames) + + return slot@{ environment -> + val argumentPresent = environment.arguments.containsKey(definition.name) + if (!argumentPresent && isNonNull) { + throw ResolverError("Missing required argument with name '${definition.name}', this is most likely a bug with graphql-java-tools") + } + + val value = environment.arguments[definition.name] + + if (value == null && isOptional) { + if (options.inputArgumentOptionalDetectOmission && !environment.containsArgument(definition.name)) { + return@slot null + } + return@slot Optional.empty() + } + + if (value == null || !isConcreteScalar || !parameterClass.isInstance(value)) { + return@slot argumentConverter.convert(value) + } + + return@slot value + } + } + + // the build error for a field more than one root resolver serves lists the resolvers by these names + override fun toString() = "MethodFieldResolver{method=$method}" +} + +private class PropertyMember(val property: Field) : Member(ResolverKind.FIELD) { + override val name get() = "${property.declaringClass.name}.${property.name}" + override val javaMember get() = property + override val declaredValueType: JavaType get() = property.genericType + override val reference get() = ScanDictionary.FieldTypeReference(property.toString()) + + override fun toString() = "PropertyFieldResolver{property=$property}" +} + +private class MapMember(field: FieldDefinition, private val search: ResolverSearch) : Member(ResolverKind.MAP_VALUE) { + val key: String = field.name + + override val declaredValueType: JavaType = + TypeResolver().resolve(search.type.unwrap()).typeParametersFor(Map::class.java).elementAtOrElse(1) { Any::class.java } + + override val name get() = "${search.type.unwrap().name}.$key" + override val javaMember: java.lang.reflect.Member? get() = null + override val reference get() = ScanDictionary.FieldTypeReference(key) + + override fun toString() = "MapFieldResolver{key=$key}" +} + +internal sealed class ResolverDataFetcher(protected val source: SourceResolver, protected val unwrapper: TypeShape.Unwrapper) : DataFetcher + +internal class MethodFieldResolverDataFetcher( + source: SourceResolver, + private val method: Method, + private val slots: Array<(DataFetchingEnvironment) -> Any?>, + private val isSuspend: Boolean, + private val options: SchemaParserOptions, + unwrapper: TypeShape.Unwrapper +) : ResolverDataFetcher(source, unwrapper) { + + override fun get(environment: DataFetchingEnvironment): Any? { + val target = source.resolve(environment, null) + val arguments = arrayOfNulls(if (isSuspend) slots.size + 1 else slots.size) + for (index in slots.indices) { + arguments[index] = slots[index](environment) + } + + return if (isSuspend) { + // start undispatched so DataLoader loads are queued before graphql-java dispatches them, + // which runs the block even if the context is already cancelled, hence ensureActive + environment.coroutineScope().future(options.coroutineContextProvider.provide(), CoroutineStart.UNDISPATCHED) { + ensureActive() + invokeSuspending(method, target, arguments)?.let { unwrapper.unwrapSuspending(it) { environment } } + } + } else { + invoke(method, target, arguments)?.let { unwrapper.unwrap(it) { environment } } + } + } + + /** + * The object the method is called on, the resolver or the source object. Apps call this by reflection from graphql-java's + * `Instrumentation.instrumentDataFetcher` to reach the resolver behind a field. + */ + fun getWrappedFetchingObject(environment: DataFetchingEnvironment): Any = source.resolve(environment, null) +} + +internal class LightMethodFieldResolverDataFetcher( + source: SourceResolver, + private val method: Method, + unwrapper: TypeShape.Unwrapper +) : ResolverDataFetcher(source, unwrapper), LightDataFetcher { + + override fun get(fieldDefinition: GraphQLFieldDefinition?, sourceObject: Any?, environmentSupplier: Supplier): Any? = + invoke(method, source.resolve(null, sourceObject), noArguments)?.let { unwrapper.unwrap(it, environmentSupplier) } + + override fun get(environment: DataFetchingEnvironment): Any? = + get(environment.fieldDefinition, source.resolve(environment, null)) { environment } + + /** + * See [MethodFieldResolverDataFetcher.getWrappedFetchingObject]. + */ + fun getWrappedFetchingObject(environment: DataFetchingEnvironment): Any = source.resolve(environment, null) +} + +internal class PropertyFieldResolverDataFetcher( + source: SourceResolver, + private val property: Field, + unwrapper: TypeShape.Unwrapper +) : ResolverDataFetcher(source, unwrapper), LightDataFetcher { + + override fun get(fieldDefinition: GraphQLFieldDefinition?, sourceObject: Any?, environmentSupplier: Supplier): Any? = + property.get(source.resolve(null, sourceObject))?.let { unwrapper.unwrap(it, environmentSupplier) } + + override fun get(environment: DataFetchingEnvironment): Any? = + get(environment.fieldDefinition, source.resolve(environment, null)) { environment } +} + +internal class MapFieldResolverDataFetcher( + source: SourceResolver, + private val key: String, + unwrapper: TypeShape.Unwrapper +) : ResolverDataFetcher(source, unwrapper), LightDataFetcher { + + override fun get(fieldDefinition: GraphQLFieldDefinition?, sourceObject: Any?, environmentSupplier: Supplier): Any? { + val map = sourceObject as? Map<*, *> ?: throw RuntimeException("MapFieldResolver attempt to fetch a field from an object instance that was not a map") + return map[key]?.let { unwrapper.unwrap(it, environmentSupplier) } + } + + override fun get(environment: DataFetchingEnvironment): Any? = + get(environment.fieldDefinition, source.resolve(environment, null)) { environment } +} + +private val noArguments = emptyArray() + +private suspend fun invokeSuspending(method: Method, instance: Any, arguments: Array): Any? = + suspendCoroutineUninterceptedOrReturn { continuation -> + arguments[arguments.lastIndex] = continuation + invoke(method, instance, arguments) + } + +private fun invoke(method: Method, instance: Any, arguments: Array): Any? { + try { + return method.invoke(instance, *arguments) + } catch (e: InvocationTargetException) { + throw e.cause ?: RuntimeException("Unknown error occurred while invoking resolver method") + } +} + +private fun Method.isSuspendFunction(): Boolean { + return try { + this.kotlinFunction?.isSuspend == true + } catch (e: InternalError) { + false + } +} + +private fun Method.parameterCountWithoutContinuation(): Int = + if (isSuspendFunction()) parameterCount - 1 else parameterCount diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/ReturnValueUnwrapper.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/ReturnValueUnwrapper.kt deleted file mode 100644 index 2c28bc27..00000000 --- a/src/main/kotlin/graphql/kickstart/tools/resolver/ReturnValueUnwrapper.kt +++ /dev/null @@ -1,188 +0,0 @@ -package graphql.kickstart.tools.resolver - -import graphql.execution.DataFetcherResult -import graphql.kickstart.tools.ResolverError -import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper -import graphql.kickstart.tools.TypeClassMatcher.Unwrapped -import graphql.kickstart.tools.TypeClassMatcher.Unwrapping -import graphql.schema.DataFetchingEnvironment -import kotlinx.coroutines.future.asDeferred -import org.apache.commons.lang3.reflect.TypeUtils -import java.lang.reflect.Method -import java.util.* -import java.util.concurrent.CompletableFuture -import java.util.concurrent.CompletionStage -import java.util.concurrent.Future -import java.util.function.Supplier - -internal class ReturnValueUnwrapper private constructor( - private val genericWrappers: List, - private val awaitable: Awaitable, - private val isOutermostFuture: Boolean, - private val nested: Step? -) { - - fun unwrap(value: Any, environmentSupplier: Supplier): Any? { - val wrapper = genericWrappers.wrapperOf(value) - val transformed = if (wrapper == null) value else wrapper.transformer(value, environmentSupplier.get()) - val unwrapped = awaitable.requireOutermost(transformed) - return if (isOutermostFuture || wrapper?.transformerReturnsCompletionStage == true) { - unwrapped.then(nested, environmentSupplier) - } else { - unwrapped.thenUnlessNextAwaits(nested, environmentSupplier) - } - } - - suspend fun unwrapSuspending(value: Any, environmentSupplier: Supplier): Any? { - val unwrapped = unwrap(value, environmentSupplier) - // the coroutine's future would complete with the future made below the outermost value, which graphql-java - // doesn't wait on. asDeferred, so cancelling the coroutine doesn't cancel a future the resolver returned - return if (nested != null && unwrapped is CompletionStage<*>) unwrapped.asDeferred().await() else unwrapped - } - - companion object { - fun create( - method: Method, - unwrapping: Unwrapping, - valueClass: Class<*>?, - isSuspendFunction: Boolean, - isSubscription: Boolean, - genericWrappers: List - ): ReturnValueUnwrapper { - val unwrapped = unwrapping.unwrapped - val outermost = unwrapped.firstOrNull() as? Unwrapped.Wrapper - val belowOutermost = if (outermost == null) unwrapped else unwrapped.drop(1) - val leafClass = TypeUtils.getRawType(unwrapping.javaType, null) - val specificLeafClass = leafClass?.takeUnless { it == Any::class.java } - val awaits = Awaitable(method, specificLeafClass, isSuspendFunction) - val peels = Awaitable(method, leafClass, isSuspendFunction) - // graphql-java completes a subscription's events one at a time - val nested = if (isSubscription) null else steps(belowOutermost, awaits, peels) - return ReturnValueUnwrapper(genericWrappers, Awaitable(method, valueClass, isSuspendFunction), outermost?.isFuture == true, nested) - } - } -} - -private sealed interface Step { - fun unwrap(value: Any?, environmentSupplier: Supplier): Any? -} - -private class Await(private val wrapper: GenericWrapper, private val awaitable: Awaitable, private val next: Step?) : Step { - override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = - awaitable.requireNested(value?.let { wrapper.transformer(it, environmentSupplier.get()) }).then(next, environmentSupplier) -} - -private class Peel(private val wrapper: GenericWrapper, private val awaitable: Awaitable, private val next: Step?) : Step { - override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? { - val transformed = value?.let { wrapper.transformer(it, environmentSupplier.get()) } - return if (next is Await && !wrapper.transformerReturnsCompletionStage) { - next.unwrap(transformed, environmentSupplier) - } else { - awaitable.requireNested(transformed).then(next, environmentSupplier) - } - } -} - -private class EachElement(private val element: Step) : Step { - override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = - if (value is Iterable<*>) value.map { element.unwrap(it, environmentSupplier) }.awaitAll() else value -} - -private class DataOf(private val data: Step) : Step { - @Suppress("UNCHECKED_CAST") - override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = - if (value is DataFetcherResult<*>) { - data.unwrap(value.data, environmentSupplier).then { unwrapped -> (value as DataFetcherResult).map { unwrapped } } - } else { - value - } -} - -private class ValueOf(private val present: Step?) : Step { - override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = when { - value !is Optional<*> -> value - present == null -> value.orElse(null) - else -> present.unwrap(value.orElse(null), environmentSupplier) - } -} - -private val Unwrapped.Wrapper.isFuture - get() = Future::class.java.isAssignableFrom(wrapper.type) || CompletionStage::class.java.isAssignableFrom(wrapper.type) - -private fun steps(unwrapped: List, awaits: Awaitable, peels: Awaitable): Step? { - val outermost = unwrapped.firstOrNull() ?: return null - val inner = unwrapped.subList(1, unwrapped.size) - val next = steps(inner, awaits, peels) - return when (outermost) { - is Unwrapped.Wrapper -> if (outermost.isFuture) Await(outermost.wrapper, awaits, next) else Peel(outermost.wrapper, peels, next) - Unwrapped.Data -> next?.let(::DataOf) - // graphql-java reads a DataFetcherResult and then an Optional in its data, so an Optional around one is ours to unwrap - Unwrapped.Present -> if (next != null || inner.firstOrNull() == Unwrapped.Data) ValueOf(next) else null - Unwrapped.Elements -> next?.let(::EachElement) - } -} - -private fun Any?.thenUnlessNextAwaits(next: Step?, environmentSupplier: Supplier): Any? = - if (next is Await) next.unwrap(this, environmentSupplier) else then(next, environmentSupplier) - -private fun Any?.then(next: Step?, environmentSupplier: Supplier): Any? = - if (next == null) this else then { next.unwrap(it, environmentSupplier) } - -private inline fun Any?.then(crossinline next: (Any?) -> Any?): Any? = - if (this is CompletionStage<*>) thenCompose { next(it).asCompletionStage() } else next(this) - -private fun List.awaitAll(): Any { - if (none { it is CompletionStage<*> }) { - return this - } - val futures = map { it.asCompletionStage().toCompletableFuture() } - return CompletableFuture.allOf(*futures.toTypedArray()).thenApply { futures.map { it.join() } } -} - -@Suppress("UNCHECKED_CAST") -private fun Any?.asCompletionStage(): CompletionStage = - this as? CompletionStage ?: CompletableFuture.completedFuture(this) - -private fun List.wrapperOf(value: Any): GenericWrapper? { - // the JIT doesn't optimize away the sequence below on this call path, so values that aren't wrappers, which is - // most of them, return before it's allocated - if (none { it.type.isInstance(value) }) { - return null - } - return asSequence() - .filter { it.type.isInstance(value) } - .sortedWith(CompareGenericWrappers) - .firstOrNull() -} - -// graphql-java only waits on a CompletionStage returned by a data fetcher, so any other future, or a future -// that a suspend function completes with, would reach it as the field value -private class Awaitable(private val method: Method, private val valueClass: Class<*>?, private val isSuspendFunction: Boolean) { - - fun requireOutermost(value: Any?): Any? = - if (value !is Future<*> || valueClass?.isInstance(value) == true || value is CompletionStage<*> && !isSuspendFunction) value else fail(value) - - fun requireNested(value: Any?): Any? = - if (value !is Future<*> || value is CompletionStage<*> || valueClass?.isInstance(value) == true) value else fail(value) - - private fun fail(value: Any): Nothing = throw ResolverError( - if (isSuspendFunction) { - "Suspend function '${method.resolverName}' resolved to a ${value.javaClass.name}, which graphql-java can't wait on. Return its value instead." - } else { - "Resolver method '${method.resolverName}' resolved to a ${value.javaClass.name}, which graphql-java can't wait on. " + - "Return a CompletionStage, such as a CompletableFuture, from the method or its generic wrapper transformer instead." - } - ) -} - -private val Method.resolverName - get() = "${declaringClass.name}.$name" - -private class CompareGenericWrappers { - companion object : Comparator { - override fun compare(w1: GenericWrapper, w2: GenericWrapper): Int = when { - w1.type.isAssignableFrom(w2.type) -> 1 - else -> -1 - } - } -} diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/SourceResolver.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/SourceResolver.kt new file mode 100644 index 00000000..90dd4676 --- /dev/null +++ b/src/main/kotlin/graphql/kickstart/tools/resolver/SourceResolver.kt @@ -0,0 +1,8 @@ +package graphql.kickstart.tools.resolver + +import graphql.schema.DataFetchingEnvironment + +fun interface SourceResolver { + + fun resolve(environment: DataFetchingEnvironment?, source: Any?): Any +} diff --git a/src/main/kotlin/graphql/kickstart/tools/resolver/TypeShape.kt b/src/main/kotlin/graphql/kickstart/tools/resolver/TypeShape.kt new file mode 100644 index 00000000..57c4a239 --- /dev/null +++ b/src/main/kotlin/graphql/kickstart/tools/resolver/TypeShape.kt @@ -0,0 +1,455 @@ +package graphql.kickstart.tools.resolver + +import com.fasterxml.classmate.ResolvedType +import graphql.execution.DataFetcherResult +import graphql.kickstart.tools.ResolverError +import graphql.kickstart.tools.ScanDictionary +import graphql.kickstart.tools.SchemaClassScannerError +import graphql.kickstart.tools.SchemaParserOptions +import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper +import graphql.kickstart.tools.util.GraphQLLangType +import graphql.kickstart.tools.util.JavaType +import graphql.kickstart.tools.util.ParameterizedTypeImpl +import graphql.kickstart.tools.util.Primitives +import graphql.kickstart.tools.util.futureValueType +import graphql.kickstart.tools.util.isSubtypeOf +import graphql.kickstart.tools.util.typeArgument +import graphql.language.ListType +import graphql.language.NonNullType +import graphql.language.TypeName +import graphql.schema.DataFetchingEnvironment +import graphql.schema.idl.TypeUtil +import kotlinx.coroutines.channels.ReceiveChannel +import kotlinx.coroutines.future.asDeferred +import org.apache.commons.lang3.reflect.TypeUtils +import org.reactivestreams.Publisher +import java.lang.reflect.ParameterizedType +import java.lang.reflect.TypeVariable +import java.lang.reflect.WildcardType +import java.util.* +import java.util.concurrent.CompletableFuture +import java.util.concurrent.CompletionStage +import java.util.concurrent.Future +import java.util.function.Supplier + +// the leaf the dictionary binds and the layers a value is unwrapped through come from one walk, so they can't disagree +internal class TypeShape private constructor( + private val graphQLType: GraphQLLangType, + private val javaType: JavaType, + val reference: ScanDictionary.Reference, + val leafGraphQLType: GraphQLLangType, + val leafJavaType: JavaType, + private val layers: List, + private val declaredType: JavaType, + private val unwrappedRootType: JavaType, + private val isSubscription: Boolean, + private val wrappers: GenericWrappers +) { + + fun error(msg: String) = matchError(graphQLType, reference, javaType, msg) + + class Unwrapper(shape: TypeShape, resolverKind: ResolverKind, resolverName: String, isSuspendFunction: Boolean = false) { + private val returnsValueAsIs = !resolverKind.unwrapsUntypedValues && shape.declaredType == Any::class.java + private val wrappers = shape.wrappers + private val awaitable: Awaitable + private val isOutermostFuture: Boolean + private val nested: Step? + + init { + // the class the declared type unwraps to, so a value that happens to implement Future isn't mistaken for a wrapper. + // Object (e.g. for a union) can't tell them apart, so then every future of a value declared as Future is checked + val valueClass = (TypeUtils.getRawType(shape.unwrappedRootType, null) ?: Any::class.java) + .takeUnless { it == Any::class.java && TypeUtils.getRawType(shape.declaredType, null) == Future::class.java } + awaitable = Awaitable(resolverKind, resolverName, valueClass, isSuspendFunction) + val outermost = shape.layers.firstOrNull() as? Layer.Wrapper + val belowOutermost = if (outermost == null) shape.layers else shape.layers.drop(1) + val leafClass = TypeUtils.getRawType(shape.leafJavaType, null) + val awaits = Awaitable(resolverKind, resolverName, leafClass?.takeUnless { it == Any::class.java }, isSuspendFunction) + val peels = Awaitable(resolverKind, resolverName, leafClass, isSuspendFunction) + isOutermostFuture = outermost?.isFuture == true + // graphql-java completes a subscription's events one at a time + nested = if (shape.isSubscription) null else steps(belowOutermost, awaits, peels) + } + + fun unwrap(value: Any, environmentSupplier: Supplier): Any? { + if (returnsValueAsIs) { + return value + } + val wrapper = wrappers.ofValue(value) + val transformed = if (wrapper == null) value else wrapper.transformer(value, environmentSupplier.get()) + val unwrapped = awaitable.requireOutermost(transformed) + return if (isOutermostFuture || wrapper?.transformerReturnsCompletionStage == true) { + unwrapped.then(nested, environmentSupplier) + } else { + unwrapped.thenUnlessNextAwaits(nested, environmentSupplier) + } + } + + suspend fun unwrapSuspending(value: Any, environmentSupplier: Supplier): Any? { + val unwrapped = unwrap(value, environmentSupplier) + // the coroutine's future would complete with the future made below the outermost value, which graphql-java + // doesn't wait on. asDeferred, so cancelling the coroutine doesn't cancel a future the resolver returned + return if (nested != null && unwrapped is CompletionStage<*>) unwrapped.asDeferred().await() else unwrapped + } + } + + companion object { + val containerTypes: List> get() = ContainerKind.entries.map { it.type } + + fun returnType( + graphQLType: GraphQLLangType, + declaredType: JavaType, + isSubscription: Boolean, + containingType: JavaType, + options: SchemaParserOptions, + reference: ScanDictionary.Reference + ): TypeShape { + val javaType = if (isSubscription) declaredType.asPublisher() else declaredType + val walk = Walk(graphQLType, javaType, containingType, GenericWrappers(options.genericWrappers), reference, Position.RETURN_TYPE) + val (leafGraphQLType, leafJavaType) = walk.leaf() + return TypeShape( + graphQLType, javaType, reference, leafGraphQLType, leafJavaType, walk.layers, resolveTypeVariables(declaredType, containingType), + walk.unwrappedRootType, isSubscription, walk.wrappers + ) + } + + fun parameterType( + graphQLType: GraphQLLangType, + javaType: JavaType, + containingType: JavaType, + options: SchemaParserOptions, + reference: ScanDictionary.Reference + ): TypeShape { + val walk = Walk(graphQLType, javaType, containingType, GenericWrappers(options.genericWrappers), reference, Position.PARAMETER_TYPE) + val (leafGraphQLType, leafJavaType) = walk.leaf() + return TypeShape(graphQLType, javaType, reference, leafGraphQLType, leafJavaType, walk.layers, javaType, walk.unwrappedRootType, false, walk.wrappers) + } + } +} + +// unlike the walk, keeps generic wrappers, wildcards and primitives, which argument conversion needs +internal fun resolveTypeVariables(type: JavaType, containingType: JavaType, resolving: Set> = emptySet()): JavaType { + return when (type) { + is ParameterizedType -> { + val actualTypeArguments = type.actualTypeArguments.map { resolveTypeVariables(it, containingType, resolving) }.toTypedArray() + ParameterizedTypeImpl(type.rawType as Class<*>, actualTypeArguments, type.ownerType?.let { resolveTypeVariables(it, containingType, resolving) }) + } + is WildcardType -> TypeUtils.wildcardType() + .withUpperBounds(*type.upperBounds.map { resolveTypeVariables(it, containingType, resolving) }.toTypedArray()) + .withLowerBounds(*type.lowerBounds.map { resolveTypeVariables(it, containingType, resolving) }.toTypedArray()) + .build() + is ResolvedType -> { + if (type.typeParameters.isEmpty()) { + type.erasedType + } else { + val actualTypeArguments = type.typeParameters.map { resolveTypeVariables(it, containingType) }.toTypedArray() + ParameterizedTypeImpl(type.erasedType, actualTypeArguments, null) + } + } + is TypeVariable<*> -> { + val genericDeclaration = type.genericDeclaration + when { + // only a variable leaked from a raw type can be bound to a type containing itself (e.g. T -> List), + // erase it like the raw type does instead of expanding it forever + type in resolving -> TypeUtils.getRawType(type.bounds.first(), null) ?: Any::class.java + genericDeclaration is Class<*> -> generateSequence(containingType) { (it as? ParameterizedType)?.ownerType } + // an inner class can also use the variables of its outer class, those are bound by its owner type (e.g. Connection.Entry) + .firstNotNullOfOrNull { TypeUtils.getTypeArguments(it, genericDeclaration)?.get(type) } + // keep the full type argument (e.g. List) rather than its raw class so nested generics aren't lost + ?.let { resolveTypeVariables(it, containingType, resolving + type) } + ?: type + else -> type + } + } + else -> type + } +} + +private enum class Position { + RETURN_TYPE, + PARAMETER_TYPE, +} + +private class Walk( + private val graphQLType: GraphQLLangType, + private val javaType: JavaType, + private val containingType: JavaType, + val wrappers: GenericWrappers, + private val reference: ScanDictionary.Reference, + private val position: Position +) { + val layers = mutableListOf() + + lateinit var unwrappedRootType: JavaType + private set + + fun leaf(): Pair = walk(graphQLType, javaType, root = true) + + private fun walk(graphQLType: GraphQLLangType, javaType: JavaType, root: Boolean): Pair { + var realType = matchedType(javaType) + if (root) { + unwrappedRootType = realType + } + val contained = mutableSetOf() + + while (true) { + val type = realType as? ParameterizedType ?: break + val kind = ContainerKind.entries.find { type.isSubtypeOf(it.type) } ?: break + kind.placementError(position, root)?.let { throw mismatch(it) } + if (!contained.add(kind)) { + throw mismatch("${kind.type.name} cannot be nested within itself") + } + layers += kind + realType = matchedType(type.actualTypeArguments.first()) + } + + return when (graphQLType) { + is NonNullType -> { + contained.find { !it.canBeNonNull }?.let { throw mismatch("graphql type is marked as nonnull but ${it.type.name} was used") } + walk(graphQLType.type, realType, root = false) + } + + is ListType -> when { + realType is ParameterizedType && realType.isSubtypeOf(Iterable::class.java) -> { + layers += Layer.Elements + walk(graphQLType.type, realType.actualTypeArguments.first(), root = false) + } + realType is Class<*> && realType.isArray -> + walk(graphQLType.type, realType.componentType, root = false) + // e.g. a property map value: the element type is unknown, so match it as Object too + realType == Any::class.java -> + walk(graphQLType.type, realType, root = false) + else -> + throw mismatch("Java class is not a List or generic type information was lost: $realType") + } + + else -> graphQLType to realType + } + } + + private fun matchedType(javaType: JavaType): JavaType { + return when (val type = resolveTypeVariables(javaType, containingType)) { + is ParameterizedType -> { + val wrapper = wrappers.ofDeclaredType(type) ?: return type + + val typeArguments = type.actualTypeArguments + if (typeArguments.size <= wrapper.index) { + throw IndexOutOfBoundsException("Generic type '${TypeUtils.toString(type)}' does not have a type argument at index ${wrapper.index}!") + } + + layers += Layer.Wrapper(wrapper) + matchedType(wrapper.schemaWrapper.invoke(typeArguments[wrapper.index])) + } + is TypeVariable<*> -> error("Could not resolve type variable '${TypeUtils.toLongString(type)}' relative to ${TypeUtils.toString(containingType)}") + // Kotlin reflection gives a suspend function returning List the type List when Foo is open. + // A type variable bound stays as it is, since a method's own variable can't be resolved and a scalar doesn't need it + is WildcardType -> when (val bound = type.upperBounds.firstOrNull() ?: error("Unable to unwrap type, wildcard has no upper bound: $type")) { + is ParameterizedType -> matchedType(bound) + else -> bound + } + is Class<*> -> if (type.isPrimitive) Primitives.wrap(type) else type + else -> error("Unable to unwrap type: $type") + } + } + + private fun mismatch(msg: String) = matchError(graphQLType, reference, javaType, msg) +} + +private fun matchError(graphQLType: GraphQLLangType, reference: ScanDictionary.Reference, javaType: JavaType, msg: String) = + SchemaClassScannerError("Unable to match type definition (${TypeUtil.simplePrint(graphQLType)}) for reference $reference with java type ($javaType): $msg") + +// generic wrappers only match their exact type, so a Publisher implementation (e.g. Flux), or a future of one, +// is matched as a plain Publisher of its events +private fun JavaType.asPublisher(): JavaType = + (futureValueType() ?: this).typeArgument(Publisher::class.java) + ?.let { TypeUtils.parameterize(Publisher::class.java, it) } + ?: this + +// picks the subscription method before its return type is walked, so it reads the erased type, where suspend functions and +// unbounded type variables are Object and the actual return type is unknown +internal fun returnsPublisher(erasedType: Class<*>, genericType: JavaType, wrappers: List): Boolean = + erasedType == Any::class.java + || Publisher::class.java.isAssignableFrom(erasedType) + || returnsPublisherFuture(genericType) + || ReceiveChannel::class.java.isAssignableFrom(erasedType) && wrappers.any { it.type == erasedType && it.canTransformToPublisher() } + +private fun returnsPublisherFuture(genericType: JavaType) = + genericType.futureValueType() + ?.let { if (it is WildcardType) it.upperBounds.first() else it } + ?.let { TypeUtils.isAssignable(it, Publisher::class.java) } == true + +// lambdas are erased to return Object, so this only checks that the transformer can return a Publisher +private fun GenericWrapper.canTransformToPublisher() = + transformer.javaClass.declaredMethods + .filter { it.name == "invoke" } + .any { it.returnType.isAssignableFrom(Publisher::class.java) } + +internal fun isOptionalParameter(parameterType: JavaType, containingType: JavaType): Boolean = + TypeUtils.getRawType(parameterType, containingType) == Optional::class.java + +internal fun isConcreteScalarType(type: GraphQLLangType, parameterType: JavaType, scalarNames: Set): Boolean = + when (type) { + is ListType -> parameterType.typeArgument(List::class.java) + ?.let { isConcreteScalarType(type.type, it, scalarNames) } ?: false + + is TypeName -> type.name in scalarNames && type.name != "ID" + is NonNullType -> isConcreteScalarType(type.type, parameterType, scalarNames) + else -> false + } + +// The two rules differ on purpose: making the build pick by instance would unwrap a Flux as a Publisher, and making the fetch +// pick by declared type would stop a CompletableFuture returned for a declared Future from getting its own wrapper +private class GenericWrappers(private val wrappers: List) { + + fun ofDeclaredType(type: ParameterizedType): GenericWrapper? = wrappers.find { it.type == type.rawType } + + fun ofValue(value: Any): GenericWrapper? { + // the JIT doesn't optimize away the sequence below on this call path, so values that aren't wrappers, which is + // most of them, return before it's allocated + if (wrappers.none { it.type.isInstance(value) }) { + return null + } + return wrappers.asSequence() + .filter { it.type.isInstance(value) } + .sortedWith(CompareGenericWrappers) + .firstOrNull() + } +} + +private class CompareGenericWrappers { + companion object : Comparator { + override fun compare(w1: GenericWrapper, w2: GenericWrapper): Int = when { + w1.type.isAssignableFrom(w2.type) -> 1 + else -> -1 + } + } +} + +private sealed interface Layer { + class Wrapper(val wrapper: GenericWrapper) : Layer { + val isFuture get() = Future::class.java.isAssignableFrom(wrapper.type) || CompletionStage::class.java.isAssignableFrom(wrapper.type) + } + + object Elements : Layer +} + +private enum class ContainerKind(val type: Class<*>, val canBeNonNull: Boolean) : Layer { + DATA_FETCHER_RESULT(DataFetcherResult::class.java, canBeNonNull = true) { + override fun placementError(position: Position, root: Boolean) = + if (position != Position.RETURN_TYPE) "${type.name} can only be used as a return type" else null + + override fun step(next: Step?, inner: Layer?): Step? = next?.let(::DataOf) + }, + OPTIONAL(Optional::class.java, canBeNonNull = false) { + override fun placementError(position: Position, root: Boolean) = + if (position == Position.RETURN_TYPE && !root) "${type.name} can only be used at the top level of a return type" else null + + // graphql-java reads a DataFetcherResult and then an Optional in its data, so an Optional around one is ours to unwrap + override fun step(next: Step?, inner: Layer?): Step? = if (next != null || inner == DATA_FETCHER_RESULT) ValueOf(next) else null + }; + + abstract fun placementError(position: Position, root: Boolean): String? + + // null leaves the value to graphql-java + abstract fun step(next: Step?, inner: Layer?): Step? +} + +private fun steps(layers: List, awaits: Awaitable, peels: Awaitable): Step? { + val outermost = layers.firstOrNull() ?: return null + val inner = layers.subList(1, layers.size) + val next = steps(inner, awaits, peels) + return when (outermost) { + is Layer.Wrapper -> if (outermost.isFuture) Await(outermost.wrapper, awaits, next) else Peel(outermost.wrapper, peels, next) + is ContainerKind -> outermost.step(next, inner.firstOrNull()) + Layer.Elements -> next?.let(::EachElement) + } +} + +private sealed interface Step { + fun unwrap(value: Any?, environmentSupplier: Supplier): Any? +} + +private class Await(private val wrapper: GenericWrapper, private val awaitable: Awaitable, private val next: Step?) : Step { + override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = + awaitable.requireNested(value?.let { wrapper.transformer(it, environmentSupplier.get()) }).then(next, environmentSupplier) +} + +private class Peel(private val wrapper: GenericWrapper, private val awaitable: Awaitable, private val next: Step?) : Step { + override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? { + val transformed = value?.let { wrapper.transformer(it, environmentSupplier.get()) } + return if (next is Await && !wrapper.transformerReturnsCompletionStage) { + next.unwrap(transformed, environmentSupplier) + } else { + awaitable.requireNested(transformed).then(next, environmentSupplier) + } + } +} + +private class EachElement(private val element: Step) : Step { + override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = + if (value is Iterable<*>) value.map { element.unwrap(it, environmentSupplier) }.awaitAll() else value +} + +private class DataOf(private val data: Step) : Step { + @Suppress("UNCHECKED_CAST") + override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = + if (value is DataFetcherResult<*>) { + data.unwrap(value.data, environmentSupplier).then { unwrapped -> (value as DataFetcherResult).map { unwrapped } } + } else { + value + } +} + +private class ValueOf(private val present: Step?) : Step { + override fun unwrap(value: Any?, environmentSupplier: Supplier): Any? = when { + value !is Optional<*> -> value + present == null -> value.orElse(null) + else -> present.unwrap(value.orElse(null), environmentSupplier) + } +} + +private fun Any?.thenUnlessNextAwaits(next: Step?, environmentSupplier: Supplier): Any? = + if (next is Await) next.unwrap(this, environmentSupplier) else then(next, environmentSupplier) + +private fun Any?.then(next: Step?, environmentSupplier: Supplier): Any? = + if (next == null) this else then { next.unwrap(it, environmentSupplier) } + +private inline fun Any?.then(crossinline next: (Any?) -> Any?): Any? = + if (this is CompletionStage<*>) thenCompose { next(it).asCompletionStage() } else next(this) + +private fun List.awaitAll(): Any { + if (none { it is CompletionStage<*> }) { + return this + } + val futures = map { it.asCompletionStage().toCompletableFuture() } + return CompletableFuture.allOf(*futures.toTypedArray()).thenApply { futures.map { it.join() } } +} + +@Suppress("UNCHECKED_CAST") +private fun Any?.asCompletionStage(): CompletionStage = + this as? CompletionStage ?: CompletableFuture.completedFuture(this) + +// graphql-java only waits on a CompletionStage returned by a data fetcher, so any other future, or a future +// that a suspend function completes with, would reach it as the field value +private class Awaitable( + private val resolverKind: ResolverKind, + private val resolverName: String, + private val valueClass: Class<*>?, + private val isSuspendFunction: Boolean +) { + + fun requireOutermost(value: Any?): Any? = + if (value !is Future<*> || valueClass?.isInstance(value) == true || value is CompletionStage<*> && !isSuspendFunction) value else fail(value) + + fun requireNested(value: Any?): Any? = + if (value !is Future<*> || value is CompletionStage<*> || valueClass?.isInstance(value) == true) value else fail(value) + + private fun fail(value: Any): Nothing = throw ResolverError( + if (isSuspendFunction) { + "Suspend function '$resolverName' resolved to a ${value.javaClass.name}, which graphql-java can't wait on. Return its value instead." + } else { + "Resolver ${resolverKind.noun} '$resolverName' resolved to a ${value.javaClass.name}, which graphql-java can't wait on. " + + resolverKind.holdCompletionStage + } + ) +} diff --git a/src/main/kotlin/graphql/kickstart/tools/util/Utils.kt b/src/main/kotlin/graphql/kickstart/tools/util/Utils.kt index 5c8c98fb..06450246 100644 --- a/src/main/kotlin/graphql/kickstart/tools/util/Utils.kt +++ b/src/main/kotlin/graphql/kickstart/tools/util/Utils.kt @@ -2,19 +2,15 @@ package graphql.kickstart.tools.util import graphql.kickstart.tools.GraphQLResolver import graphql.kickstart.tools.SchemaParserOptions -import graphql.kickstart.tools.TypeExtensions import graphql.language.* import graphql.schema.DataFetchingEnvironment import graphql.schema.idl.TypeUtil import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import org.apache.commons.lang3.reflect.TypeUtils -import java.lang.reflect.Method import java.lang.reflect.ParameterizedType -import java.lang.reflect.Proxy import java.util.concurrent.CompletionStage import java.util.concurrent.Future -import kotlin.reflect.jvm.kotlinFunction /** * @author Andrew Potter @@ -23,18 +19,10 @@ import kotlin.reflect.jvm.kotlinFunction internal typealias GraphQLRootResolver = GraphQLResolver internal typealias JavaType = java.lang.reflect.Type -internal typealias JavaMethod = Method internal typealias GraphQLLangType = Type<*> internal fun Type<*>.unwrap(): TypeName = TypeUtil.unwrapAll(this) -internal inline fun > TypeExtensions.extensionsOf(name: String): List = - this[name].orEmpty().filterIsInstance() - -// Every extension class is a subclass of its type's class, e.g. UnionTypeExtensionDefinition of UnionTypeDefinition. -internal inline fun > T.withExtensions(typeExtensions: TypeExtensions): List = - listOf(this) + typeExtensions.extensionsOf(name) - internal fun JavaType.unwrap(): Class = if (this is ParameterizedType) { this.rawType as Class<*> @@ -69,26 +57,6 @@ internal fun DataFetchingEnvironment.coroutineScope(): CoroutineScope { return CoroutineScope(Dispatchers.Default) } -internal val Class<*>.declaredNonProxyMethods: List - get() { - return when { - Proxy.isProxyClass(this) -> emptyList() - else -> this.declaredMethods.toList() - } - } - -internal fun JavaMethod.isSuspendFunction(): Boolean { - return try { - this.kotlinFunction?.isSuspend == true - } catch (e: InternalError) { - false - } -} - -// the trailing Continuation of a suspend function isn't a resolver argument -internal fun JavaMethod.parameterCountWithoutContinuation(): Int = - if (isSuspendFunction()) parameterCount - 1 else parameterCount - internal fun getDocumentation(node: AbstractNode<*>, options: SchemaParserOptions): String? = when { node is AbstractDescribedNode<*> && node.description != null -> node.description?.content diff --git a/src/test/kotlin/graphql/kickstart/tools/CommentConventionsTest.kt b/src/test/kotlin/graphql/kickstart/tools/CommentConventionsTest.kt new file mode 100644 index 00000000..318997d8 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/CommentConventionsTest.kt @@ -0,0 +1,293 @@ +package graphql.kickstart.tools + +import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue +import org.junit.Assert.fail +import org.junit.Test +import java.io.File +import java.time.LocalDate + +class CommentConventionsTest { + + @Test + fun `comments carry no issue numbers, history or versions`() { + val sources = listOf(File("src/main"), File("src/test")).asSequence() + .flatMap { it.walkTopDown() } + .filter { it.isFile && it.extension in setOf("kt", "java") } + .sortedBy { it.path } + .toList() + assertTrue("no .kt or .java files under ${File("src").absolutePath}, run the test from the project root", sources.isNotEmpty()) + + val violations = sources.flatMap { CommentLint.check(it.path, it.readText(), LocalDate.now()) } + if (violations.isNotEmpty()) { + val lines = violations.distinctBy { it.path to it.line }.size + fail(violations.joinToString("\n", "${violations.size} comment convention violation(s) on $lines line(s):\n")) + } + } + + private val today = LocalDate.of(2026, 11, 4) + + private fun check(source: String, path: String = "Example.kt") = CommentLint.check(path, source, today) + + private fun rules(source: String, path: String = "Example.kt") = check(source, path).map { it.rule } + + private fun markerFix(source: String) = check(source).single { it.rule == "lint-allow" }.fix + + @Test + fun `lint flags issue numbers, history and versions in whole comment blocks`() { + assertEquals(listOf("history"), rules("/* this used to\n * be slow */")) + assertEquals(listOf("history"), rules("// this used to\n// be slow")) + assertEquals(listOf("issue-number"), rules("// see #999")) + assertEquals(listOf("issue-number"), rules("// the enum and directive from issue #823")) + assertEquals(listOf("issue-number"), rules("// from https://github.com/o/r/issues/424")) + assertEquals(listOf("issue-number", "history"), rules("// built as the type before #552")) + assertEquals(listOf("history"), rules("// in the same order as before")) + assertEquals(listOf("history", "history"), rules("// converted, as it did before this check")) + assertEquals(listOf("history"), rules("// to keep those schemas building")) + assertEquals(listOf("history"), rules("// so those schemas keep building")) + assertEquals(listOf("history"), rules("// keeps building old schemas")) + assertEquals(listOf("history"), rules("// so schemas keep building")) + assertEquals(listOf("history"), rules("// the old behavior was to throw here")) + assertEquals(listOf("history"), rules("// restores the previous behaviour")) + assertEquals(listOf("history"), rules("// this check is no longer needed")) + assertEquals(listOf("version"), rules("/** @since 15.0 */")) + assertEquals(listOf("version"), rules("// since 1.2.0 the parser")) + assertTrue(check("// see #999 as before, since 1.2.0").all { "lint-allow" in it.fix }) + } + + @Test + fun `lint leaves ordinary prose, code and other languages' syntax alone`() { + listOf( + "// returns the list unchanged", + "// the previously resolved type wins", + "// the cache used to build the type in the scanner", + "// no longer than 80 characters", + "// the result is now cached for the next call", + "// so the loop keeps working on an empty map", + "// step #1 builds the dictionary", + "// the border is #000000 and the text is #fff", + "// waits since 2.5 seconds have passed", + "// explains the lint-allow marker syntax for readers", + "// https://example.com/docs/#123", + "// TODO reject in 16.0.0 (#999)", + "val s = \"// see #999\"", + ).forEach { assertEquals(it, emptyList(), rules(it)) } + + assertEquals(listOf("issue-number"), rules("/* a /* b */\nString s = \"no longer needed\"; // see #13", "Example.java")) + assertEquals(listOf("issue-number"), rules("String s = \"\"\"\n \\\"\"\" // #1\n \"\"\"; // see #2", "Example.java")) + } + + @Test + fun `lint honors only valid markers and says why a marker is invalid`() { + assertEquals(emptyList(), rules("// as before lint-allow history until 2026-12-01 by oryan: domain term")) + assertEquals(listOf("history"), rules("// as before lint-allow version until 2026-12-01 by oryan: other rule")) + assertTrue(markerFix("// as before lint-allow history until 2026-11-03 by oryan: stale").contains("expired on 2026-11-03")) + assertTrue(markerFix("// as before lint-allow history until 2027-06-01 by oryan: too late").contains("more than 90 days")) + assertTrue(markerFix("// as before lint-allow history until 2026-12-01 by oryan:").contains("no reason")) + assertTrue(markerFix("// as before lint-allow histroy until 2026-12-01 by oryan: typo").contains("unknown rule `histroy`")) + } +} + +internal object CommentLint { + + class Violation(val path: String, val line: Int, val rule: String, val match: String, val lineText: String, val fix: String) { + override fun toString() = "$path:$line [$rule] \"$match\" in: $lineText\n fix: $fix" + } + + private const val MARKER_MAX_DAYS = 90L + private const val MARKER_FORM = "lint-allow until YYYY-MM-DD by : " + private const val MOVE_TO_PR = "move the reason into the PR description" + + private class Rule(val id: String, val pattern: Regex, advice: String) { + val fix = "$advice; for a false positive add `lint-allow $id until YYYY-MM-DD by : ` to the line, " + + "at most $MARKER_MAX_DAYS days out" + } + + private val ordinalNouns = listOf("step", "phase", "stage", "item", "case", "rule", "row", "column", "line", "attempt", "round", "part", "pass", "example", "option") + + private val historyPhrases = listOf( + """\bused to be\b""", + """\bno longer (?:needed|necessary|required|supported|used|works?|fails?|throws?|returns?|builds?|breaks?|applies|happens|exists?|runs?)\b""", + """\banymore\b""", + """\bbefore (?:this|that) (?:change|check|fix|pr|commit)\b""", + """\bbefore the (?:fix|pr)\b""", + """\b(?:before|after|until|since) #\d+""", + """\bas (?:it|they) did\b""", + """\b(?:as|like|than) before\b""", + """\bkeeps? (?:those|these|such|existing|old) (?:\w+ )?(?:building|working)\b""", + """\b(?:those|these|such|existing|old) schemas? (?:still|keeps?) (?:builds?|building|works?|working)\b""", + """\bkeeps? building (?:\w+ )?schemas?\b""", + """\bschemas? keeps? building\b""", + """\b(?:old|previous) behaviou?r\b""", + ) + + private val rules = listOf( + Rule( + "issue-number", + Regex( + """(? in X.0.0 (#N)`" + ), + Rule( + "history", + Regex(historyPhrases.joinToString("|"), RegexOption.IGNORE_CASE), + "say what the code does and why, not how it got here; $MOVE_TO_PR" + ), + Rule( + "version", + Regex("""@since\b|\bsince (?:v\d+(?:\.\d+)*|version \d+(?:\.\d+)*|\d+\.\d+\.\d+)\b""", RegexOption.IGNORE_CASE), + "drop the version; history goes in the release notes" + ), + ) + + private val marker = Regex("""lint-allow [\w-]+ until\b.*""") + private val markerParts = Regex("""lint-allow ([\w-]+) until (\S+) by [\w-]+: ?(.*)""") + private val todoIssue = Regex("""\bTODO\b[^#]*?\bin \d+\.0\.0 (\(#\d+\))""") + + fun check(path: String, source: String, today: LocalDate): List = + CommentLexer(source, kotlin = path.endsWith(".kt")).blocks().flatMap { check(path, it, today) } + + private fun check(path: String, block: List>, today: LocalDate): List { + val violations = mutableListOf() + val allowed = mutableMapOf() + val lineStarts = mutableListOf() + val text = StringBuilder() + block.forEach { (line, lineText) -> + val found = marker.find(lineText) + if (found != null) { + val parts = markerParts.matchEntire(found.value) + val problem = markerProblem(parts, today) + if (problem == null) allowed[line] = parts!!.groupValues[1] + else violations += Violation( + path, line, "lint-allow", found.value, lineText, + "$problem; write `$MARKER_FORM` with a rule from ${rules.joinToString { it.id }} and a date at most " + + "$MARKER_MAX_DAYS days out, or reword the comment and drop the marker" + ) + } + if (text.isNotEmpty()) text.append(' ') + lineStarts += text.length + text.append(if (found == null) lineText else lineText.substring(0, found.range.first)) + } + val checked = todoIssue.replace(text) { + val issue = it.groupValues[1] + it.value.dropLast(issue.length) + " ".repeat(issue.length) + } + rules.forEach { rule -> + rule.pattern.findAll(checked).forEach { match -> + val (line, lineText) = block[lineStarts.indexOfLast { it <= match.range.first }] + if (allowed[line] != rule.id) violations += Violation(path, line, rule.id, match.value, lineText, rule.fix) + } + } + return violations.sortedBy { it.line } + } + + private fun markerProblem(parts: MatchResult?, today: LocalDate): String? { + if (parts == null) return "the marker does not have the form `$MARKER_FORM`" + val (rule, date, reason) = parts.destructured + val until = runCatching { LocalDate.parse(date) }.getOrNull() + return when { + rules.none { it.id == rule } -> "unknown rule `$rule`" + until == null -> "`$date` is not a YYYY-MM-DD date" + until.isBefore(today) -> "the marker expired on $until" + until.isAfter(today.plusDays(MARKER_MAX_DAYS)) -> "$until is more than $MARKER_MAX_DAYS days out" + reason.isBlank() -> "the marker has no reason after `by :`" + else -> null + } + } +} + +private class CommentLexer(private val source: String, private val kotlin: Boolean) { + private var pos = 0 + private var line = 1 + private var lastLineCommentLine = -1 + private val blocks = mutableListOf>>() + + fun blocks(): List>> { + code(insideTemplate = false) + return blocks.map { block -> block.filter { it.second.isNotEmpty() } }.filter { it.isNotEmpty() } + } + + private fun peek(text: String) = source.startsWith(text, pos) + + private fun advance(count: Int = 1) { + repeat(count) { + if (pos < source.length && source[pos] == '\n') line++ + pos++ + } + } + + private fun code(insideTemplate: Boolean) { + var depth = 0 + while (pos < source.length) { + when { + peek("//") -> lineComment() + peek("/*") -> blockComment() + peek("\"\"\"") -> rawString() + peek("\"") -> string() + peek("'") -> quoted('\'') + peek("`") -> quoted('`') + insideTemplate && peek("{") -> { depth++; advance() } + insideTemplate && peek("}") -> { if (depth == 0) { advance(); return }; depth--; advance() } + else -> advance() + } + } + } + + private fun lineComment() { + val end = source.indexOf('\n', pos).let { if (it < 0) source.length else it } + val entry = line to source.substring(pos, end).trimStart('/').trim() + if (lastLineCommentLine == line - 1) blocks.last() += entry else blocks += mutableListOf(entry) + lastLineCommentLine = line + pos = end + } + + private fun blockComment() { + val startLine = line + val start = pos + advance(2) + var depth = 1 + while (pos < source.length && depth > 0) { + when { + kotlin && peek("/*") -> { depth++; advance(2) } + peek("*/") -> { depth--; advance(2) } + else -> advance() + } + } + val lines = source.substring(start, pos).removePrefix("/**").removePrefix("/*").removeSuffix("*/").lines() + blocks += lines.mapIndexedTo(mutableListOf()) { index, text -> (startLine + index) to text.trim().removePrefix("*").trim() } + lastLineCommentLine = -1 + } + + private fun rawString() { + advance(3) + while (pos < source.length && !peek("\"\"\"")) { + when { + !kotlin && peek("\\") -> advance(2) + kotlin && peek("\${") -> { advance(2); code(insideTemplate = true) } + else -> advance() + } + } + advance(3) + while (kotlin && peek("\"")) advance() + } + + private fun string() { + advance() + while (pos < source.length && !peek("\"") && !peek("\n")) { + when { + peek("\\") -> advance(2) + kotlin && peek("\${") -> { advance(2); code(insideTemplate = true) } + else -> advance() + } + } + advance() + } + + private fun quoted(quote: Char) { + advance() + while (pos < source.length && source[pos] != quote && source[pos] != '\n') advance(if (peek("\\")) 2 else 1) + advance() + } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/DefinitionsBoundaryTest.kt b/src/test/kotlin/graphql/kickstart/tools/DefinitionsBoundaryTest.kt new file mode 100644 index 00000000..98557d61 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/DefinitionsBoundaryTest.kt @@ -0,0 +1,146 @@ +package graphql.kickstart.tools + +import com.tngtech.archunit.base.DescribedPredicate +import com.tngtech.archunit.core.domain.JavaAccess +import com.tngtech.archunit.core.domain.JavaClass +import com.tngtech.archunit.core.domain.JavaClasses +import com.tngtech.archunit.core.domain.JavaConstructorCall +import com.tngtech.archunit.core.domain.JavaConstructorReference +import com.tngtech.archunit.core.importer.ClassFileImporter +import com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses +import graphql.kickstart.tools.directive.DirectiveWiringHelper +import graphql.kickstart.tools.relay.RelayConnectionFactory +import graphql.language.AstTransformer +import graphql.language.NodeTraverser +import graphql.language.NodeVisitor +import graphql.language.SDLExtensionDefinition +import graphql.language.SchemaExtensionDefinition +import graphql.language.TypeDefinition +import graphql.schema.GraphQLEnumType +import graphql.schema.GraphQLInputObjectType +import graphql.schema.GraphQLInterfaceType +import graphql.schema.GraphQLObjectType +import graphql.schema.GraphQLScalarType +import graphql.schema.GraphQLUnionType +import graphql.schema.idl.TypeDefinitionRegistry +import org.junit.Test +import java.nio.file.Paths +import kotlin.reflect.KClass + +class DefinitionsBoundaryTest { + + companion object { + private val classes: JavaClasses = ClassFileImporter() + .importPath(Paths.get(MergedDefinitions::class.java.protectionDomain.codeSource.location.toURI())) + } + + private fun declaredOutside(vararg allowed: KClass<*>) = object : DescribedPredicate("are not ${allowed.joinToString { it.java.name }}") { + private val names = allowed.map { it.java.name } + override fun test(javaClass: JavaClass) = javaClass.name.substringBefore('$') !in names + } + + private val typeMembers = setOf( + "getFieldDefinitions", "getImplements", "getMemberTypes", "getEnumValueDefinitions", "getInputValueDefinitions", + "getDirectives", "getDirectivesByName", "hasDirective", "getChildren", "getNamedChildren", + ) + + private val readsTypeMembers = object : DescribedPredicate>("reads the members, directives or child nodes of what may be an SDL type definition") { + override fun test(access: JavaAccess<*>): Boolean { + val owner = access.target.owner + return access.target.name in typeMembers && + (owner.isAssignableTo(TypeDefinition::class.java) || owner.isAssignableFrom(TypeDefinition::class.java)) + } + } + + private val extensionClass = object : DescribedPredicate("are graphql-java type extension definitions") { + override fun test(javaClass: JavaClass) = + javaClass.isAssignableTo(SDLExtensionDefinition::class.java) && !javaClass.isAssignableTo(SchemaExtensionDefinition::class.java) + } + + private val nodeWalker = object : DescribedPredicate("walk graphql-java SDL nodes") { + override fun test(javaClass: JavaClass) = javaClass.isAssignableTo(NodeVisitor::class.java) || + javaClass.isEquivalentTo(NodeTraverser::class.java) || javaClass.isEquivalentTo(AstTransformer::class.java) + } + + private val objectMethods = Any::class.java.methods.mapTo(hashSetOf()) { it.name } + + private val readsTypeRegistry = object : DescribedPredicate>("reads a TypeDefinitionRegistry") { + override fun test(access: JavaAccess<*>) = + access.target.owner.isAssignableTo(TypeDefinitionRegistry::class.java) && access.target.name !in objectMethods + } + + private val namedTypes = listOf( + GraphQLObjectType::class, GraphQLInterfaceType::class, GraphQLUnionType::class, + GraphQLEnumType::class, GraphQLInputObjectType::class, GraphQLScalarType::class, + ).mapTo(hashSetOf()) { it.java.name } + private val builderFactories = setOf("newObject", "newInterface", "newUnionType", "newEnum", "newInputObject", "newScalar") + + private val startsNamedTypeBuilder = object : DescribedPredicate>("starts a builder for a graphql-java named type") { + override fun test(access: JavaAccess<*>): Boolean { + val owner = access.target.owner.name + val isFactory = access.target.name in builderFactories && owner in namedTypes + val isConstructor = (access is JavaConstructorCall || access is JavaConstructorReference) && + owner.substringBefore('$') in namedTypes && owner.endsWith("\$Builder") + return isFactory || isConstructor + } + } + + private val transformsNamedType = object : DescribedPredicate>("transforms a graphql-java named type") { + override fun test(access: JavaAccess<*>) = access.target.name == "transform" && access.target.owner.name in namedTypes + } + + private val readMergedType = "Look the type up with MergedDefinitions.byName or resolve(name) and read MergedType.fields, interfaces, members or values, which hold the extensions' items too" + + @Test + fun `imports the compiled main classes`() { + assert(classes.size > 100) { "expected the compiled main classes, found ${classes.size}" } + } + + @Test + fun `only the merged definitions read the members and directives of SDL types`() { + noClasses().that(declaredOutside(MergedDefinitions::class, MergedType::class, RelayConnectionFactory::class)) + .should().accessTargetWhere(readsTypeMembers) + .because("each type is merged with its extensions once in MergedDefinitions.kt. $readMergedType. " + + "MergedType.prepare applies the merged directives, and a built graphql-java type lists them in appliedDirectives. " + + "A field, argument or enum value's own directives are fine to read through a FieldDefinition, InputValueDefinition or EnumValueDefinition receiver, not a DirectivesContainer or Node one") + .check(classes) + } + + @Test + fun `only the merged definitions see type extension classes`() { + noClasses().that(declaredOutside(MergedDefinitions::class, MergedType::class)) + .should().dependOnClassesThat(extensionClass) + .because("each type is merged with its extensions once in MergedDefinitions.kt. $readMergedType. MergedType.prepare passes the extension definitions to the builder") + .check(classes) + } + + @Test + fun `nothing walks SDL nodes`() { + noClasses().should().dependOnClassesThat(nodeWalker) + .because("a walk visits each type definition apart from its extensions. $readMergedType") + .check(classes) + } + + @Test + fun `nothing reads a TypeDefinitionRegistry`() { + noClasses().should().accessTargetWhere(readsTypeRegistry) + .because("a TypeDefinitionRegistry keeps each type apart from its extensions. $readMergedType") + .check(classes) + } + + @Test + fun `only the merged definitions start named-type builders`() { + noClasses().that(declaredOutside(MergedType::class)) + .should().accessTargetWhere(startsNamedTypeBuilder) + .because("every named type starts from MergedType.prepare, which checks repeats and sets the name, definitions, description and directives") + .check(classes) + } + + @Test + fun `only the directive wiring transforms built named types`() { + noClasses().that(declaredOutside(DirectiveWiringHelper::class)) + .should().accessTargetWhere(transformsNamedType) + .because("transform copies a type that's already built. Start a new type from MergedType.prepare") + .check(classes) + } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt b/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt index 607ef081..fee6571f 100644 --- a/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/MethodFieldResolverDataFetcherTest.kt @@ -5,7 +5,7 @@ import graphql.GraphQLContext import graphql.execution.* import graphql.execution.instrumentation.SimplePerformantInstrumentation import graphql.kickstart.tools.resolver.FieldResolverError -import graphql.kickstart.tools.resolver.FieldResolverScanner +import graphql.kickstart.tools.resolver.ResolverPlan import graphql.language.FieldDefinition import graphql.language.InputValueDefinition import graphql.language.NonNullType @@ -461,7 +461,7 @@ class MethodFieldResolverDataFetcherTest { } else { NormalResolverInfo(resolver, options) } - return FieldResolverScanner(options, GRAPHQL_SCALARS.keys).findFieldResolver(field, resolverInfo).createDataFetcher() + return ResolverPlan.Finder(options, GRAPHQL_SCALARS.keys).find(field, resolverInfo).dataFetcher() } private fun createEnvironment( diff --git a/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt b/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt index 9272f70e..e2143786 100644 --- a/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/MissingFieldResolverTest.kt @@ -30,8 +30,8 @@ class MissingFieldResolverTest { } @Test - fun `should warn about each missing field when unimplemented resolvers are allowed`() { - val (schema, warnings) = withWarnings { + fun `should warn about each missing field when unimplemented resolvers are allowed, from the loggers apps configure`() { + val (schema, events) = withWarningEvents { SchemaParser.newParser() .schemaString( """ @@ -51,10 +51,10 @@ class MissingFieldResolverTest { // missingField has no resolver, so querying it throws schema.assertEveryFieldResolves(except = setOf("Query.missingField")) - assertEquals(warnings, listOf( - "Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved " + + assertEquals(events.map { "${it.loggerName}: ${it.formattedMessage}" }, listOf( + "graphql.kickstart.tools.SchemaClassScanner: Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved " + "to query time instead of schema creation time. Make sure this is turned off in production.", - "Missing resolver for field: ${schema.queryType.getFieldDefinition("missingField").definition}" + "graphql.kickstart.tools.resolver.FieldResolverScanner: Missing resolver for field: ${schema.queryType.getFieldDefinition("missingField").definition}" )) } diff --git a/src/test/kotlin/graphql/kickstart/tools/NestedGenericWrapperTest.kt b/src/test/kotlin/graphql/kickstart/tools/NestedGenericWrapperTest.kt index d289a380..213b25c5 100644 --- a/src/test/kotlin/graphql/kickstart/tools/NestedGenericWrapperTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/NestedGenericWrapperTest.kt @@ -9,7 +9,8 @@ import graphql.execution.DataFetcherResult import graphql.Scalars import graphql.execution.DefaultValueUnboxer import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper -import graphql.kickstart.tools.resolver.ReturnValueUnwrapper +import graphql.kickstart.tools.resolver.ResolverKind +import graphql.kickstart.tools.resolver.TypeShape import graphql.kickstart.tools.util.ParameterizedTypeImpl import graphql.kickstart.tools.util.unwrap import graphql.language.AstPrinter @@ -228,8 +229,7 @@ class NestedGenericWrapperTest { @Test fun `resolves every return type the matcher accepts`() { val options = SchemaParserOptions.newOptions().genericWrappers(tryWrapper, pageWrapper).build() - val typeResolver = GenericTypeResolver(Query::class.java, options) - val matcher = TypeClassMatcher(mapOf("Payload" to ObjectTypeDefinition("Payload"), "Leaf" to ScalarTypeDefinition("Leaf"))) + val matcher = TypeClassMatcher(MergedDefinitions(listOf(ObjectTypeDefinition("Payload"), ScalarTypeDefinition("Leaf")))) val method = Query::class.java.getMethod("listOfWrapped") val graphQLTypes = listOf(TypeName("Payload"), TypeName("Leaf")).flatMap { listOf(it, NonNullType(it), ListType(it), NonNullType(ListType(NonNullType(it))), ListType(ListType(it))) } val containers = listOf(List::class.java, CompletableFuture::class.java, Try::class.java, Page::class.java, DataFetcherResult::class.java, Optional::class.java, Future::class.java) @@ -238,23 +238,20 @@ class NestedGenericWrapperTest { val accepted = graphQLTypes.flatMap { graphQLType -> val shapesOfTheSameListDepth = shapes.filter { shape -> shape.count { it == List::class.java || it == Page::class.java } == graphQLType.listDepth() } shapesOfTheSameListDepth.flatMap { shape -> listOf(false, true).map { shape to javaType(shape, leaf(graphQLType).javaClass, wildcardElements = it) } }.mapNotNull { (shape, javaType) -> - val potentialMatch = TypeClassMatcher.PotentialMatch.returnValue(graphQLType, javaType, typeResolver, ScanDictionary.ReturnValueReference(method)) try { - matcher.match(potentialMatch) - shape to potentialMatch + val typeShape = TypeShape.returnType(graphQLType, javaType, isSubscription = false, Query::class.java, options, ScanDictionary.ReturnValueReference(method)) + matcher.match(typeShape) + Accepted(shape, graphQLType, javaType, typeShape) } catch (e: SchemaClassScannerError) { null } } } - val failures = accepted.mapNotNull { (shape, potentialMatch) -> - val graphQLType = potentialMatch.graphQLType - if (potentialMatch.unwrapping.javaType != leaf(graphQLType).javaClass) { - return@mapNotNull "${TypeUtils.toString(potentialMatch.javaType)} as ${AstPrinter.printAst(graphQLType)}: bound to ${TypeUtils.toString(potentialMatch.unwrapping.javaType)}" + val failures = accepted.mapNotNull { (shape, graphQLType, javaType, typeShape) -> + if (typeShape.leafJavaType != leaf(graphQLType).javaClass) { + return@mapNotNull "${TypeUtils.toString(javaType)} as ${AstPrinter.printAst(graphQLType)}: bound to ${TypeUtils.toString(typeShape.leafJavaType)}" } - val unwrapper = ReturnValueUnwrapper.create( - method, potentialMatch.unwrapping, TypeUtils.getRawType(typeResolver.resolve(potentialMatch.javaType), null), isSuspendFunction = false, isSubscription = false, options.genericWrappers - ) + val unwrapper = TypeShape.Unwrapper(typeShape, ResolverKind.METHOD, method.name) val value = value(shape, leaf(graphQLType)) val result = GraphQL.newGraphQL(fieldSchema(graphQLType) { environment -> unwrapper.unwrap(value) { environment } }).build() .execute(if (leaf(graphQLType) is Payload) "query { field { data } }" else "query { field }") @@ -263,17 +260,18 @@ class NestedGenericWrapperTest { } else { result.errors.isEmpty() && result.getData() == mapOf("field" to expected(graphQLType)) } - "${TypeUtils.toString(potentialMatch.javaType)} as ${AstPrinter.printAst(graphQLType)}: ${result.errors.map { it.message }} ${result.getData()}".takeUnless { resolved } + "${TypeUtils.toString(javaType)} as ${AstPrinter.printAst(graphQLType)}: ${result.errors.map { it.message }} ${result.getData()}".takeUnless { resolved } } - assertTrue(accepted.count { (_, potentialMatch) -> leaf(potentialMatch.graphQLType) is FutureLeaf } > graphQLTypes.size) + assertTrue(accepted.count { leaf(it.graphQLType) is FutureLeaf } > graphQLTypes.size) assertEquals(failures, listOf()) } + private data class Accepted(val shape: List>, val graphQLType: Type<*>, val javaType: java.lang.reflect.Type, val typeShape: TypeShape) + @Test fun `rejects a DataFetcherResult or an Optional twice in one value`() { - val typeResolver = GenericTypeResolver(Query::class.java, SchemaParserOptions.newOptions().build()) - val matcher = TypeClassMatcher(mapOf("Payload" to ObjectTypeDefinition("Payload"))) + val matcher = TypeClassMatcher(MergedDefinitions(listOf(ObjectTypeDefinition("Payload")))) val method = Query::class.java.getMethod("listOfWrapped") val result = DataFetcherResult::class.java val optional = Optional::class.java @@ -284,9 +282,9 @@ class NestedGenericWrapperTest { ) val messages = rejections.map { (shape, _) -> - val potentialMatch = TypeClassMatcher.PotentialMatch.returnValue(TypeName("Payload"), javaType(shape, Payload::class.java, wildcardElements = false), typeResolver, ScanDictionary.ReturnValueReference(method)) try { - matcher.match(potentialMatch) + val javaType = javaType(shape, Payload::class.java, wildcardElements = false) + matcher.match(TypeShape.returnType(TypeName("Payload"), javaType, isSubscription = false, Query::class.java, SchemaParserOptions.newOptions().build(), ScanDictionary.ReturnValueReference(method))) "accepted" } catch (e: SchemaClassScannerError) { e.message.orEmpty().substringAfterLast("): ") diff --git a/src/test/kotlin/graphql/kickstart/tools/RawGenericFixtures.java b/src/test/kotlin/graphql/kickstart/tools/RawGenericFixtures.java index d01b3076..37d23d98 100644 --- a/src/test/kotlin/graphql/kickstart/tools/RawGenericFixtures.java +++ b/src/test/kotlin/graphql/kickstart/tools/RawGenericFixtures.java @@ -1,6 +1,7 @@ package graphql.kickstart.tools; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; // Raw types can't be expressed in Kotlin, so these fixtures must stay in Java. @@ -14,6 +15,14 @@ public Tree tree() { } } + public static class RawOptionalResolver implements GraphQLQueryResolver { + + @SuppressWarnings({"rawtypes", "unused"}) + public String raw(Optional value) { + return String.valueOf(value); + } + } + public static class Tree { private final T value; diff --git a/src/test/kotlin/graphql/kickstart/tools/ResolverCompatibilityTest.kt b/src/test/kotlin/graphql/kickstart/tools/ResolverCompatibilityTest.kt new file mode 100644 index 00000000..ffeeea07 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/ResolverCompatibilityTest.kt @@ -0,0 +1,522 @@ +package graphql.kickstart.tools + +import graphql.ExecutionInput +import graphql.ExecutionResult +import graphql.GraphQL +import graphql.GraphQLContext +import graphql.execution.DataFetcherResult +import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper +import graphql.kickstart.tools.resolver.ExtraParameter +import graphql.kickstart.tools.resolver.FieldResolverError +import graphql.kickstart.tools.resolver.ResolverKind +import graphql.schema.DataFetchingEnvironment +import graphql.schema.FieldCoordinates +import kotlinx.coroutines.flow.toList +import kotlinx.coroutines.reactive.asFlow +import kotlinx.coroutines.reactive.publish +import kotlinx.coroutines.runBlocking +import org.junit.Assert.assertThrows +import org.junit.Assert.fail +import org.junit.Test +import org.reactivestreams.Publisher +import java.util.* +import java.util.concurrent.CompletableFuture +import java.util.concurrent.CompletableFuture.completedFuture +import java.util.concurrent.CompletableFuture.supplyAsync +import java.util.concurrent.Future +import java.util.concurrent.FutureTask + +class ResolverCompatibilityTest { + + @Test + fun `@JvmField and typed Map fields return what a method returns, and untyped Map fields hand graphql-java the value as it is`() { + val wrong = Kind.entries.flatMap { kind -> + shapes.mapNotNull { shape -> + val got = holderField(kind, shape) + val expected = if (kind == Kind.UNTYPED_MAP) rawValueResults.getValue(shape.name) else shape.expected(kind) + "$kind ${shape.name}\n expected: $expected\n got: $got".takeUnless { got == expected } + } + } + if (wrong.isNotEmpty()) { + fail(wrong.joinToString("\n")) + } + } + + @Test + fun `arguments follow the source parameter in declaration order`() { + val result = execute( + """ + type Query { foo: Foo } + type Foo { name: String joined(first: String!, second: String!, count: Int!): String } + """, + "{ foo { joined(first: \"x\", second: \"y\", count: 3) } }", + object : GraphQLQueryResolver { + fun foo() = Foo("a") + }, + object : GraphQLResolver { + fun joined(foo: Foo, first: String, second: String, count: Int, env: DataFetchingEnvironment) = + "${foo.name} $first $second $count ${env.field.name}" + } + ) + + assertEquals(result, "{foo={joined=a x y 3 joined}}") + } + + @Test + fun `trailing parameters bind the GraphQLContext, the context class and the environment, repeated and in any order`() { + val schema = "type Query { extras(first: String!): String }" + val options = SchemaParserOptions.newOptions().contextClass(AppContext::class).build() + + assertEquals( + execute(schema, "{ extras(first: \"x\") }", ContextResolver(), options = options, context = mapOf(AppContext::class.java to AppContext("ann"), "key" to "k")), + "{extras=x extras ann k true}" + ) + assertEquals( + execute(schema, "{ extras(first: \"x\") }", ContextResolver(), options = options), + "{extras=null}\nerror: Exception while fetching data (/extras) : Resolver method 'ContextResolver.extras' has a parameter of the context class " + + "'AppContext', but the GraphQLContext has no value for it. Put it in the GraphQLContext under the class key when building the " + + "ExecutionInput, for example graphQLContext(mapOf(AppContext::class.java to context))." + ) + } + + @Test + fun `a context class of DataFetchingEnvironment is looked up in the GraphQLContext`() { + val result = execute( + "type Query { environment: String }", + "{ environment }", + EnvironmentResolver(), + options = SchemaParserOptions.newOptions().contextClass(DataFetchingEnvironment::class).build() + ) + + assertEquals( + result, + "{environment=null}\nerror: Exception while fetching data (/environment) : Resolver method 'EnvironmentResolver.environment' has a parameter " + + "of the context class 'graphql.schema.DataFetchingEnvironment', but the GraphQLContext has no value for it. Put it in the GraphQLContext " + + "under the class key when building the ExecutionInput, for example graphQLContext(mapOf(DataFetchingEnvironment::class.java to context))." + ) + } + + @Test + fun `every resolver kind gets its own data fetcher, which unwraps the value`() { + ResolverKind.entries.forEach { kind -> + val fixture = kindFixtures[kind] + ?: throw AssertionError("ResolverKind.$kind has no entry in ResolverCompatibilityTest.kindFixtures. Add a holder whose 'value' resolves through it as a Box, and the name of the data fetcher it gets") + val holder = fixture.holder(kind.noun) + val schema = SchemaParser.newParser() + .schemaString("type Query { holder: Holder } type Holder { value: String }") + .resolvers(object : GraphQLQueryResolver { + fun holder(): Any = holder + }) + .dictionary("Holder", holder.javaClass) + .options(SchemaParserOptions.newOptions().genericWrappers(boxWrapper).build()) + .build() + .makeExecutableSchema() + val holderType = schema.getObjectType("Holder")!! + val dataFetcher = schema.codeRegistry.getDataFetcher(FieldCoordinates.coordinates(holderType, "value"), holderType.getFieldDefinition("value")) + + assertEquals(dataFetcher.javaClass.simpleName, fixture.dataFetcher) + assertEquals(GraphQL.newGraphQL(schema).build().execute("{ holder { value } }").render(), "{holder={value=${kind.noun}}}") + } + } + + @Test + fun `a field more than one root resolver serves fails the build, naming each resolver`() { + val error = assertThrows(FieldResolverError::class.java) { + SchemaParser.newParser().schemaString("type Query { value: String }").resolvers(ValueMethodRoot(), ValueFieldRoot()).build().makeExecutableSchema() + } + + assertEquals( + error.message!!.substringAfter("': "), + "[MethodFieldResolver{method=public final java.lang.String ${ValueMethodRoot::class.java.name}.value()}, " + + "PropertyFieldResolver{property=public final java.lang.String ${ValueFieldRoot::class.java.name}.value}]" + ) + } + + @Test + fun `every extra parameter binds after the arguments`() { + val options = SchemaParserOptions.newOptions().contextClass(AppContext::class).build() + val context = mapOf(AppContext::class.java to AppContext("ann"), "key" to "k") + + ExtraParameter.entries.forEach { parameter -> + val (resolver, expected) = extraParameterFixtures[parameter] + ?: throw AssertionError("ExtraParameter.$parameter has no entry in ResolverCompatibilityTest.extraParameterFixtures. Add a resolver whose value(first) takes it last, and what it returns") + + assertEquals( + execute("type Query { value(first: String!): String }", "{ value(first: \"x\") }", resolver, options = options, context = context), + "{value=$expected}" + ) + } + } + + @Test + fun `omitted arguments reach primitive parameters as their default, and a type variable parameter gets a value of its resolved type argument`() { + val result = execute( + "type Query { primitives(i: Int, b: Boolean, d: Float, boxed: Int): String echo(value: Int!): String }", + "{ primitives echo(value: 3) }", + PrimitivesResolver() + ) + + assertEquals(result, "{primitives=0 false 0.0 null, echo=3 Long}") + } + + @Test + fun `Optional arguments are empty when null, and null when omitted with omission detection`() { + val schema = "type Query { raw(value: String): String typed(value: String): String }" + val query = "{ givenRaw: raw(value: \"x\") nullRaw: raw(value: null) omittedRaw: raw given: typed(value: \"x\") null: typed(value: null) omitted: typed }" + val typed = object : GraphQLQueryResolver { + fun typed(value: Optional?) = value.toString() + } + val detecting = SchemaParserOptions.newOptions().inputArgumentOptionalDetectOmission(true).build() + + assertEquals( + execute(schema, query, RawGenericFixtures.RawOptionalResolver(), typed), + "{givenRaw=Optional[x], nullRaw=Optional.empty, omittedRaw=Optional.empty, given=Optional[x], null=Optional.empty, omitted=Optional.empty}" + ) + assertEquals( + execute(schema, query, RawGenericFixtures.RawOptionalResolver(), typed, options = detecting), + "{givenRaw=Optional[x], nullRaw=Optional.empty, omittedRaw=null, given=Optional[x], null=Optional.empty, omitted=null}" + ) + } + + @Test + fun `lists of concrete scalars skip conversion only for a List parameter`() { + val result = execute( + "type Query { numbers(list: [Int!]!, collection: [Int!]!, set: [Int!]!): String }", + "{ numbers(list: [1], collection: [2], set: [3]) }", + object : GraphQLQueryResolver { + fun numbers(list: List, collection: Collection, set: Set) = + listOf>(list, collection, set).joinToString(" ") { it.first()!!.javaClass.simpleName } + } + ) + + assertEquals(result, "{numbers=Integer Long Long}") + } + + @Test + fun `a source of another class fails the field`() { + val result = execute( + "type Query { holder: Holder } type Holder { name: String tag: String extra: String }", + "{ holder { name tag extra } }", + object : GraphQLQueryResolver { + fun holder(): Any = Impostor() + }, + object : GraphQLResolver { + fun extra(holder: Holder) = holder.name + }, + dictionary = listOf(Holder::class.java) + ) + + assertEquals( + result, + """ + {holder={name=null, tag=null, extra=null}} + error: Exception while fetching data (/holder/name) : Expected source object to be an instance of 'Holder' but instead got 'Impostor' + error: Exception while fetching data (/holder/tag) : Expected source object to be an instance of 'Holder' but instead got 'Impostor' + error: Exception while fetching data (/holder/extra) : Source type (Impostor) is not expected type (Holder)! + """.trimIndent() + ) + } + + @Test + fun `the outermost wrapper is picked by the value's class and a nested one by the declared type`() { + val result = execute( + "type Query { top: String nested: [String] }", + "{ top nested }", + object : GraphQLQueryResolver { + fun top(): Box = SpecialBox("a") + fun nested(): List> = listOf(SpecialBox("b")) + }, + options = SchemaParserOptions.newOptions().genericWrappers(boxWrapper, specialBoxWrapper).build() + ) + + assertEquals(result, "{top=a special, nested=[b]}") + } + + @Test + fun `a value of two unrelated wrapper types gets the transformer registered last, whatever the declared type`() { + val result = execute( + "type Query { left: String right: String }", + "{ left right }", + object : GraphQLQueryResolver { + fun left(): Left = Both("l", "r") + fun right(): Right = Both("l", "r") + }, + options = SchemaParserOptions.newOptions().genericWrappers(leftWrapper, rightWrapper).build() + ) + + assertEquals(result, "{left=r, right=r}") + } + + @Test + fun `suspend functions await nested futures, and fail on a future at the top`() { + val result = execute("type Query { futures: [String] future: String }", "{ futures future }", SuspendResolver()) + + assertEquals( + result, + "{futures=[futures, b], future=null}\nerror: Exception while fetching data (/future) : Suspend function 'SuspendResolver.future' resolved to " + + "a CompletableFuture, which graphql-java can't wait on. Return its value instead." + ) + } + + @Test + fun `subscription events of a method or a field reach graphql-java as they are, so a future or wrapped event prints as a string`() { + val schema = SchemaParser.newParser() + .schemaString("type Query { unused: String } type Subscription { events: String futureEvents: String boxEvents: String }") + .resolvers( + object : GraphQLQueryResolver { + fun unused(): String? = null + }, + object : GraphQLSubscriptionResolver { + fun events(): Publisher = publish { + send("a") + send("b") + } + + fun futureEvents(): Publisher> = publish { + send(completedFuture("a")) + } + }, + SubscriptionFields()) + .options(SchemaParserOptions.newOptions().genericWrappers(boxWrapper).build()) + .build() + .makeExecutableSchema() + val gql = GraphQL.newGraphQL(schema).build() + + fun events(query: String) = runBlocking { gql.execute(query).getData>()!!.asFlow().toList() }.map { it.render() } + + assertEquals(events("subscription { events }"), listOf("{events=a}", "{events=b}")) + assertEquals(events("subscription { futureEvents }"), listOf("{futureEvents=CompletableFuture@...[Completed normally]}")) + assertEquals(events("subscription { boxEvents }"), listOf("{boxEvents=Box@...}")) + } + + private fun execute( + schema: String, + query: String, + vararg resolvers: GraphQLResolver<*>, + options: SchemaParserOptions = SchemaParserOptions.newOptions().build(), + dictionary: List> = listOf(), + context: Map = mapOf() + ): String = GraphQL.newGraphQL( + SchemaParser.newParser().schemaString(schema).resolvers(*resolvers).options(options).dictionary(dictionary).build().makeExecutableSchema() + ).build().execute(ExecutionInput.newExecutionInput(query).graphQLContext(context)).render() + + private fun holderField(kind: Kind, shape: Shape): String { + val holder = kind.holder(shape) + val parser = SchemaParser.newParser() + .schemaString("type Query { holder: Holder } type Holder { ${shape.name}: ${shape.type} }" + if (shape.selection.isEmpty()) "" else " type Foo { name: String }") + .resolvers(object : GraphQLQueryResolver { + fun holder(): Any = holder + }) + .dictionary("Holder", holder.javaClass) + .options(SchemaParserOptions.newOptions().genericWrappers(boxWrapper).build()) + if (kind == Kind.UNTYPED_MAP && shape.selection.isNotEmpty()) { + parser.dictionary(Foo::class) + } + val schema = try { + parser.build().makeExecutableSchema() + } catch (e: RuntimeException) { + return "rejected: ${e.message!!.lines().first().substringAfterLast("): ")}" + } + val result = GraphQL.newGraphQL(schema).build().execute("{ holder { ${shape.name}${shape.selection} } }") + val value = result.getData?>>()!!["holder"]?.get(shape.name) + return (listOf("$value") + result.errors.map { "error: ${it.message}" }).joinToString("\n").normalized() + } + + private fun ExecutionResult.render() = (listOf("${getData()}") + errors.map { "error: ${it.message}" }).joinToString("\n").normalized() + + private fun String.normalized() = replace(Regex("@\\p{XDigit}+"), "@...") + .replace("${ResolverCompatibilityTest::class.java.name}$", "") + .replace("java.util.concurrent.", "") + + enum class Kind(val resolverKind: String, val holdCompletionStage: String, val holder: (Shape) -> Any) { + METHOD("method", "Return a CompletionStage, such as a CompletableFuture, from the method or its generic wrapper transformer instead.", { MethodHolder() }), + JVM_FIELD("field", "Assign a CompletionStage, such as a CompletableFuture, to the field, or return one from its generic wrapper transformer instead.", { JvmFieldHolder() }), + TYPED_MAP("map value", "Put a CompletionStage, such as a CompletableFuture, in the map, or return one from its generic wrapper transformer instead.", { shape -> shape.typedMap(JvmFieldHolder()) }), + UNTYPED_MAP("map value", "Put a CompletionStage, such as a CompletableFuture, in the map, or return one from its generic wrapper transformer instead.", { shape -> hashMapOf(shape.name to shape.value()) }) + } + + class Shape(val name: String, val type: String, private val expected: String, val typedMap: (JvmFieldHolder) -> Map) { + val selection = if (type.contains("Foo")) " { name }" else "" + + fun value(): Any? = JvmFieldHolder::class.java.getField(name).get(JvmFieldHolder()) + + fun expected(kind: Kind) = expected.replace("HOLDER", kind.holder(this).javaClass.simpleName).replace("KIND", kind.resolverKind).replace("HOLD_COMPLETION_STAGE", kind.holdCompletionStage) + } + + class Foo(val name: String) + + class JvmFieldHolder { + @JvmField val future: CompletableFuture = completedFuture(Foo("a")) + @JvmField val futureOfListOfFutures: CompletableFuture>> = completedFuture(listOf(completedFuture(Foo("a")), completedFuture(Foo("b")))) + @JvmField val optional: Optional = Optional.of(Foo("a")) + @JvmField val result: DataFetcherResult = DataFetcherResult.newResult().data(Foo("a")).build() + @JvmField val plainFuture: Future = FutureTask { Foo("a") }.apply { run() } + @JvmField val box: Box = Box(Foo("a")) + @JvmField val optionalResult: Optional> = Optional.of(DataFetcherResult.newResult().data(Foo("a")).build()) + @JvmField val listOfFutures: List> = listOf(completedFuture(Foo("a")), completedFuture(Foo("b"))) + @JvmField val listOfStringFutures: List> = listOf(completedFuture("a"), completedFuture("b")) + @JvmField val boxOfString: Box = Box("a") + @JvmField val listOfOptionals: List> = listOf(Optional.of("a"), Optional.empty()) + @JvmField val futureOfAny: CompletableFuture = completedFuture("a") + } + + class MethodHolder { + private val values = JvmFieldHolder() + + fun future() = values.future + fun futureOfListOfFutures() = values.futureOfListOfFutures + fun optional() = values.optional + fun result() = values.result + fun plainFuture() = values.plainFuture + fun box() = values.box + fun optionalResult() = values.optionalResult + fun listOfFutures() = values.listOfFutures + fun listOfStringFutures() = values.listOfStringFutures + fun boxOfString() = values.boxOfString + fun listOfOptionals() = values.listOfOptionals + fun futureOfAny() = values.futureOfAny + } + + class FutureMap : HashMap>() + class FutureOfListOfFuturesMap : HashMap>>>() + class OptionalMap : HashMap>() + class ResultMap : HashMap>() + class PlainFutureMap : HashMap>() + class BoxMap : HashMap>() + class OptionalResultMap : HashMap>>() + class ListOfFuturesMap : HashMap>>() + class ListOfStringFuturesMap : HashMap>>() + class BoxOfStringMap : HashMap>() + class ListOfOptionalsMap : HashMap>>() + class FutureOfAnyMap : HashMap>() + + open class Box(val content: T) + + class SpecialBox(content: T) : Box(content) + + interface Left { + val left: T + } + + interface Right { + val right: T + } + + class Both(override val left: T, override val right: T) : Left, Right + + class AppContext(val user: String) + + class NounMethodHolder(private val noun: String) { + fun value() = Box(noun) + } + + class NounFieldHolder(noun: String) { + @JvmField val value = Box(noun) + } + + class NounMap : HashMap>() + + class KindFixture(val holder: (String) -> Any, val dataFetcher: String) + + class ValueMethodRoot : GraphQLQueryResolver { + fun value() = "method" + } + + class ValueFieldRoot : GraphQLQueryResolver { + @JvmField val value = "field" + } + + class ContextResolver : GraphQLQueryResolver { + fun extras(first: String, env: DataFetchingEnvironment, context: AppContext, graphQLContext: GraphQLContext, again: DataFetchingEnvironment) = + "$first ${env.field.name} ${context.user} ${graphQLContext.get("key")} ${again === env}" + } + + class EnvironmentResolver : GraphQLQueryResolver { + fun environment(env: DataFetchingEnvironment): String = env.field.name + } + + abstract class Echo { + fun echo(value: T) = "$value ${value!!::class.java.simpleName}" + } + + class PrimitivesResolver : Echo(), GraphQLQueryResolver { + fun primitives(i: Int, b: Boolean, d: Double, boxed: Int?) = "$i $b $d $boxed" + } + + class SuspendResolver : GraphQLQueryResolver { + suspend fun futures(env: DataFetchingEnvironment): List> = listOf(completedFuture(env.field.name), supplyAsync { "b" }) + suspend fun future(): CompletableFuture = completedFuture("a") + } + + class SubscriptionFields : GraphQLSubscriptionResolver { + @JvmField val boxEvents: Publisher> = publish { send(Box("a")) } + } + + class Holder(val name: String) { + @JvmField val tag = "t" + } + + class Impostor + + private companion object { + val boxWrapper = GenericWrapper.withTransformer(Box::class, 0, { box -> box.content }) + val specialBoxWrapper = GenericWrapper.withTransformer(SpecialBox::class, 0, { box -> "${box.content} special" }) + val leftWrapper = GenericWrapper.withTransformer(Left::class, 0, { wrapper -> wrapper.left }) + val rightWrapper = GenericWrapper.withTransformer(Right::class, 0, { wrapper -> wrapper.right }) + + val kindFixtures = mapOf( + ResolverKind.METHOD to KindFixture(::NounMethodHolder, "LightMethodFieldResolverDataFetcher"), + ResolverKind.FIELD to KindFixture(::NounFieldHolder, "PropertyFieldResolverDataFetcher"), + ResolverKind.MAP_VALUE to KindFixture({ noun -> NounMap().apply { put("value", Box(noun)) } }, "MapFieldResolverDataFetcher") + ) + + val extraParameterFixtures = mapOf( + ExtraParameter.ENVIRONMENT to (object : GraphQLQueryResolver { + fun value(first: String, env: DataFetchingEnvironment) = "$first ${env.field.name}" + } to "x value"), + ExtraParameter.GRAPHQL_CONTEXT to (object : GraphQLQueryResolver { + fun value(first: String, context: GraphQLContext) = "$first ${context.get("key")}" + } to "x k"), + ExtraParameter.CONTEXT_CLASS to (object : GraphQLQueryResolver { + fun value(first: String, context: AppContext) = "$first ${context.user}" + } to "x ann") + ) + + val shapes = listOf( + Shape("future", "Foo", "{name=a}") { FutureMap().apply { put("future", it.future) } }, + Shape("futureOfListOfFutures", "[Foo]", "[{name=a}, {name=b}]") { FutureOfListOfFuturesMap().apply { put("futureOfListOfFutures", it.futureOfListOfFutures) } }, + Shape("optional", "Foo", "{name=a}") { OptionalMap().apply { put("optional", it.optional) } }, + Shape("result", "Foo", "{name=a}") { ResultMap().apply { put("result", it.result) } }, + Shape( + "plainFuture", "Foo", + "null\nerror: Exception while fetching data (/holder/plainFuture) : Resolver KIND 'HOLDER.plainFuture' resolved to a FutureTask, " + + "which graphql-java can't wait on. HOLD_COMPLETION_STAGE" + ) { PlainFutureMap().apply { put("plainFuture", it.plainFuture) } }, + Shape("box", "Foo", "{name=a}") { BoxMap().apply { put("box", it.box) } }, + Shape("optionalResult", "Foo", "{name=a}") { OptionalResultMap().apply { put("optionalResult", it.optionalResult) } }, + Shape("listOfFutures", "[Foo]", "[{name=a}, {name=b}]") { ListOfFuturesMap().apply { put("listOfFutures", it.listOfFutures) } }, + Shape("listOfStringFutures", "[String]", "[a, b]") { ListOfStringFuturesMap().apply { put("listOfStringFutures", it.listOfStringFutures) } }, + Shape("boxOfString", "String", "a") { BoxOfStringMap().apply { put("boxOfString", it.boxOfString) } }, + Shape("listOfOptionals", "[String]", "rejected: java.util.Optional can only be used at the top level of a return type") { ListOfOptionalsMap().apply { put("listOfOptionals", it.listOfOptionals) } }, + Shape("futureOfAny", "String", "a") { FutureOfAnyMap().apply { put("futureOfAny", it.futureOfAny) } } + ) + + private fun notFoo(path: String, got: String) = + "error: Exception while fetching data (/holder/$path/name) : Expected source object to be an instance of 'Foo' but instead got '$got'" + + val rawValueResults = mapOf( + "future" to "{name=a}", + "futureOfListOfFutures" to "[{name=null}, {name=null}]\n${notFoo("futureOfListOfFutures[0]", "CompletableFuture")}\n${notFoo("futureOfListOfFutures[1]", "CompletableFuture")}", + "optional" to "{name=a}", + "result" to "{name=a}", + "plainFuture" to "{name=null}\n${notFoo("plainFuture", "FutureTask")}", + "box" to "{name=null}\n${notFoo("box", "Box")}", + "optionalResult" to "{name=null}\n${notFoo("optionalResult", "graphql.execution.DataFetcherResult")}", + "listOfFutures" to "[{name=null}, {name=null}]\n${notFoo("listOfFutures[0]", "CompletableFuture")}\n${notFoo("listOfFutures[1]", "CompletableFuture")}", + "listOfStringFutures" to "[CompletableFuture@...[Completed normally], CompletableFuture@...[Completed normally]]", + "boxOfString" to "Box@...", + "listOfOptionals" to "[a, null]", + "futureOfAny" to "a" + ) + } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/ResolverOwnershipTest.kt b/src/test/kotlin/graphql/kickstart/tools/ResolverOwnershipTest.kt new file mode 100644 index 00000000..7343a92d --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/ResolverOwnershipTest.kt @@ -0,0 +1,230 @@ +package graphql.kickstart.tools + +import com.tngtech.archunit.base.DescribedPredicate +import com.tngtech.archunit.base.DescribedPredicate.and +import com.tngtech.archunit.base.DescribedPredicate.not +import com.tngtech.archunit.core.domain.JavaAccess +import com.tngtech.archunit.core.domain.JavaClass +import com.tngtech.archunit.core.domain.JavaClass.Predicates.assignableTo +import com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAPackage +import com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAnyPackage +import com.tngtech.archunit.core.domain.JavaClasses +import com.tngtech.archunit.core.importer.ClassFileImporter +import com.tngtech.archunit.lang.conditions.ArchConditions.be +import com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes +import com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses +import graphql.execution.DataFetcherResult +import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper +import graphql.kickstart.tools.resolver.ArgumentConverter +import graphql.kickstart.tools.resolver.ResolverDataFetcher +import graphql.kickstart.tools.resolver.ResolverPlan +import graphql.kickstart.tools.resolver.TypeShape +import graphql.schema.DataFetcher +import org.apache.commons.lang3.reflect.FieldUtils +import org.apache.commons.lang3.reflect.MethodUtils +import org.junit.Test +import tools.jackson.core.JsonParser +import tools.jackson.databind.ObjectMapper +import tools.jackson.databind.ObjectReader +import tools.jackson.databind.ObjectWriter +import tools.jackson.databind.util.TokenBuffer +import java.lang.invoke.MethodHandle +import java.lang.invoke.MethodHandles +import java.lang.reflect.AccessibleObject +import java.lang.reflect.Executable +import java.lang.reflect.Field +import java.lang.reflect.Method +import java.lang.reflect.Parameter +import java.nio.file.Paths + +class ResolverOwnershipTest { + + companion object { + private val classes: JavaClasses = ClassFileImporter() + .importPath(Paths.get(ResolverPlan::class.java.protectionDomain.codeSource.location.toURI())) + + private val resolverPackage = ResolverPlan::class.java.packageName + private val MEMBER = "$resolverPackage.Member" + + private val resolverPlanFile = OwningFile( + "ResolverPlan.kt", "ResolverPlan", "ResolverPlanKt", "ResolverKind", "ExtraParameter", "FieldResolverError", "Member", "MethodMember", + "PropertyMember", "MapMember", "ResolverDataFetcher", "MethodFieldResolverDataFetcher", "LightMethodFieldResolverDataFetcher", + "PropertyFieldResolverDataFetcher", "MapFieldResolverDataFetcher" + ) + private val typeShapeFile = OwningFile( + "TypeShape.kt", "TypeShape", "TypeShapeKt", "Position", "Walk", "GenericWrappers", "CompareGenericWrappers", "Layer", "ContainerKind", "Step", + "Await", "Peel", "EachElement", "DataOf", "ValueOf", "Awaitable" + ) + private val argumentConverterFile = OwningFile("ArgumentConverter.kt", "ArgumentConverter", "ArgumentConverterKt") + private val owningFiles = listOf(resolverPlanFile, typeShapeFile, argumentConverterFile) + } + + private class OwningFile(val fileName: String, vararg topLevelClasses: String) : + DescribedPredicate("are declared in $fileName") { + val names = topLevelClasses.map { "${ResolverPlan::class.java.packageName}.$it" }.toSet() + + override fun test(javaClass: JavaClass) = javaClass.topLevelClass().name in names + } + + private class Calls(description: String, private val targets: Map>) : DescribedPredicate>(description) { + override fun test(access: JavaAccess<*>) = + targets.any { (owner, names) -> access.target.name in names && access.target.owner.isAssignableTo(owner) } + } + + // KCallable only from kotlin.reflect itself, since Kotlin compiles a callable reference such as Type::name into a class implementing it + private val kotlinReflection = resideInAnyPackage("kotlin.reflect.full", "kotlin.reflect.jvm") + .or(resideInAPackage("kotlin.reflect").and(assignableTo("kotlin.reflect.KCallable"))) + .`as`("are kotlin-reflect's member lookups and JVM mappings, or a KFunction, a KProperty or their getters and setters") + + private val memberReflection = Calls( + "reads, invokes or opens a Java or Kotlin member by reflection", + mapOf( + Method::class.java.name to setOf("invoke"), + Field::class.java.name to setOf( + "get", "getBoolean", "getByte", "getChar", "getShort", "getInt", "getLong", "getFloat", "getDouble", "getType", "getGenericType", + "getAnnotatedType", "set", "setBoolean", "setByte", "setChar", "setShort", "setInt", "setLong", "setFloat", "setDouble" + ), + Executable::class.java.name to setOf( + "getGenericParameterTypes", "getGenericReturnType", "getParameterTypes", "getParameterCount", "getAnnotatedReturnType", + "getAnnotatedParameterTypes" + ), + Parameter::class.java.name to setOf("getType", "getParameterizedType", "getAnnotatedType"), + AccessibleObject::class.java.name to setOf("setAccessible", "trySetAccessible"), + MethodHandles::class.java.name to setOf("privateLookupIn"), + MethodHandles.Lookup::class.java.name to setOf( + "unreflect", "unreflectGetter", "unreflectSetter", "unreflectSpecial", "unreflectVarHandle", "findVirtual", "findStatic", "findSpecial", + "findGetter", "findSetter", "findStaticGetter", "findStaticSetter", "findVarHandle", "findStaticVarHandle" + ), + MethodHandle::class.java.name to setOf("invoke", "invokeExact", "invokeWithArguments"), + "kotlin.reflect.KClass" to setOf("getMembers", "getConstructors"), + FieldUtils::class.java.name to setOf( + "getAllFields", "getAllFieldsList", "getField", "getDeclaredField", "readField", "readDeclaredField", "readStaticField", + "readDeclaredStaticField", "writeField", "writeDeclaredField", "writeStaticField", "writeDeclaredStaticField" + ), + MethodUtils::class.java.name to setOf("invokeMethod", "invokeExactMethod", "invokeStaticMethod", "invokeExactStaticMethod"), + ) + ) + + private val readsInputFieldTypes = object : DescribedPredicate>( + "is ScanDictionary.findInputValueTypeInType reading an input object's getter or field type, which it needs before any ResolverPlan exists" + ) { + private val reads = Calls( + "reads a member's declared type", + mapOf(Executable::class.java.name to setOf("getGenericReturnType", "getParameterCount"), Field::class.java.name to setOf("getGenericType")) + ) + + private val exempt = "${ScanDictionary::class.java.name}.findInputValueTypeInType(${String::class.java.name}, ${Class::class.java.name})" + + override fun test(access: JavaAccess<*>) = access.origin.fullName == exempt && reads.test(access) + } + + private val tokenBufferConversion = Calls( + "converts a value through a Jackson TokenBuffer", + mapOf( + TokenBuffer::class.java.name to setOf("", "forInputParsing", "forGeneration", "asParser"), + ObjectWriter::class.java.name to setOf("writeValueIntoBuffer"), + ObjectMapper::class.java.name to setOf("readValue", "convertValue", "updateValue", "treeToValue", "valueToTree"), + ObjectReader::class.java.name to setOf("readValue", "readValues", "treeToValue"), + JsonParser::class.java.name to setOf("readValueAs", "readValueAsTree"), + ) + ) + + private val argumentConversion = Calls( + "builds or calls an ArgumentConverter", + mapOf(ArgumentConverter::class.java.name to setOf("", "convert")) + ) + + private val genericWrapperDispatch = Calls( + "reads a generic wrapper's type, schema wrapper or transformer", + mapOf(GenericWrapper::class.java.name to setOf("getType", "getIndex", "getSchemaWrapper", "getTransformer", "getTransformerReturnsCompletionStage")) + ) + + private val buildsAnUnwrapper = Calls("builds a TypeShape.Unwrapper", mapOf(TypeShape.Unwrapper::class.java.name to setOf(""))) + + @Test + fun `each owning file lists exactly the top-level classes it declares`() { + val misplaced = owningFiles.flatMap { file -> file.names.filter { !classes.contain(it) || classes.get(it).sourceFileName() != file.fileName } } + assert(misplaced.isEmpty()) { + "ResolverOwnershipTest lists classes that weren't compiled from their OwningFile: $misplaced. Move, remove or rename them in its OwningFile lists" + } + + val unlisted = owningFiles.flatMap { file -> + classes.filter { it.packageName == resolverPackage && it.isTopLevelClass && it.sourceFileName() == file.fileName } + .map { it.name } + .filter { it !in file.names } + } + assert(unlisted.isEmpty()) { + "These classes were compiled from a file named like an owning file but aren't in its OwningFile list in ResolverOwnershipTest: $unlisted. " + + "Add a class declared in that file to its list. Rename any other file, since only one file in $resolverPackage owns each name" + } + } + + @Test + fun `only the resolver plan reflects on resolver members`() { + noClasses().that(not(resolverPlanFile)) + .should().accessTargetWhere(and(memberReflection, not(readsInputFieldTypes))) + .orShould().dependOnClassesThat(kotlinReflection) + .because("ResolverPlan.kt reads each field's member once, at schema build, and is the only place that invokes it. " + + "Read what you need from the ResolverPlan, such as its argument targets or type shapes, or add it there") + .check(classes) + } + + @Test + fun `member variants never build a data fetcher`() { + noClasses().that().areAssignableTo(MEMBER) + .should().dependOnClassesThat().areAssignableTo(DataFetcher::class.java) + .orShould().dependOnClassesThat().areAssignableTo(TypeShape.Unwrapper::class.java) + .because("ResolverPlan builds every data fetcher for a member and unwraps its value with TypeShape.Unwrapper, " + + "so a member that builds its own fetcher skips the unwrapping. Give the member what its fetcher needs and let ResolverPlan.dataFetcher build it") + .check(classes) + } + + @Test + fun `every library data fetcher is a ResolverDataFetcher in ResolverPlan kt`() { + classes().that().implement(DataFetcher::class.java) + .should().beAssignableTo(ResolverDataFetcher::class.java) + .andShould(be(resolverPlanFile.`as`("declared in ${resolverPlanFile.fileName}"))) + .because("ResolverDataFetcher's constructor takes the TypeShape.Unwrapper the scan matched, so a resolver's value reaches graphql-java " + + "fully unwrapped. Add the member to ResolverPlan and its fetcher as a ResolverDataFetcher in ResolverPlan.kt instead of a new fetcher") + .check(classes) + } + + @Test + fun `only the resolver plan builds an unwrapper`() { + noClasses().that(not(resolverPlanFile.or(typeShapeFile))) + .should().accessTargetWhere(buildsAnUnwrapper) + .because("ResolverPlan.dataFetcher builds one unwrapper per field from the type shape the scan matched") + .check(classes) + } + + @Test + fun `only TypeShape dispatches on containers`() { + noClasses().that(not(typeShapeFile)) + .should().accessTargetWhere(genericWrapperDispatch) + .orShould().dependOnClassesThat().areAssignableTo(DataFetcherResult::class.java) + .because("TypeShape.kt walks a declared type once and unwraps values by the same layers, so a container handled anywhere else " + + "can disagree with it. Add a ContainerKind or a generic wrapper, or ask TypeShape") + .check(classes) + } + + @Test + fun `only the argument converter converts through a TokenBuffer`() { + noClasses().that(not(argumentConverterFile)) + .should().accessTargetWhere(tokenBufferConversion) + .orShould().dependOnClassesThat().areAssignableTo(TokenBuffer::class.java) + .because("ArgumentConverter is the one entry point that turns a coerced argument into a parameter's type, with its fallbacks for scalars Jackson can't convert. Use the ResolverPlan's ArgumentConverter") + .check(classes) + } + + @Test + fun `only the resolver plan converts arguments`() { + noClasses().that(not(resolverPlanFile.or(argumentConverterFile))) + .should().accessTargetWhere(argumentConversion) + .because("ResolverPlan builds one ArgumentConverter per argument at schema build, next to the argument's Optional and scalar handling. Read the plan's argument targets instead") + .check(classes) + } +} + +private fun JavaClass.topLevelClass(): JavaClass = generateSequence(this) { it.enclosingClass.orElse(null) }.last() + +private fun JavaClass.sourceFileName(): String? = source.flatMap { it.fileName }.orElse(null) diff --git a/src/test/kotlin/graphql/kickstart/tools/FieldResolverScannerTest.kt b/src/test/kotlin/graphql/kickstart/tools/ResolverPlanTest.kt similarity index 52% rename from src/test/kotlin/graphql/kickstart/tools/FieldResolverScannerTest.kt rename to src/test/kotlin/graphql/kickstart/tools/ResolverPlanTest.kt index c760c2a7..f8ec035b 100644 --- a/src/test/kotlin/graphql/kickstart/tools/FieldResolverScannerTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/ResolverPlanTest.kt @@ -2,9 +2,7 @@ package graphql.kickstart.tools import graphql.kickstart.tools.SchemaParserOptions.Companion.defaultOptions import graphql.kickstart.tools.resolver.FieldResolverError -import graphql.kickstart.tools.resolver.FieldResolverScanner -import graphql.kickstart.tools.resolver.MethodFieldResolver -import graphql.kickstart.tools.resolver.PropertyFieldResolver +import graphql.kickstart.tools.resolver.ResolverPlan import graphql.language.FieldDefinition import graphql.language.InputValueDefinition import graphql.language.TypeName @@ -15,91 +13,90 @@ import graphql.schema.DataFetchingEnvironment import org.junit.Test import java.util.* -class FieldResolverScannerTest { +class ResolverPlanTest { private val options = defaultOptions() - private val scanner = FieldResolverScanner(options, GRAPHQL_SCALARS.keys) + private val finder = ResolverPlan.Finder(options, GRAPHQL_SCALARS.keys) + + private fun ResolverPlan.reference() = typeShapes().last().reference.toString() @Test - fun `scanner finds fields on multiple root types`() { + fun `finder finds fields on multiple root types`() { val resolver = RootResolverInfo(listOf(RootQuery1(), RootQuery2()), options) - val result1 = scanner.findFieldResolver(FieldDefinition("field1", TypeName("String")), resolver) - val result2 = scanner.findFieldResolver(FieldDefinition("field2", TypeName("String")), resolver) + val result1 = finder.find(FieldDefinition("field1", TypeName("String")), resolver) + val result2 = finder.find(FieldDefinition("field2", TypeName("String")), resolver) assertNotEquals(result1.search.source, result2.search.source) } @Test(expected = FieldResolverError::class) - fun `scanner throws exception when more than one resolver method is found`() { + fun `finder throws exception when more than one resolver method is found`() { val resolver = RootResolverInfo(listOf(RootQuery1(), DuplicateQuery()), options) - scanner.findFieldResolver(FieldDefinition("field1", TypeName("String")), resolver) + finder.find(FieldDefinition("field1", TypeName("String")), resolver) } @Test(expected = FieldResolverError::class) - fun `scanner throws exception when no resolver methods are found`() { + fun `finder throws exception when no resolver methods are found`() { val resolver = RootResolverInfo(listOf(), options) - scanner.findFieldResolver(FieldDefinition("field1", TypeName("String")), resolver) + finder.find(FieldDefinition("field1", TypeName("String")), resolver) } @Test - fun `scanner finds properties when no method is found`() { + fun `finder finds properties when no method is found`() { val resolver = RootResolverInfo(listOf(PropertyQuery()), options) - val name = scanner.findFieldResolver(FieldDefinition("name", TypeName("String")), resolver) - val version = scanner.findFieldResolver(FieldDefinition("version", TypeName("Integer")), resolver) + val name = finder.find(FieldDefinition("name", TypeName("String")), resolver) + val version = finder.find(FieldDefinition("version", TypeName("Integer")), resolver) - assert(name is PropertyFieldResolver) - assert(version is PropertyFieldResolver) + assertEquals(name.reference(), "type of field ${PropertyQuery::class.java.getDeclaredField("name")}") + assertEquals(version.reference(), "type of field ${ParentPropertyQuery::class.java.getDeclaredField("version")}") } @Test - fun `scanner finds generic return type`() { + fun `finder finds generic return type`() { val resolver = RootResolverInfo(listOf(GenericQuery()), options) - val users = scanner.findFieldResolver(FieldDefinition("users", TypeName("UserConnection")), resolver) + val users = finder.find(FieldDefinition("users", TypeName("UserConnection")), resolver) - assert(users is MethodFieldResolver) + assertEquals(users.reference(), "return type of method ${GenericQuery::class.java.getMethod("getUsers")}") } @Test - fun `scanner prefers concrete resolver`() { + fun `finder prefers concrete resolver`() { val resolver = DataClassResolverInfo(Kayak::class.java) - val meta = scanner.findFieldResolver(FieldDefinition("information", TypeName("VehicleInformation")), resolver) + val meta = finder.find(FieldDefinition("information", TypeName("VehicleInformation")), resolver) - assert(meta is MethodFieldResolver) - assertEquals((meta as MethodFieldResolver).method.returnType, BoatInformation::class.java) + assertEquals(meta.typeShapes().last().leafJavaType, BoatInformation::class.java) } @Test - fun `scanner finds field resolver method using camelCase for snake_cased field_name`() { + fun `finder finds field resolver method using camelCase for snake_cased field_name`() { val resolver = RootResolverInfo(listOf(CamelCaseQuery1()), options) - val meta = scanner.findFieldResolver(FieldDefinition("hull_type", TypeName("HullType")), resolver) + val meta = finder.find(FieldDefinition("hull_type", TypeName("HullType")), resolver) - assert(meta is MethodFieldResolver) - assertEquals((meta as MethodFieldResolver).method.returnType, HullType::class.java) + assertEquals(meta.reference(), "return type of method ${CamelCaseQuery1::class.java.getMethod("getHullType")}") } @Test - fun `scanner finds field resolver method using capitalize field_name in different locale`() { + fun `finder finds field resolver method using capitalize field_name in different locale`() { val default = Locale.getDefault() Locale.setDefault(Locale.forLanguageTag("tr-TR")) val resolverInfo = RootResolverInfo(listOf(CapitalizeQuery()), options) - val fieldResolver = scanner.findFieldResolver(FieldDefinition("id", TypeName("HullType")), resolverInfo) + val plan = finder.find(FieldDefinition("id", TypeName("HullType")), resolverInfo) - assert(fieldResolver is MethodFieldResolver) - assertEquals((fieldResolver as MethodFieldResolver).method.returnType, HullType::class.java) + assertEquals(plan.reference(), "return type of method ${CapitalizeQuery::class.java.getMethod("getId")}") Locale.setDefault(default) } @Test - fun `scanner ignores extension functions on root resolvers`() { + fun `finder ignores extension functions on root resolvers`() { val resolver = RootResolverInfo(listOf(UserQuery(), ExtensionQuery()), options) val field = FieldDefinition.newFieldDefinition() .name("user") @@ -107,18 +104,17 @@ class FieldResolverScannerTest { .inputValueDefinition(InputValueDefinition("id", TypeName("ID"))) .build() - val user = scanner.findFieldResolver(field, resolver) + val user = finder.find(field, resolver) - assert(user is MethodFieldResolver) - assertEquals((user as MethodFieldResolver).method.declaringClass, UserQuery::class.java) + assertEquals(user.reference(), "return type of method ${UserQuery::class.java.getMethod("user", String::class.java)}") } @Test - fun `scanner finds field resolver methods in priority order`() { + fun `finder finds field resolver methods in priority order`() { val resolverInfo = RootResolverInfo(listOf(PriorityQuery()), options) fun methodName(name: String, type: String) = - (scanner.findFieldResolver(FieldDefinition(name, TypeName(type)), resolverInfo) as MethodFieldResolver).method.name + finder.find(FieldDefinition(name, TypeName(type)), resolverInfo).reference().substringAfter("${PriorityQuery::class.java.name}.").substringBefore("(") assertEquals(methodName("name", "String"), "name") assertEquals(methodName("active", "Boolean"), "isActive") @@ -126,6 +122,29 @@ class FieldResolverScannerTest { assertEquals(methodName("count", "Int"), "getFieldCount") } + @Test + fun `finder takes a method before a field and a field before a Map key`() { + fun reference(dataClass: Class<*>) = finder.find(FieldDefinition("value", TypeName("String")), DataClassResolverInfo(dataClass)).reference() + + assertEquals(reference(MapWithMethod::class.java), "return type of method ${MapWithMethod::class.java.getMethod("getValue")}") + assertEquals(reference(MapWithField::class.java), "type of field ${MapWithField::class.java.getField("value")}") + assertEquals(reference(PlainMap::class.java), "type of field value") + } + + class PlainMap : HashMap() + + class MapWithField : HashMap() { + @JvmField + val value: String = "field" + } + + class MapWithMethod : HashMap() { + @JvmField + val value: String = "field" + + fun getValue(): String = "method" + } + class RootQuery1 : GraphQLQueryResolver { fun field1() {} } diff --git a/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerDirectiveTest.kt b/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerDirectiveTest.kt index d4be4579..34acc20b 100644 --- a/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerDirectiveTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerDirectiveTest.kt @@ -293,7 +293,6 @@ class SchemaClassScannerDirectiveTest { assertEquals(error.message, message) } - // the enum and directive from issue #823 private val linkDirective = """ enum Purpose { SECURITY EXECUTION } diff --git a/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerInterfaceFieldTest.kt b/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerInterfaceFieldTest.kt index de4c06b0..a8d44642 100644 --- a/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerInterfaceFieldTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/SchemaClassScannerInterfaceFieldTest.kt @@ -304,6 +304,46 @@ class SchemaClassScannerInterfaceFieldTest { assert(schema.getType("Entry") is GraphQLInterfaceType) } + @Test + fun `scanner handles interfaces used only by fields of interface extensions`() { + val schema = SchemaParser.newParser() + .schemaString( + """ + type Query { + container: Container + } + + interface Container { + id: ID + } + + extend interface Container { + entry: Entry + } + + interface Entry { + id: ID! + } + + interface Draft implements Entry { + id: ID! + } + + type Box implements Container { + id: ID + entry: Draft + } + """) + .resolvers(InterfaceOnlyInterface()) + .dictionary(InterfaceOnlyInterface.Box::class) + .build() + .makeExecutableSchema() + .assertEveryFieldResolves() + + assertEquals((schema.getType("Container") as GraphQLInterfaceType).fieldDefinitions.map { it.name }, listOf("id", "entry")) + assert(schema.getType("Entry") is GraphQLInterfaceType) + } + class InterfaceOnlyInterface : GraphQLQueryResolver { fun container(): Container? = null @@ -311,7 +351,7 @@ class SchemaClassScannerInterfaceFieldTest { interface Draft - class Box(val entry: Draft?) : Container + class Box(val entry: Draft?, val id: String? = null) : Container } @Test diff --git a/src/test/kotlin/graphql/kickstart/tools/SchemaParserDictionaryTest.kt b/src/test/kotlin/graphql/kickstart/tools/SchemaParserDictionaryTest.kt index 17a4adf5..103174e6 100644 --- a/src/test/kotlin/graphql/kickstart/tools/SchemaParserDictionaryTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/SchemaParserDictionaryTest.kt @@ -196,4 +196,28 @@ class SchemaParserDictionaryTest { assertEquals(error.message, "Class in supplied dictionary '${ThirdItem::class.java.name}' specified type names 'A', 'B', " + "but only input object types can share a class!") } + + @Test + fun `dictionary names need a type definition, which an object or input extension alone isn't`() { + fun parser(extension: String) = SchemaParser.newParser() + .schemaString("type Query { id: ID }\n$extension") + .resolvers(object : GraphQLQueryResolver { + fun id(): String = "1" + }) + .dictionary("Item", ThirdItem::class) + .build() + + listOf("extend type Item { id: Int }", "extend input Item { id: Int }").forEach { extension -> + val error = assertThrows(SchemaClassScannerError::class.java) { parser(extension) } + + assertEquals(error.message, "Class in supplied dictionary '${ThirdItem::class.java.name}' specified type name 'Item', " + + "but a type definition with that name was not found!") + } + + val (_, warnings) = withWarnings { parser("extend union Item = Query") } + assertEquals(warnings, listOf( + "Dictionary mapping was provided but never used, and can be safely deleted: \"Item\" -> ${ThirdItem::class.java.name}", + "Schema type was defined but can never be accessed, and can be safely deleted: Item" + )) + } } diff --git a/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt b/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt index 61d1d457..0a6d510b 100644 --- a/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt @@ -3,6 +3,7 @@ package graphql.kickstart.tools import graphql.ExecutionResult import graphql.GraphQL import graphql.kickstart.tools.resolver.FieldResolverError +import graphql.language.ObjectTypeDefinition import graphql.parser.InvalidSyntaxException import graphql.schema.* import graphql.schema.idl.SchemaDirectiveWiring @@ -316,6 +317,84 @@ class SchemaParserTest { assertEquals(error.message, "Union 'Result' contains itself through Result -> Result at line 5, column 23.") } + @Test + fun `parser should throw descriptive exception when a union extension lists a union that contains it`() { + val error = assertThrows(SchemaError::class.java) { + unionParser( + """ + |union Result = Book | Media + |union Media = Movie + |extend union Media = Result + """.trimMargin()) + } + + assertEquals(error.message, "Union 'Result' contains itself through Result -> Media -> Result at line 7, column 22.") + } + + @Test + fun `parser lists a member once when nested unions reach it more than once`() { + val schema = unionParser( + """ + |union Result = Left | Right + |union Left = Book + |extend union Left = Shared + |union Right = Shared + |union Shared = Movie + """.trimMargin()) + + assertEquals(listOf("Result", "Left", "Right").associateWith { name -> (schema.getType(name) as GraphQLUnionType).types.map { it.name } }, mapOf( + "Result" to listOf("Book", "Movie"), + "Left" to listOf("Book", "Movie"), + "Right" to listOf("Movie") + )) + } + + @Test + fun `parser builds a type defined twice from its last definition, or from its first when only its interface reaches it`() { + val (throughField, fieldWarnings) = withWarnings { + SchemaParser.newParser() + .schemaString( + """ + type Query { item: Item } + type Item { id: ID } + type Item { id: ID name: String } + """) + .resolvers(TwiceDefinedQuery()) + .build() + } + + assertEquals(fieldWarnings, listOf()) + assertEquals(throughField.getUnusedDefinitions(), setOf()) + assertEquals((throughField.makeExecutableSchema().getType("Item") as GraphQLObjectType).fieldDefinitions.map { it.name }, listOf("id", "name")) + + val (throughInterface, interfaceWarnings) = withWarnings { + SchemaParser.newParser() + .schemaString( + """ + type Query { node: Node } + interface Node { id: ID } + type Item implements Node { id: ID } + type Item implements Node { id: ID name: String } + """) + .resolvers(TwiceDefinedQuery()) + .dictionary("Item", TwiceDefined::class) + .build() + } + + assertEquals(interfaceWarnings, listOf("Schema type was defined but can never be accessed, and can be safely deleted: Item")) + assertEquals(throughInterface.getUnusedDefinitions().map { it.name to (it as ObjectTypeDefinition).fieldDefinitions.map { field -> field.name } }, listOf("Item" to listOf("id", "name"))) + assertEquals((throughInterface.makeExecutableSchema().getType("Item") as GraphQLObjectType).fieldDefinitions.map { it.name }, listOf("id")) + } + + class TwiceDefinedQuery : GraphQLQueryResolver { + fun item(): TwiceDefined = TwiceDefined("1", "one") + fun node(): TwiceDefinedNode = TwiceDefined("1", "one") + } + + interface TwiceDefinedNode + + class TwiceDefined(val id: String, val name: String?) : TwiceDefinedNode + private fun unionParser(unions: String) = SchemaParser.newParser() .schemaString( """ diff --git a/src/test/kotlin/graphql/kickstart/tools/TestUtils.kt b/src/test/kotlin/graphql/kickstart/tools/TestUtils.kt index 2874c8f7..36e060a3 100644 --- a/src/test/kotlin/graphql/kickstart/tools/TestUtils.kt +++ b/src/test/kotlin/graphql/kickstart/tools/TestUtils.kt @@ -41,6 +41,11 @@ fun assertNotNull(actual: T) { } fun withWarnings(block: () -> T): Pair> { + val (result, events) = withWarningEvents(block) + return result to events.map { it.formattedMessage } +} + +fun withWarningEvents(block: () -> T): Pair> { // the tests run in the library's module, which doesn't read logback's listOf("ch.qos.logback.classic", "ch.qos.logback.core").forEach { name -> ModuleLayer.boot().findModule(name).ifPresent { SchemaParser::class.java.module.addReads(it) } @@ -50,7 +55,7 @@ fun withWarnings(block: () -> T): Pair> { logger.addAppender(appender) try { val result = block() - return result to appender.list.filter { it.level.isGreaterOrEqual(Level.WARN) }.map { it.formattedMessage } + return result to appender.list.filter { it.level.isGreaterOrEqual(Level.WARN) } } finally { logger.detachAppender(appender) } diff --git a/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt b/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt index 06868a81..24b00af3 100644 --- a/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/TypeClassMatcherTest.kt @@ -2,7 +2,7 @@ package graphql.kickstart.tools import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper.Companion.listCollectionWithTransformer -import graphql.kickstart.tools.resolver.FieldResolverScanner +import graphql.kickstart.tools.resolver.ResolverPlan import graphql.kickstart.tools.util.ParameterizedTypeImpl import graphql.language.* import graphql.language.Type @@ -28,13 +28,11 @@ class TypeClassMatcherTest { private val customType: Type<*> = TypeName("CustomType") private val unwrappedCustomType: Type<*> = TypeName("UnwrappedGenericCustomType") - private val customDefinition: TypeDefinition<*> = ObjectTypeDefinition("CustomType") - private val unwrappedCustomDefinition: TypeDefinition<*> = ObjectTypeDefinition("UnwrappedGenericCustomType") + private val definitions = MergedDefinitions(listOf(ObjectTypeDefinition("CustomType"), ObjectTypeDefinition("UnwrappedGenericCustomType"))) + private val customDefinition: MergedType<*> = definitions.byName.getValue("CustomType") + private val unwrappedCustomDefinition: MergedType<*> = definitions.byName.getValue("UnwrappedGenericCustomType") - private val matcher: TypeClassMatcher = TypeClassMatcher(mapOf( - "CustomType" to customDefinition, - "UnwrappedGenericCustomType" to unwrappedCustomDefinition - )) + private val matcher: TypeClassMatcher = TypeClassMatcher(definitions) private val options: SchemaParserOptions = SchemaParserOptions.newOptions().genericWrappers( GenericWrapper( @@ -47,14 +45,11 @@ class TypeClassMatcherTest { ) { x -> x } ).build() - private val scanner: FieldResolverScanner = FieldResolverScanner(options, GRAPHQL_SCALARS.keys) + private val finder = ResolverPlan.Finder(options, GRAPHQL_SCALARS.keys) private val resolver = RootResolverInfo(listOf(QueryMethods()), options) - private fun createPotentialMatch(methodName: String, graphQLType: Type<*>): TypeClassMatcher.PotentialMatch { - return scanner.findFieldResolver(FieldDefinition(methodName, graphQLType), resolver) - .scanForMatches() - .find { it.location == TypeClassMatcher.Location.RETURN_TYPE }!! - } + private fun matchReturnType(methodName: String, graphQLType: Type<*>): TypeClassMatcher.Match = + matcher.match(finder.find(FieldDefinition(methodName, graphQLType), resolver).typeShapes().single()) private fun list(other: Type<*> = customType): Type<*> = ListType(other) private fun nonNull(other: Type<*> = customType): Type<*> = NonNullType(other) @@ -65,7 +60,7 @@ class TypeClassMatcherTest { @Test fun `matcher verifies that nested return type matches graphql definition for method`() { - val match = matcher.match(createPotentialMatch(methodName, type)) + val match = matchReturnType(methodName, type) match as TypeClassMatcher.ValidMatch assertEquals(match.type, customDefinition) assertEquals(match.javaType, CustomType::class.java) @@ -100,7 +95,7 @@ class TypeClassMatcherTest { @Test(expected = SchemaClassScannerError::class) fun `matcher verifies that nested return type doesn't match graphql definition for method`() { - matcher.match(createPotentialMatch(methodName, type)) + matchReturnType(methodName, type) } companion object { @@ -120,7 +115,7 @@ class TypeClassMatcherTest { @Test(expected = SchemaClassScannerError::class) fun `matcher verifies return value optionals are used incorrectly for method`() { - matcher.match(createPotentialMatch(methodName, type)) + matchReturnType(methodName, type) } companion object { @@ -139,7 +134,7 @@ class TypeClassMatcherTest { class Suit4 { @Test fun `matcher allows unwrapped parameterized types as root types`() { - val match = matcher.match(createPotentialMatch("genericCustomUnwrappedType", unwrappedCustomType)) + val match = matchReturnType("genericCustomUnwrappedType", unwrappedCustomType) match as TypeClassMatcher.ValidMatch assertEquals(match.type, unwrappedCustomDefinition) val javatype = match.javaType as ParameterizedTypeImpl diff --git a/src/test/kotlin/graphql/kickstart/tools/TypeExtensionTest.kt b/src/test/kotlin/graphql/kickstart/tools/TypeExtensionTest.kt index 1d92cc3a..67c8ef4e 100644 --- a/src/test/kotlin/graphql/kickstart/tools/TypeExtensionTest.kt +++ b/src/test/kotlin/graphql/kickstart/tools/TypeExtensionTest.kt @@ -6,6 +6,7 @@ import graphql.language.Definition import graphql.language.EnumTypeDefinition import graphql.language.FieldDefinition import graphql.language.InterfaceTypeDefinition +import graphql.language.InterfaceTypeExtensionDefinition import graphql.language.ObjectTypeDefinition import graphql.language.ScalarTypeDefinition import graphql.language.TypeName @@ -54,7 +55,7 @@ class TypeExtensionTest { $fooBarBaz """) { dictionary(Foo::class, Bar::class, Baz::class, Item::class) - scalars(GraphQLScalarType.newScalar().name("Date").coercing(Scalars.GraphQLString.coercing).build()) + scalars(date) }.makeExecutableSchema() .assertEveryFieldResolves() @@ -96,6 +97,116 @@ class TypeExtensionTest { assertEquals(data, mapOf("fooBar" to mapOf("__typename" to "Baz"), "color" to "GREEN", "node" to mapOf("id" to "1", "name" to "item"))) } + @Test + fun `every kind of type is built from its definition followed by its extensions`() { + val schema = parser( + """ + directive @tag(name: String!) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR + + type Query @tag(name: "Query") { node: Node } + extend type Query @tag(name: "Query extension") { + fooBar: FooBar + color: Color + search(filter: Filter): String + today: Date + } + + interface Entity { id: ID! } + interface Node @tag(name: "Node") { id: ID! } + extend interface Node implements Entity @tag(name: "Node extension") { name: String } + + type Item implements Node @tag(name: "Item") { id: ID! } + extend type Item implements Entity @tag(name: "Item extension") { name: String } + + union FooBar @tag(name: "FooBar") = Foo + extend union FooBar @tag(name: "FooBar extension") = Bar | Baz + + enum Color @tag(name: "Color") { RED } + extend enum Color @tag(name: "Color extension") { GREEN } + + input Filter @tag(name: "Filter") { id: ID } + extend input Filter @tag(name: "Filter extension") { limit: Int inner: Inner and: Filter } + input Inner { id: ID } + + scalar Date @tag(name: "Date") + extend scalar Date @tag(name: "Date extension") @specifiedBy(url: "https://example.com/date") + + $fooBarBaz + """) { + dictionary(Foo::class, Bar::class, Baz::class, Item::class) + scalars(date) + }.makeExecutableSchema() + .assertEveryFieldResolves() + + val types = listOf("Query", "Node", "Item", "FooBar", "Color", "Filter", "Date") + val printer = SchemaPrinter(SchemaPrinter.Options.defaultOptions().setComparators(GraphqlTypeComparatorRegistry.AS_IS_REGISTRY)) + assertEquals(types.joinToString("\n") { printer.print(schema.getType(it)) }, """ + |type Query @tag(name : "Query") @tag(name : "Query extension") { + | node: Node + | fooBar: FooBar + | color: Color + | search(filter: Filter): String + | today: Date + |} + | + |interface Node implements Entity @tag(name : "Node") @tag(name : "Node extension") { + | id: ID! + | name: String + |} + | + |type Item implements Node & Entity @tag(name : "Item") @tag(name : "Item extension") { + | id: ID! + | name: String + |} + | + |union FooBar @tag(name : "FooBar") @tag(name : "FooBar extension") = Foo | Bar | Baz + | + |enum Color @tag(name : "Color") @tag(name : "Color extension") { + | RED + | GREEN + |} + | + |input Filter @tag(name : "Filter") @tag(name : "Filter extension") { + | id: ID + | limit: Int + | inner: Inner + | and: Filter + |} + | + |scalar Date @tag(name : "Date") @tag(name : "Date extension") @specifiedBy(url : "https://example.com/date") + |""".trimMargin()) + + assertEquals(types.associateWith { schema.definitionClasses(it) }, mapOf( + "Query" to listOf("ObjectTypeDefinition", "ObjectTypeExtensionDefinition"), + "Node" to listOf("InterfaceTypeDefinition", "InterfaceTypeExtensionDefinition"), + "Item" to listOf("ObjectTypeDefinition", "ObjectTypeExtensionDefinition"), + "FooBar" to listOf("UnionTypeDefinition", "UnionTypeExtensionDefinition"), + "Color" to listOf("EnumTypeDefinition", "EnumTypeExtensionDefinition"), + "Filter" to listOf("InputObjectTypeDefinition", "InputObjectTypeExtensionDefinition"), + "Date" to listOf("ScalarTypeDefinition", "ScalarTypeExtensionDefinition") + )) + + val data = assertNoGraphQlErrors(GraphQL.newGraphQL(schema).build()) { + """ + query { + node { id name } + fooBar { __typename } + color + search(filter: { id: "1", limit: 2, and: { id: "2" } }) + today + } + """ + } + + assertEquals(data, mapOf( + "node" to mapOf("id" to "1", "name" to "item"), + "fooBar" to mapOf("__typename" to "Baz"), + "color" to "GREEN", + "search" to "1 limit 2 and 2 limit null", + "today" to "2026-10-12" + )) + } + @Test fun `union extensions can add nested unions that no field returns`() { val schema = parser( @@ -254,7 +365,7 @@ class TypeExtensionTest { type Baz { baz: String } """) { dictionary(Item::class, Baz::class) - scalars(GraphQLScalarType.newScalar().name("Date").coercing(Scalars.GraphQLString.coercing).build()) + scalars(date) directive("tag", wiring) directive("once", wiring) }.makeExecutableSchema() @@ -365,13 +476,17 @@ class TypeExtensionTest { } @Test - fun `enums and unions that only have extensions are built from them`() { + fun `interfaces, unions, enums and scalars that only have extensions are built from the first one`() { val (schema, warnings) = withWarnings { parser( """ + directive @tag(name: String!) on SCALAR + type Query { color: Color fooBar: FooBar + node: Node + today: Date } extend enum Color { @@ -383,9 +498,17 @@ class TypeExtensionTest { extend union FooBar = Foo | Bar extend union FooBar = Baz + extend interface Node { id: ID! } + extend interface Node { name: String } + type Item implements Node { id: ID! name: String } + + extend scalar Date @tag(name: "Date extension") + extend scalar Date @specifiedBy(url: "https://example.com/date") + $fooBarBaz """) { - dictionary(Foo::class, Bar::class, Baz::class) + dictionary(Foo::class, Bar::class, Baz::class, Item::class) + scalars(date) }.makeExecutableSchema() } schema.assertEveryFieldResolves() @@ -393,9 +516,43 @@ class TypeExtensionTest { assertEquals(warnings, listOf()) val color = schema.getType("Color") as GraphQLEnumType + val date = schema.getType("Date") as GraphQLScalarType assertEquals(color.values.map { it.name }, listOf("RED", "GREEN")) assertEquals(color.getValue("RED")?.description, "The first red") assertEquals((schema.getType("FooBar") as GraphQLUnionType).types.map { it.name }, listOf("Foo", "Bar", "Baz")) + assertEquals((schema.getType("Node") as GraphQLInterfaceType).fieldDefinitions.map { it.name }, listOf("id", "name")) + assertEquals(date.appliedDirectives.map { it.name }, listOf("tag", "specifiedBy")) + assertEquals(date.specifiedByUrl, "https://example.com/date") + + assertEquals(listOf("Color", "FooBar", "Node", "Date").associateWith { schema.definitionClasses(it) }, mapOf( + "Color" to listOf("EnumTypeExtensionDefinition", "EnumTypeExtensionDefinition"), + "FooBar" to listOf("UnionTypeExtensionDefinition", "UnionTypeExtensionDefinition"), + "Node" to listOf("InterfaceTypeExtensionDefinition", "InterfaceTypeExtensionDefinition"), + "Date" to listOf("ScalarTypeExtensionDefinition", "ScalarTypeExtensionDefinition") + )) + } + + @Test + fun `object and input extensions without a definition don't define their type`() { + val (schema, warnings) = withWarnings { + parser( + """ + type Query { today: String } + extend type Orphan { id: ID } + extend input OrphanInput { id: ID } + """).makeExecutableSchema() + } + + assertEquals(warnings, listOf()) + assertEquals(listOf("Orphan", "OrphanInput").map { schema.getType(it) }, listOf(null, null)) + + listOf( + "type Query { node: Node } extend type Node { id: ID! }" to "Node", + "type Query { search(filter: Filter): String } extend input Filter { id: ID }" to "Filter" + ).forEach { (sdl, name) -> + val message = assertThrows(SchemaClassScannerError::class.java) { parser(sdl) }.message.orEmpty() + assert(message.startsWith("Unable to match type definition ($name) for reference ") && message.endsWith(": No TypeDefinition for type name $name")) { message } + } } @Test @@ -547,6 +704,79 @@ class TypeExtensionTest { assertEquals(error.message, "Type 'Item' declares field 'name' more than once.") } + @Test + fun `a repeat in an extension is reported after scanner and Java enum errors and before missing enum values`() { + val cases = listOf( + Repeat( + """ + |type Query { fooBar: FooBar } + |union FooBar = Foo | Bar + |extend union FooBar = Bar | Baz + |$fooBarBaz + """, + "SchemaClassScannerError: Object type 'Baz' is a member of a known union, but no class could be found for that type name. Please pass a class for type 'Baz' in the parser's dictionary.", + Foo::class, Bar::class + ), + Repeat( + """ + |type Query { shade: Shade } + |enum Shade { DARK } + |extend enum Shade { DARK } + """, + "SchemaError: Type 'Shade' is declared as an enum in the GraphQL schema but is not a Java enum!" + ), + Repeat( + """ + |type Query { color: Color } + |enum Color { BLUE } + |extend enum Color { BLUE } + """, + "SchemaError: Type 'Color' declares value 'BLUE' more than once at line 3, column 21." + ) + ) + + cases.forEach { repeat -> + val error = assertThrows(RuntimeException::class.java) { + parser(repeat.schema.trimMargin()) { dictionary(*repeat.dictionary) }.makeExecutableSchema() + } + + assertEquals("${error.javaClass.simpleName}: ${error.message}", repeat.message) + } + } + + @Test + fun `a repeat in an extension names the source of the extension`() { + val error = assertThrows(SchemaError::class.java) { + SchemaParser.newParser() + .schemaString("type Query { search(filter: Filter): String }\ninput Filter { id: ID }", "Base.graphqls") + .schemaString("extend input Filter {\n id: ID\n}", "Extensions.graphqls") + .resolvers(Query()) + .build() + .makeExecutableSchema() + } + + assertEquals(error.message, "Type 'Filter' declares field 'id' more than once at line 2, column 5 in Extensions.graphqls.") + } + + @Test + fun `a type error names the first use of a type reference in the definitions before the uses in extensions`() { + val filter = TypeName("Filter") + fun field(name: String) = FieldDefinition.newFieldDefinition().name(name).type(filter).build() + val error = assertThrows(SchemaError::class.java) { + parser("type Query { today: String }\ninterface Node { id: ID }\ninput Filter { id: ID }") { + options(SchemaParserOptions.newOptions().includeUnusedTypes(true).typeDefinitionFactory(object : TypeDefinitionFactory { + override fun create(existing: MutableList>) = listOf( + InterfaceTypeExtensionDefinition.newInterfaceTypeExtensionDefinition().name("Node").definitions(listOf(field("fromExtension"))).build(), + InterfaceTypeDefinition.newInterfaceTypeDefinition().name("Other").definitions(listOf(field("fromDefinition"))).build() + ) + }).build()) + }.makeExecutableSchema() + } + + assertEquals(error.message, "Type 'Filter' used by field 'Other.fromDefinition' is an input object type, which can't be used as an output type. " + + "Output types are object types, interfaces, unions, enums and scalars.") + } + @Test fun `input object fields list those of the type before those of its extensions`() { val schema = parser( @@ -567,7 +797,13 @@ class TypeExtensionTest { val (schema, warnings) = withWarnings { parser( """ - type Query { node: Node } + type Query { + node: Node + fooBar: FooBar + color: Color + search(filter: Filter): String + today: Date + } interface Node { id: ID! } extend type Node { name: String } @@ -576,8 +812,23 @@ class TypeExtensionTest { extend union Item = Foo type Foo { foo: String } + + union FooBar = Baz + extend enum FooBar { RED } + + enum Color { RED GREEN } + extend input Color { id: ID } + + input Filter { id: ID } + extend scalar Filter @specifiedBy(url: "https://example.com/filter") + + scalar Date + extend interface Date { id: ID } + + type Baz { baz: String } """) { - dictionary(Item::class) + dictionary(Item::class, Baz::class) + scalars(date) }.makeExecutableSchema() } schema.assertEveryFieldResolves() @@ -585,6 +836,10 @@ class TypeExtensionTest { assertEquals(warnings, listOf( "Type 'Node' is defined as an interface, but extended as an object type. The extension is ignored.", "Type 'Item' is defined as an object type, but extended as a union. The extension is ignored.", + "Type 'FooBar' is defined as a union, but extended as an enum. The extension is ignored.", + "Type 'Color' is defined as an enum, but extended as an input object type. The extension is ignored.", + "Type 'Filter' is defined as an input object type, but extended as a scalar. The extension is ignored.", + "Type 'Date' is defined as a scalar, but extended as an interface. The extension is ignored.", "Schema type was defined but can never be accessed, and can be safely deleted: Foo" )) @@ -592,7 +847,34 @@ class TypeExtensionTest { val item = schema.getType("Item") as GraphQLObjectType assertEquals(node.fieldDefinitions.map { it.name }, listOf("id")) assertEquals(item.interfaces.map { it.name }, listOf("Node")) - assertEquals(node.extensionDefinitions.size + item.extensionDefinitions.size, 0) + assertEquals((schema.getType("FooBar") as GraphQLUnionType).types.map { it.name }, listOf("Baz")) + assertEquals((schema.getType("Color") as GraphQLEnumType).values.map { it.name }, listOf("RED", "GREEN")) + assertEquals((schema.getType("Filter") as GraphQLInputObjectType).fieldDefinitions.map { it.name }, listOf("id")) + assertEquals((schema.getType("Date") as GraphQLScalarType).specifiedByUrl, null) + assertEquals(listOf("Node", "Item", "FooBar", "Color", "Filter", "Date").map { schema.definitionClasses(it).size }, listOf(1, 1, 1, 1, 1, 1)) + } + + @Test + fun `a Map argument of an input object with an ignored scalar extension still gets the coerced values unconverted`() { + fun describe(extension: String): Map { + val schema = SchemaParser.newParser() + .schemaString( + """ + type Query { describe(filter: Filter!): String } + input Filter { color: Color } + enum Color { RED GREEN } + $extension + """) + .resolvers(MapQuery()) + .dictionary(Color::class) + .build() + .makeExecutableSchema() + + return assertNoGraphQlErrors(GraphQL.newGraphQL(schema).build()) { "query { describe(filter: { color: GREEN }) }" } + } + + assertEquals(describe(""), mapOf("describe" to "color: String")) + assertEquals(describe("extend scalar Filter @specifiedBy(url: \"https://example.com/filter\")"), mapOf("describe" to "color: Color")) } @Test @@ -642,8 +924,32 @@ class TypeExtensionTest { assertEquals(schema.getSchemaAppliedDirectives("link").map { it.getArgument("for")?.getValue() }, listOf("EXECUTION")) } + @Test + fun `enums used by directives and by fields of interface extensions need a class`() { + val error = assertThrows(SchemaError::class.java) { + parser( + """ + directive @link(for: Purpose) repeatable on SCHEMA + extend schema @link(for: SECURITY) + + type Query { today: String } + + interface Node { id: ID! } + extend interface Node { purpose: Purpose } + + enum Purpose { SECURITY } + """) { + options(SchemaParserOptions.newOptions().includeUnusedTypes(true).build()) + }.makeExecutableSchema() + } + + assertEquals(error.message, "Expected enum with name 'Purpose' but found none!") + } + private class Repeat(val schema: String, val message: String, vararg val dictionary: KClass<*>) + private val date = GraphQLScalarType.newScalar().name("Date").coercing(Scalars.GraphQLString.coercing).build() + private val fooBarBaz = """ type Foo { foo: String } type Bar { bar: String } @@ -657,8 +963,9 @@ class TypeExtensionTest { fun fooBar(): FooBar = Baz("baz") fun color(): Color = Color.GREEN fun node(): Node = Item("1", "item") - fun search(filter: Filter?): String? = null + fun search(filter: Filter?): String? = generateSequence(filter) { it.and }.joinToString(" and ") { "${it.id} limit ${it.limit}" } fun today(): String = "2026-10-12" + fun shade(): Shade = Shade() } interface FooBar @@ -673,12 +980,18 @@ class TypeExtensionTest { class Item(val id: String, val name: String?, val fooBar: Foo? = null) : Node - class Filter(val id: String?, val limit: Int? = null, val offset: Int? = null, val inner: Inner? = null) + class Filter(val id: String?, val limit: Int? = null, val offset: Int? = null, val inner: Inner? = null, val and: Filter? = null) class Inner(val id: String?) enum class Color { RED, GREEN } + class Shade + + class MapQuery : GraphQLQueryResolver { + fun describe(filter: Map): String = filter.entries.joinToString { "${it.key}: ${it.value?.javaClass?.simpleName}" } + } + private class RecordingWiring : SchemaDirectiveWiring { val wired = mutableListOf() @@ -702,3 +1015,17 @@ class TypeExtensionTest { } private fun GraphQLAppliedDirective.describe() = "@$name(${getArgument("name")?.getValue()})" + +private fun GraphQLSchema.definitionClasses(name: String): List { + val type = getType(name) as GraphQLNamedType + val extensions = when (type) { + is GraphQLObjectType -> type.extensionDefinitions + is GraphQLInterfaceType -> type.extensionDefinitions + is GraphQLUnionType -> type.extensionDefinitions + is GraphQLEnumType -> type.extensionDefinitions + is GraphQLInputObjectType -> type.extensionDefinitions + is GraphQLScalarType -> type.extensionDefinitions + else -> error("$name has no extensions") + } + return (listOf(type.definition) + extensions).map { it?.javaClass?.simpleName } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/TypeKindRecipeTest.kt b/src/test/kotlin/graphql/kickstart/tools/TypeKindRecipeTest.kt new file mode 100644 index 00000000..270e7014 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/TypeKindRecipeTest.kt @@ -0,0 +1,138 @@ +package graphql.kickstart.tools + +import graphql.Scalars +import graphql.language.Node +import graphql.schema.* +import org.junit.Assert.assertThrows +import org.junit.Assert.assertTrue +import org.junit.Test +import kotlin.reflect.KClass + +class TypeKindRecipeTest { + + private val kinds: Map>, Kind> = mapOf( + MergedType.Object::class to Kind("Item", "ObjectTypeDefinition", Repeat("extend type Item { id: ID! }", "field", "id")), + MergedType.Interface::class to Kind("Node", "InterfaceTypeDefinition", Repeat("extend interface Node { id: ID! }", "field", "id")), + MergedType.Union::class to Kind("Result", "UnionTypeDefinition", Repeat("extend union Result = Item", "member", "Item")), + MergedType.Enum::class to Kind("Color", "EnumTypeDefinition", Repeat("extend enum Color { RED }", "value", "RED")), + MergedType.Input::class to Kind("Filter", "InputObjectTypeDefinition", Repeat("extend input Filter { id: ID }", "field", "id")), + MergedType.Scalar::class to Kind("Date", "ScalarTypeDefinition", repeat = null), + ) + + @Test + fun `every kind of type has a case`() { + fun leaves(kind: KClass>): List>> = + if (kind.isSealed) kind.sealedSubclasses.flatMap(::leaves) else listOf(kind) + + val missing = leaves(MergedType::class).filter { it !in kinds }.map { it.qualifiedName!!.removePrefix("graphql.kickstart.tools.") } + assertTrue( + "${missing.joinToString()} has no case. Add a Kind for it to kinds, and add to sdl a definition with a description and @a and an extension with @b", + missing.isEmpty(), + ) + } + + @Test + fun `every kind of type gets the description, definitions and directives of its definition and extension`() { + val schema = parser(sdl).makeExecutableSchema().assertEveryFieldResolves() + + val built = kinds.values.map { kind -> + val type = schema.getType(kind.name) as GraphQLDirectiveContainer + listOf(type.description, type.definition?.javaClass?.simpleName, (type as GraphQLNamedType).extensionDefinitions().size, type.appliedDirectives.map { it.name }) + } + assertEquals(built, kinds.values.map { kind -> + listOf("${kind.name} description", kind.definitionClass, 1, listOf("a", "b")) + }) + } + + @Test + fun `every kind of type with members rejects a member that its extension repeats`() { + val repeating = kinds.values.filter { it.repeat != null } + val errors = repeating.map { kind -> + assertThrows(SchemaError::class.java) { parser(sdl + kind.repeat!!.extension).makeExecutableSchema() }.message + } + + val appendedExtensionLine = sdl.lines().size + assertEquals(errors, repeating.map { kind -> + val repeat = kind.repeat!! + val column = repeat.extension.indexOf(repeat.member, repeat.extension.indexOf(kind.name) + kind.name.length) + 1 + "Type '${kind.name}' declares ${repeat.noun} '${repeat.member}' more than once at line $appendedExtensionLine, column $column." + }) + } + + private class Kind(val name: String, val definitionClass: String, val repeat: Repeat?) + + private class Repeat(val extension: String, val noun: String, val member: String) + + private val sdl = """ + |directive @a on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR + |directive @b on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR + | + |type Query { node: Node result: Result color: Color search(filter: Filter): String today: Date } + | + |"Item description" + |type Item implements Node @a { id: ID! } + |extend type Item @b { name: String } + |type Other { id: ID! } + | + |"Node description" + |interface Node @a { id: ID! } + |extend interface Node @b { name: String } + | + |"Result description" + |union Result @a = Item + |extend union Result @b = Other + | + |"Color description" + |enum Color @a { RED } + |extend enum Color @b { GREEN } + | + |"Filter description" + |input Filter @a { id: ID } + |extend input Filter @b { limit: Int } + | + |"Date description" + |scalar Date @a + |extend scalar Date @b + |""".trimMargin() + + private val date = GraphQLScalarType.newScalar().name("Date").description("provided").coercing(Scalars.GraphQLString.coercing).build() + + private fun parser(schema: String) = SchemaParser.newParser() + .schemaString(schema) + .resolvers(Query()) + .dictionary(Item::class, Other::class) + .scalars(date) + .build() + + private fun GraphQLNamedType.extensionDefinitions(): List> = when (this) { + is GraphQLObjectType -> extensionDefinitions + is GraphQLInterfaceType -> extensionDefinitions + is GraphQLUnionType -> extensionDefinitions + is GraphQLEnumType -> extensionDefinitions + is GraphQLInputObjectType -> extensionDefinitions + is GraphQLScalarType -> extensionDefinitions + else -> error("not a named type with extensions: $name") + } + + class Query : GraphQLQueryResolver { + fun node(): Entity = Item("1", "item") + fun result(): Outcome = Other("2") + fun color() = Color.GREEN + fun search(filter: Filter) = "${filter.id} ${filter.limit}" + fun today() = "2026-11-04" + } + + interface Entity { + val id: String + } + + interface Outcome + + class Item(override val id: String, val name: String?) : Entity, Outcome + + class Other(val id: String) : Outcome + + enum class Color { RED, GREEN } + + class Filter(val id: String?, val limit: Int?) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/WrappedFetchingObjectTest.kt b/src/test/kotlin/graphql/kickstart/tools/WrappedFetchingObjectTest.kt new file mode 100644 index 00000000..1fc37cbb --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/WrappedFetchingObjectTest.kt @@ -0,0 +1,66 @@ +package graphql.kickstart.tools + +import graphql.GraphQL +import graphql.execution.instrumentation.Instrumentation +import graphql.execution.instrumentation.InstrumentationState +import graphql.execution.instrumentation.parameters.InstrumentationFieldFetchParameters +import graphql.schema.DataFetcher +import graphql.schema.DataFetchingEnvironment +import org.junit.Test + +class WrappedFetchingObjectTest { + + @Test + fun `an instrumentation in another package reaches the object behind a method's data fetcher by reflection`() { + val holder = Holder() + val query = Query(holder) + val holderResolver = HolderResolver() + val wrapped = mutableMapOf() + val instrumentation = object : Instrumentation { + override fun instrumentDataFetcher(dataFetcher: DataFetcher<*>, parameters: InstrumentationFieldFetchParameters, state: InstrumentationState?): DataFetcher<*> = + DataFetcher { environment -> + val fetchingObject = dataFetcher.javaClass.getMethod("getWrappedFetchingObject", DataFetchingEnvironment::class.java).invoke(dataFetcher, environment) + wrapped[environment.field.name] = "${dataFetcher.javaClass.name} -> ${identify(fetchingObject, query, holderResolver, holder)}" + dataFetcher.get(environment) + } + } + val schema = SchemaParser.newParser() + .schemaString("type Query { holder: Holder } type Holder { method: String withArgument(x: String): String resolved: String }") + .resolvers(query, holderResolver) + .build() + .makeExecutableSchema() + + val result = GraphQL.newGraphQL(schema).instrumentation(instrumentation).build().execute("{ holder { method withArgument(x: \"a\") resolved } }") + + assertEquals(result.errors, listOf()) + assertEquals( + wrapped, + mapOf( + "holder" to "graphql.kickstart.tools.resolver.LightMethodFieldResolverDataFetcher -> query resolver", + "method" to "graphql.kickstart.tools.resolver.LightMethodFieldResolverDataFetcher -> source object", + "withArgument" to "graphql.kickstart.tools.resolver.MethodFieldResolverDataFetcher -> source object", + "resolved" to "graphql.kickstart.tools.resolver.MethodFieldResolverDataFetcher -> holder resolver" + ) + ) + } + + private fun identify(fetchingObject: Any, query: Query, holderResolver: HolderResolver, holder: Holder) = when { + fetchingObject === query -> "query resolver" + fetchingObject === holderResolver -> "holder resolver" + fetchingObject === holder -> "source object" + else -> "unexpected $fetchingObject" + } + + class Query(private val holder: Holder) : GraphQLQueryResolver { + fun holder() = holder + } + + class Holder { + fun method() = "method" + fun withArgument(x: String) = "argument $x" + } + + class HolderResolver : GraphQLResolver { + fun resolved(holder: Holder) = "resolved ${holder.method()}" + } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/CompatTest.kt b/src/test/kotlin/graphql/kickstart/tools/compat/CompatTest.kt new file mode 100644 index 00000000..6da48d4e --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/CompatTest.kt @@ -0,0 +1,218 @@ +package graphql.kickstart.tools.compat + +import ch.qos.logback.classic.Level +import ch.qos.logback.classic.Logger +import ch.qos.logback.classic.spi.ILoggingEvent +import ch.qos.logback.core.read.ListAppender +import graphql.kickstart.tools.compat.scenarios.SCENARIOS +import graphql.kickstart.tools.compat.scenarios.Scenario +import org.junit.Assert.fail +import org.junit.Test +import org.slf4j.LoggerFactory +import java.io.File + +class CompatTest { + @Test + fun `cases that built on the last release still build`() { + readLogbackAndExportScenariosToKotlinReflect() + if (SCENARIOS.isEmpty()) return fail("No scenarios in ${Scenario::class.java.packageName}, so nothing is checked.") + val variants = SCENARIOS.flatMap(::variants) + val outcomes = runAll(variants) + val pom = PomVersion.read() + val version = pom.version + if (System.getProperty("compat.capture") != null) { + if (!pom.isRelease) return fail( + "pom.xml is at ${pom.text}, so a capture would record this branch instead of a release. Captures are taken from " + + "the release tag, as AGENTS.md describes under Releases. To capture a release again with the scenarios you have, " + + "run `git checkout vX.Y.Z -- pom.xml src/main` first and `git checkout HEAD -- pom.xml src/main` after." + ) + val dir = File(CAPTURES, version.toString()).apply { mkdirs() } + write(File(dir, "cases.tsv"), outcomes) + File(dir, "accepted.txt").takeUnless { it.exists() }?.writeText("") + return + } + + val captures = CAPTURES.listFiles().orEmpty().mapNotNull { file -> parseVersion(file.name)?.let { it to file } } + val unreleased = captures.filterNot { pom.couldBeReleased(it.first) } + if (unreleased.isNotEmpty()) return fail( + "${unreleased.joinToString { it.second.path }} can't hold a release, because pom.xml is at ${pom.text}. A capture made " + + "on a branch records the branch, so it hides any break. Delete it. Captures are taken from the release tag, as " + + "AGENTS.md describes under Releases." + ) + val (release, dir) = captures.maxByOrNull { it.first } + ?: return fail("No capture in $CAPTURES. Capture the last release as AGENTS.md describes under Releases.") + val released = read(File(dir, "cases.tsv")) + if (released.isEmpty()) return fail("$dir/cases.tsv is empty, so nothing is checked. Capture $release as AGENTS.md describes under Releases.") + val acceptedFile = File(dir, "accepted.txt") + val major = version.major > release.major + val warnMustNameOneOfEach = variants.associate { it.key to it.warnMustNameOneOfEach } + + fun builtWithItsSeedOnRelease(key: CaseKey) = released[key.seed]?.built == true && released.getValue(key).built + fun repeatsSeedBreak(key: CaseKey) = key != key.seed && outcomes[key.seed]?.error == outcomes.getValue(key).error + fun warnedOnRelease(key: CaseKey): Boolean { + val ownWarnings = released.getValue(key).warnings - if (key == key.seed) emptySet() else released.getValue(key.seed).warnings.toSet() + val names = warnMustNameOneOfEach.getValue(key) + if (names.isEmpty()) return quotedNamesOrWholeMessage(outcomes.getValue(key).error!!).all { name -> ownWarnings.any { it.names(name) } } + return ownWarnings.any { warning -> names.all { alternatives -> alternatives.any(warning::names) } } + } + val protected = released.keys.filter(::builtWithItsSeedOnRelease) + val accepted = readAccepted(acceptedFile, protected) + fun isAccepted(key: CaseKey) = accepted.any { it.matches(key) } + + val missing = protected.filterNot(outcomes::containsKey) + val broken = protected.filter { outcomes[it]?.built == false }.filterNot(::repeatsSeedBreak) + val stale = accepted.filter { entry -> (missing + broken).none(entry::matches) } + val broke = broken.filterNot(::isAccepted).filterNot { major && warnedOnRelease(it) } + val gone = missing.filterNot(::isAccepted) + if (broke.isEmpty() && gone.isEmpty() && stale.isEmpty()) return + + val target = "${release.major + 1}.0.0" + val accept = "add a line to $acceptedFile with the case as listed here, a tab, and why, naming its issue (#N) or the release " + + "notes (\"X.Y.Z release notes\"). Start the case with $PATTERN to give a regex instead." + val deliberate = "For a deliberate break that the release notes list, $accept" + val brokeReport = when { + broke.isEmpty() -> null + major -> """ + |${broke.size} cases built on $release with no WARN that names them and throw now ${byOperator(broke)}. + |A major may reject only input that the last minor warned about. Log a WARN that names the type and the item in a + |${release.major}.x release first. $deliberate + |${list(broke) { outcomes.getValue(it).error!! }} + """.trimMargin() + else -> """ + |${broke.size} cases built on $release and throw now ${byOperator(broke)}. + |Invalid input that built on the last release keeps building until the next major (AGENTS.md, Compatibility). + |Instead of throwing, log a WARN that names the type and the item, open a GitHub issue with $target in its title, + |and leave `// TODO in $target (#N)`. $deliberate + |${list(broke) { outcomes.getValue(it).error!! }} + """.trimMargin() + } + val goneReport = if (gone.isEmpty()) null else """ + |${gone.size} cases built on $release and aren't generated any more ${byOperator(gone)}, so nothing checks them. + |A scenario was renamed, removed, or its SDL changed. If that was deliberate, capture $release again with the scenarios + |you have: `git checkout v$release -- pom.xml src/main`, `mvn -B -ntp clean test -Dtest=CompatTest -Dcompat.capture`, + |then `git checkout HEAD -- pom.xml src/main`. Otherwise $accept + |${list(gone)} + """.trimMargin() + val staleReport = if (stale.isEmpty()) null else + "Lines in $acceptedFile that match no case that throws or is gone. Delete each one whose case builds again:\n" + + stale.joinToString("\n") { " line ${it.line}: ${it.case}" } + fail(listOfNotNull(brokeReport, goneReport, staleReport).joinToString("\n\n")) + } +} + +class Outcome(val error: String?, val warnings: List) { + val built get() = error == null +} + +private class Accepted(val line: Int, val case: String) { + private val pattern = if (case.startsWith(PATTERN)) Regex(case.removePrefix(PATTERN)) else null + + fun matches(key: CaseKey) = pattern?.matches(key.toString()) ?: (case == key.toString()) +} + +private val CAPTURES = File("src/test/resources/compat") +private const val SHOWN = 50 +private const val PATTERN = "re:" + +// Fits one operator on one directive or type in one scenario. 14.3.0 applying directives on type extensions, the widest +// deliberate break so far, needs at most 15 per line that way. +private const val MAX_PER_PATTERN = 20 +private val REFERENCE = Regex("#\\d+|\\d+\\.\\d+\\.\\d+ release notes") + +private fun readAccepted(file: File, protected: List): List { + val problems = mutableListOf() + val accepted = file.readLines().withIndex().filter { it.value.isNotBlank() }.mapNotNull { (index, text) -> + val case = text.substringBefore('\t') + val reason = text.substringAfter('\t', "") + val problem = when { + !REFERENCE.containsMatchIn(reason) -> "needs a tab and a reason that names an issue (#N) or the release notes (\"X.Y.Z release notes\")" + case.startsWith(PATTERN) && runCatching { Regex(case.removePrefix(PATTERN)) }.isFailure -> "starts with $PATTERN but isn't a valid regex" + case.startsWith(PATTERN) -> Accepted(index + 1, case).let { entry -> + val matched = protected.filter(entry::matches) + val scenarios = matched.map { it.scenario }.distinct() + if (scenarios.size <= 1 && matched.size <= MAX_PER_PATTERN) null + else "accepts ${matched.size} cases in ${scenarios.size} scenarios, and a $PATTERN line may accept at most " + + "$MAX_PER_PATTERN, all in one scenario. List the cases, one per line, or one $PATTERN line per scenario" + } + else -> null + } + problem?.let { problems += " line ${index + 1} $it: $text" } + if (problem == null) Accepted(index + 1, case) else null + } + if (problems.isNotEmpty()) fail("$file has lines the check can't use:\n${problems.joinToString("\n")}") + return accepted +} + +private fun byOperator(keys: List) = keys.groupingBy { it.operator }.eachCount().toSortedMap() + +private fun list(keys: List, detail: (CaseKey) -> String? = { null }) = + keys.take(SHOWN).joinToString("\n") { key -> " $key" + detail(key)?.let { "\n $it" }.orEmpty() } + + if (keys.size > SHOWN) "\n and ${keys.size - SHOWN} more" else "" + +private fun quotedNamesOrWholeMessage(error: String): List = + Regex("(?): Map { + val logger = LoggerFactory.getLogger("graphql.kickstart.tools") as Logger + val appender = ListAppender().apply { start() } + logger.addAppender(appender) + logger.isAdditive = false + try { + return variants.associate { variant -> + appender.list.clear() + val error = try { + variant.build() + null + } catch (e: Throwable) { + "${e.javaClass.simpleName}: ${normalize(e.message.orEmpty())}" + } + val warnings = appender.list.filter { it.level.isGreaterOrEqual(Level.WARN) }.map { normalize(it.formattedMessage) }.sorted() + variant.key to Outcome(error, warnings) + } + } finally { + logger.isAdditive = true + logger.detachAppender(appender) + } +} + +private fun normalize(message: String) = message + .replace(Regex("\\s+"), " ") + .trim() + .replace(Regex("jdk\\.proxy\\d+\\.\\\$Proxy\\d+"), "jdk.proxyN.\\\$ProxyN") + .replace(Regex("\\\$\\\$SpringCGLIB\\\$\\\$\\d+"), "\\\$\\\$SpringCGLIB\\\$\\\$N") + .replace(Regex("@[0-9a-f]{5,}"), "@HASH") + +private fun write(file: File, outcomes: Map) = file.writeText( + outcomes.entries.joinToString("") { (key, outcome) -> + (listOf(key.scenario, key.operator, key.snippet, outcome.error ?: "BUILT") + outcome.warnings).joinToString("\t") + "\n" + } +) + +private fun read(file: File): Map = file.readLines().filter { it.isNotEmpty() }.associate { line -> + val cells = line.split('\t') + CaseKey(cells[0], cells[1], cells[2]) to Outcome(cells[3].takeUnless { it == "BUILT" }, cells.drop(4)) +} + +private class PomVersion(val text: String) { + val version = parseVersion(text.substringBefore('-'))!! + val isRelease = '-' !in text + + fun couldBeReleased(capture: KotlinVersion) = if (isRelease) capture <= version else capture < version + + companion object { + fun read() = PomVersion( + Regex("graphql-java-tools\\s*([^<]+)").find(File("pom.xml").readText())!!.groupValues[1] + ) + } +} + +private fun parseVersion(text: String): KotlinVersion? = + Regex("(\\d+)\\.(\\d+)\\.(\\d+)").matchEntire(text)?.destructured?.let { (major, minor, patch) -> KotlinVersion(major.toInt(), minor.toInt(), patch.toInt()) } diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/Variants.kt b/src/test/kotlin/graphql/kickstart/tools/compat/Variants.kt new file mode 100644 index 00000000..ed0a7998 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/Variants.kt @@ -0,0 +1,126 @@ +package graphql.kickstart.tools.compat + +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.compat.scenarios.Scenario +import graphql.kickstart.tools.compat.scenarios.parser +import graphql.language.AstPrinter +import graphql.language.DirectiveDefinition +import graphql.language.EnumTypeDefinition +import graphql.language.InputObjectTypeDefinition +import graphql.language.InterfaceTypeDefinition +import graphql.language.ListType +import graphql.language.NonNullType +import graphql.language.ObjectTypeDefinition +import graphql.language.ScalarTypeDefinition +import graphql.language.Type +import graphql.language.TypeDefinition +import graphql.language.TypeName +import graphql.language.UnionTypeDefinition +import graphql.parser.Parser +import org.springframework.aop.framework.ProxyFactory + +data class CaseKey(val scenario: String, val operator: String, val snippet: String) { + val seed get() = CaseKey(scenario, "seed", "") + + override fun toString() = listOf(scenario, operator, snippet).filter { it.isNotEmpty() }.joinToString(" | ") +} + +class Variant(val key: CaseKey, val warnMustNameOneOfEach: List>, val build: () -> Unit) + +fun variants(scenario: Scenario): List { + fun variant( + operator: String, + snippet: String = "", + warnMustNameOneOfEach: List> = emptyList(), + resolvers: () -> List> = { scenario.resolvers } + ) = Variant(CaseKey(scenario.name, operator, snippet), warnMustNameOneOfEach) { + val builder = scenario.parser(resolvers()) + if (snippet.isNotEmpty()) builder.schemaString(snippet) + scenario.schema(builder.build()) + } + + return listOf(variant("seed"), variant("proxy") { scenario.resolvers.map { ProxyFactory(it).proxy as GraphQLResolver<*> } }) + + snippets(scenario).map { (key, warnMustNameOneOfEach) -> variant(key.first, key.second, warnMustNameOneOfEach) } +} + +private val KINDS: Map, String> = mapOf( + ObjectTypeDefinition::class.java to "type", + InterfaceTypeDefinition::class.java to "interface", + InputObjectTypeDefinition::class.java to "input", + EnumTypeDefinition::class.java to "enum", + UnionTypeDefinition::class.java to "union", + ScalarTypeDefinition::class.java to "scalar" +) + +private val LOCATIONS = mapOf("type" to "OBJECT", "interface" to "INTERFACE", "input" to "INPUT_OBJECT", "enum" to "ENUM", "union" to "UNION", "scalar" to "SCALAR") + +private val SPECIFIED_BY = Parser().parseDocument("directive @specifiedBy(url: String!) on SCALAR").definitions.single() as DirectiveDefinition + +private fun snippets(scenario: Scenario): Map, List>> { + val sdl = scenario.files.joinToString("\n") { Scenario::class.java.classLoader.getResource(it)!!.readText() } + val definitions = Parser().parseDocument(sdl).definitions + val types = definitions.filterIsInstance>().filter { it.javaClass in KINDS } + val directives = definitions.filterIsInstance() + SPECIFIED_BY + val objectNames = types.filterIsInstance().map { it.name } - setOf("Query", "Mutation", "Subscription") + val snippets = LinkedHashMap, List>>() + + for (type in types) { + val kind = KINDS.getValue(type.javaClass) + fun add(operator: String, snippet: String, vararg warnMustNameOneOfEach: Set) = + snippets.putIfAbsent(operator to snippet, warnMustNameOneOfEach.toList()) + fun addDirective(operator: String, directive: String, applications: String) { + val snippet = "extend $kind ${type.name} $applications" + val applicationPositions = Regex("@$directive\\b").findAll(snippet).map { "line 1, column ${it.range.first + 1}" } + add(operator, snippet, setOf(directive), setOf(type.name) + applicationPositions) + } + + for (other in KINDS.values - kind) { + when (other) { + "enum" -> "extend enum ${type.name} { COMPAT_Z }" + "union" -> objectNames.firstOrNull { it != type.name }?.let { "extend union ${type.name} = $it" } + "scalar" -> "extend scalar ${type.name} @specifiedBy(url: \"https://example.com\")" + else -> "extend $other ${type.name} { compatZ: String }" + }?.let { add("kind", it, setOf(type.name)) } + } + addDirective("undeclared", "compatUndeclared", "@compatUndeclared") + firstMember(type)?.let { (name, member) -> add("repeat", "extend $kind ${type.name} $member", setOf(type.name), setOf(name)) } + for (directive in directives) { + val name = directive.name + if (LOCATIONS.getValue(kind) !in directive.directiveLocations.map { it.name }) { + addDirective("location", name, "@$name") + continue + } + for (argument in directive.inputValueDefinitions) { + for (literal in wrongLiterals(argument.type)) { + addDirective("argval", name, "@$name(${argument.name}: $literal)") + } + } + if (!directive.isRepeatable && directive.inputValueDefinitions.none { it.type is NonNullType && it.defaultValue == null }) { + addDirective("repeat-directive", name, "@$name @$name") + } + } + } + return snippets +} + +private fun firstMember(type: TypeDefinition<*>): Pair? = when (type) { + is EnumTypeDefinition -> type.enumValueDefinitions.firstOrNull()?.let { it.name to "{ ${it.name} }" } + is UnionTypeDefinition -> type.memberTypes.firstOrNull()?.let { (it as TypeName).name!! to "= ${it.name}" } + is ObjectTypeDefinition -> type.fieldDefinitions.firstOrNull()?.let { it.name to "{ ${AstPrinter.printAst(it).oneLine()} }" } + is InterfaceTypeDefinition -> type.fieldDefinitions.firstOrNull()?.let { it.name to "{ ${AstPrinter.printAst(it).oneLine()} }" } + is InputObjectTypeDefinition -> type.inputValueDefinitions.firstOrNull()?.let { it.name to "{ ${AstPrinter.printAst(it).oneLine()} }" } + else -> null +} + +private fun String.oneLine() = replace(Regex("\\s+"), " ").trim() + +private fun wrongLiterals(type: Type<*>): List { + val inner = if (type is NonNullType) type.type else type + val literals = when (if (inner is ListType) "list" else (inner as TypeName).name) { + "String", "ID" -> listOf("5", "NOPE") + "Int", "Float", "Boolean" -> listOf("\"x\"") + "list" -> listOf("{ a: 1 }") + else -> listOf("5", "\"x\"") + } + return if (type is NonNullType) literals + "null" else literals +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Async.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Async.kt new file mode 100644 index 00000000..dddab4ee --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Async.kt @@ -0,0 +1,45 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.GraphQLSubscriptionResolver +import kotlinx.coroutines.delay +import kotlinx.coroutines.reactive.publish +import org.reactivestreams.Publisher +import java.util.concurrent.CompletableFuture + +object Async : Scenario { + override val name = "async" + + override val files = listOf("compat/scenarios/async/schema.graphqls") + override val resolvers = listOf(AsyncQuery(), ShipmentResolver(), AsyncSubscription()) +} + +data class Shipment(val id: String) + +class AsyncQuery : GraphQLQueryResolver { + fun future(): CompletableFuture = CompletableFuture.supplyAsync { "from a future" } + + suspend fun suspended(): String { + delay(10) + return "from a suspend function" + } + + suspend fun shipments(): List = listOf(Shipment("s1"), Shipment("s2")) +} + +class ShipmentResolver : GraphQLResolver { + suspend fun status(shipment: Shipment): String { + delay(5) + return "${shipment.id}: delivered" + } +} + +class AsyncSubscription : GraphQLSubscriptionResolver { + fun ticks(count: Int): Publisher = publish { + repeat(count) { + delay(10) + send(it + 1) + } + } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Bookstore.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Bookstore.kt new file mode 100644 index 00000000..cbeec0ea --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Bookstore.kt @@ -0,0 +1,70 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.GraphQLContext +import graphql.execution.CoercedVariables +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.language.StringValue +import graphql.language.Value +import graphql.schema.Coercing +import graphql.schema.GraphQLScalarType +import java.time.LocalDate +import java.util.Locale + +object Bookstore : Scenario { + override val name = "bookstore" + + override val files = listOf("compat/scenarios/bookstore/schema.graphqls") + override val resolvers = listOf(BookstoreQuery(), AuthorResolver()) + + override fun configure(builder: SchemaParserBuilder) = builder + .scalars(dateScalar) +} + +object BookstoreMissingResolver : Scenario { + override val name = "bookstore-missing-resolver" + + override val files = listOf("compat/scenarios/bookstore/schema.graphqls", "compat/scenarios/bookstore-missing-resolver/extension.graphqls") + override val resolvers = listOf(BookstoreQuery(), AuthorResolver()) + + override fun configure(builder: SchemaParserBuilder) = builder + .scalars(dateScalar) +} + +data class Author(val id: String, val name: String) + +class Book(val id: String, val title: String, val authorId: String, val published: LocalDate, private val stock: Int) { + fun isInStock() = stock > 0 +} + +private val authors = listOf(Author("a1", "Ursula K. Le Guin"), Author("a2", "Iain M. Banks")) +private val books = listOf( + Book("b1", "The Dispossessed", "a1", LocalDate.of(1974, 5, 1), 3), + Book("b2", "The Left Hand of Darkness", "a1", LocalDate.of(1969, 3, 1), 0), + Book("b3", "Use of Weapons", "a2", LocalDate.of(1990, 9, 1), 1), +) + +class BookstoreQuery : GraphQLQueryResolver { + fun books(): List = books + fun book(id: String): Book? = books.find { it.id == id } +} + +class AuthorResolver : GraphQLResolver { + fun author(book: Book): Author = authors.first { it.id == book.authorId } +} + +val dateScalar: GraphQLScalarType = GraphQLScalarType.newScalar() + .name("Date") + .description("ISO-8601 date") + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, graphQLContext: GraphQLContext, locale: Locale) = + (dataFetcherResult as LocalDate).toString() + + override fun parseValue(input: Any, graphQLContext: GraphQLContext, locale: Locale): LocalDate = + LocalDate.parse(input as String) + + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, graphQLContext: GraphQLContext, locale: Locale): LocalDate = + LocalDate.parse((input as StringValue).value) + }) + .build() diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ContextAndEnvironment.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ContextAndEnvironment.kt new file mode 100644 index 00000000..934921d6 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ContextAndEnvironment.kt @@ -0,0 +1,59 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.ExecutionInput +import graphql.GraphQLContext +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment + +object ContextAndEnvironment : Scenario { + override val name = "context-and-environment" + + override val files = listOf("compat/scenarios/context-and-environment/schema.graphqls") + override val resolvers = listOf(ContextAndEnvironmentQuery(), UserResolver()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = + builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"))) +} + +object ContextAndEnvironmentInvalid : Scenario { + override val name = "context-and-environment-invalid" + + override val files = listOf("compat/scenarios/context-and-environment-invalid/schema.graphqls") + override val resolvers = listOf(ContextAndEnvironmentInvalidQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) +} + +data class AppContext(val user: String, val locale: String) + +class AppUser(val name: String) + +class ContextAndEnvironmentQuery : GraphQLQueryResolver { + fun greeting(name: String, context: AppContext, env: DataFetchingEnvironment) = + "${env.field.name}: hi $name, from ${context.user}" + + fun farewell(name: String, env: DataFetchingEnvironment, context: AppContext) = + "${env.field.name}: bye $name, from ${context.user}" + + fun user(context: AppContext) = AppUser(context.user) + + fun environmentOnly(env: DataFetchingEnvironment) = env.field.name + + fun contextOnly(context: AppContext) = context.locale +} + +class UserResolver : GraphQLResolver { + fun locale(user: AppUser, context: GraphQLContext, env: DataFetchingEnvironment) = + "${env.field.name} of ${user.name}: ${context.get(AppContext::class.java)?.locale}" +} + +class ContextAndEnvironmentInvalidQuery : GraphQLQueryResolver { + fun greeting(name: String, context: AppContext, extra: String) = "hi $name" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ContextMisbound.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ContextMisbound.kt new file mode 100644 index 00000000..e61ce8d7 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ContextMisbound.kt @@ -0,0 +1,35 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.ExecutionInput +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment + +object ContextMisbound : Scenario { + override val name = "context-misbound" + + override val files = listOf("compat/scenarios/context-misbound/schema.graphqls") + override val resolvers = listOf(ContextMisboundQuery(), MisboundUserResolver()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = + builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"))) +} + +class ContextMisboundQuery : GraphQLQueryResolver { + fun users(env: DataFetchingEnvironment) = listOf(AppUser(env.field.name)) + + fun user() = AppUser("ada") + + fun contextArgument(context: AppContext) = context.user + + fun greeting(name: String, env: DataFetchingEnvironment) = "${env.field.name}: hi $name" +} + +class MisboundUserResolver : GraphQLResolver { + fun thumbnail(user: AppUser, env: DataFetchingEnvironment) = "${env.field.name} of ${user.name}" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectiveDrift.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectiveDrift.kt new file mode 100644 index 00000000..a70951e8 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectiveDrift.kt @@ -0,0 +1,57 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.Scalars +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.GraphQLScalarType +import graphql.schema.GraphQLSchema + +object DirectiveDrift : Scenario { + override val name = "directive-drift" + + override val files = listOf("compat/scenarios/directive-drift/schema.graphqls") + override val resolvers = listOf(DirectiveDriftQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .dictionary("Dog", DriftDog::class.java) + .scalars(stringScalar("Date"), stringScalar("Money")) + .options(SchemaParserOptions.newOptions().allowUndeclaredDirectives(true).build()) + + override fun inspect(schema: GraphQLSchema) = dumpDirectives(schema) +} + +object DirectiveDriftUndeclared : Scenario { + override val name = "directive-drift-undeclared" + + override val files = listOf("compat/scenarios/directive-drift-undeclared/schema.graphqls") + override val resolvers = listOf(DirectiveDriftOneField()) +} + +private fun stringScalar(name: String) = GraphQLScalarType.newScalar().name(name).coercing(Scalars.GraphQLString.coercing).build() + +interface DriftAnimal { + val name: String +} + +class DriftDog(override val name: String) : DriftAnimal + +enum class DriftColor { RED, GREEN, BLUE } + +data class DriftMeta(val owner: String?) + +class DirectiveDriftQuery : GraphQLQueryResolver { + fun plain() = "plain" + fun old() = "old" + fun older() = "older" + fun search(filter: DriftMeta?, term: String?) = "${filter?.owner} $term" + fun animal(): DriftAnimal = DriftDog("rex") + fun pet(): Any = DriftDog("rex") + fun color() = DriftColor.RED + fun `when`() = "2026-10-22" + fun price() = "9.99" +} + +class DirectiveDriftOneField : GraphQLQueryResolver { + fun a() = "a" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectiveDump.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectiveDump.kt new file mode 100644 index 00000000..abe336c0 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectiveDump.kt @@ -0,0 +1,64 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.language.AstPrinter +import graphql.language.Node +import graphql.schema.GraphQLAppliedDirective +import graphql.schema.GraphQLArgument +import graphql.schema.GraphQLDirective +import graphql.schema.GraphQLDirectiveContainer +import graphql.schema.GraphQLEnumType +import graphql.schema.GraphQLFieldsContainer +import graphql.schema.GraphQLInputObjectType +import graphql.schema.GraphQLNamedType +import graphql.schema.GraphQLSchema +import graphql.schema.GraphQLTypeUtil +import graphql.schema.InputValueWithState + +fun dumpDirectives(schema: GraphQLSchema): String = buildString { + @Suppress("DEPRECATION") + section("schema", schema.schemaAppliedDirectives, schema.schemaDirectives) + schema.directives.sortedBy { it.name }.forEach { definition -> + definition.arguments.forEach { container("directive @${definition.name}(${it.name})", it) } + } + schema.allTypesAsList.filter { !it.name.startsWith("__") }.sortedBy { it.name }.forEach { type -> + if (type is GraphQLDirectiveContainer) container("type ${type.name}", type) + when (type) { + is GraphQLFieldsContainer -> type.fieldDefinitions.forEach { field -> + container("field ${type.name}.${field.name}", field) + field.arguments.forEach { container("argument ${type.name}.${field.name}(${it.name})", it) } + } + is GraphQLInputObjectType -> type.fieldDefinitions.forEach { container("input field ${type.name}.${it.name}", it) } + is GraphQLEnumType -> type.values.forEach { container("enum value ${type.name}.${it.name}", it) } + } + } +} + +@Suppress("DEPRECATION") +private fun StringBuilder.container(label: String, element: GraphQLDirectiveContainer) = + section(label, element.appliedDirectives, element.directives) + +private fun StringBuilder.section(label: String, applied: List, legacy: List) { + if (applied.isEmpty() && legacy.isEmpty()) return + appendLine(label) + applied.forEach { directive -> + appendLine(" applied @${directive.name} description=${directive.description} definition=${directive.definition.sourceLocation?.let { "${it.line}:${it.column}" }}") + directive.arguments.forEach { + appendLine(" ${it.name}: ${GraphQLTypeUtil.simplePrint(it.type)} = ${describe(it.argumentValue)} description=${it.description}") + } + } + legacy.forEach { directive -> + appendLine(" legacy @${directive.name} description=${directive.description} repeatable=${directive.isRepeatable} locations=${directive.validLocations()}") + directive.arguments.forEach { appendLine(" ${legacyArgument(it)}") } + } +} + +@Suppress("DEPRECATION") +private fun legacyArgument(argument: GraphQLArgument) = + "${argument.name}: ${GraphQLTypeUtil.simplePrint(argument.type)} = ${describe(argument.argumentValue)} description=${argument.description}" + +private fun describe(value: InputValueWithState): String = when { + value.isNotSet -> "" + value.isLiteral -> "literal ${AstPrinter.printAst(value.value as Node<*>)}" + value.isExternal -> "external ${value.value}" + else -> "internal ${value.value}" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Directives.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Directives.kt new file mode 100644 index 00000000..0d8aa9a8 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Directives.kt @@ -0,0 +1,42 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.relay.Connection +import graphql.relay.SimpleListConnection +import graphql.schema.DataFetcherFactories +import graphql.schema.DataFetchingEnvironment +import graphql.schema.GraphQLFieldDefinition +import graphql.schema.idl.SchemaDirectiveWiring +import graphql.schema.idl.SchemaDirectiveWiringEnvironment + +object Directives : Scenario { + override val name = "directives" + + override val files = listOf("compat/scenarios/directives/schema.graphqls") + override val resolvers = listOf(DirectivesQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .directive("uppercase", UppercaseDirective()) +} + +data class Member(val id: String, val name: String) + +private val members = listOf(Member("m1", "ada"), Member("m2", "grace"), Member("m3", "barbara")) + +class DirectivesQuery : GraphQLQueryResolver { + fun motto() = "keep it simple" + + fun oldMotto() = "move fast" + + fun members(first: Int?, after: String?, env: DataFetchingEnvironment): Connection = + SimpleListConnection(members).get(env) +} + +class UppercaseDirective : SchemaDirectiveWiring { + override fun onField(environment: SchemaDirectiveWiringEnvironment): GraphQLFieldDefinition { + val original = environment.fieldDataFetcher + environment.fieldDataFetcher = DataFetcherFactories.wrapDataFetcher(original) { _, value -> (value as? String)?.uppercase() } + return environment.element + } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectivesInvalid.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectivesInvalid.kt new file mode 100644 index 00000000..572c42f9 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/DirectivesInvalid.kt @@ -0,0 +1,22 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder + +object DirectivesInvalid : Scenario { + override val name = "directives-invalid" + + override val files = listOf("compat/scenarios/directives-invalid/schema.graphqls") + override val resolvers = listOf(DirectivesInvalidQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .directive("uppercase", UppercaseDirective()) +} + +class DirectivesInvalidQuery : GraphQLQueryResolver { + fun motto() = "keep it simple" + + fun secret() = "42" + + fun members() = listOf(Member("m1", "ada")) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/GenericInputResolver.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/GenericInputResolver.kt new file mode 100644 index 00000000..06540a9f --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/GenericInputResolver.kt @@ -0,0 +1,20 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver + +object GenericInputResolver : Scenario { + override val name = "generic-input-resolver" + + override val files = listOf("compat/scenarios/generic-input-resolver/schema.graphqls") + override val resolvers = listOf(GreetingQuery()) +} + +data class GreetingInput(val name: String) + +abstract class InputResolver : GraphQLQueryResolver { + fun generic(input: I): String = "generic got $input" +} + +class GreetingQuery : InputResolver() { + fun plain(input: GreetingInput): String = "plain got $input" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Inputs.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Inputs.kt new file mode 100644 index 00000000..6e3af064 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Inputs.kt @@ -0,0 +1,42 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLMutationResolver +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment +import java.util.Optional + +object Inputs : Scenario { + override val name = "inputs" + + override val files = listOf("compat/scenarios/inputs/schema.graphqls") + override val resolvers = listOf(InputsQuery(), InputsMutation()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options(SchemaParserOptions.newOptions().inputArgumentOptionalDetectOmission(true).build()) +} + +enum class Genre { FICTION, SCIENCE, HISTORY } + +data class BookInput(val title: String, val genre: Genre, val tags: List?, val details: DetailsInput?) + +data class DetailsInput(val pages: Int, val language: String) + +data class SavedBook(val title: String, val genre: Genre, val tags: List, val pages: Int?, val language: String?) + +class InputsQuery : GraphQLQueryResolver { + fun search(term: String, limit: Int, genres: List?, env: DataFetchingEnvironment): String = + "term=$term limit=$limit genres=$genres field=${env.field.name}" + + fun nickname(value: Optional?): String = when { + value == null -> "omitted" + value.isEmpty -> "explicit null" + else -> "value ${value.get()}" + } +} + +class InputsMutation : GraphQLMutationResolver { + fun addBook(input: BookInput): SavedBook = + SavedBook(input.title, input.genre, input.tags ?: emptyList(), input.details?.pages, input.details?.language) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/JdkProxy.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/JdkProxy.kt new file mode 100644 index 00000000..a1fa0da6 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/JdkProxy.kt @@ -0,0 +1,40 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import org.springframework.aop.framework.ProxyFactory +import org.springframework.aop.support.AopUtils + +object JdkProxy : Scenario { + override val name = "jdk-proxy" + + override val files = listOf("compat/scenarios/jdk-proxy/schema.graphqls") + override val resolvers get() = listOf(proxy(proxyTargetClass = false).also { check(AopUtils.isJdkDynamicProxy(it)) }) +} + +object JdkProxyCglib : Scenario { + override val name = "jdk-proxy-cglib" + override val operations = "jdk-proxy" + + override val files = JdkProxy.files + override val resolvers get() = listOf(proxy(proxyTargetClass = true).also { check(AopUtils.isCglibProxy(it)) }) +} + +object JdkProxyPlain : Scenario { + override val name = "jdk-proxy-plain" + override val operations = "jdk-proxy" + + override val files = JdkProxy.files + override val resolvers = listOf(ProxiedQuery()) +} + +open class ProxiedQuery : GraphQLQueryResolver { + open fun test() = "ok" + + @JvmField + val count = 1 + + open val total = 2 +} + +private fun proxy(proxyTargetClass: Boolean) = + ProxyFactory(ProxiedQuery()).apply { isProxyTargetClass = proxyTargetClass }.proxy as GraphQLQueryResolver diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedUnions.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedUnions.kt new file mode 100644 index 00000000..14805c87 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedUnions.kt @@ -0,0 +1,22 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder + +object NestedUnions : Scenario { + override val name = "nested-unions" + + override val files = listOf("compat/scenarios/nested-unions/schema.graphqls") + override val resolvers = listOf(NestedUnionsQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .dictionary(NestedUnionsQuery.Book::class.java, NestedUnionsQuery.Movie::class.java) +} + +class NestedUnionsQuery : GraphQLQueryResolver { + fun results(): List = listOf(Book("Solaris"), Movie("Stalker")) + + data class Book(val title: String) + + data class Movie(val title: String) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedWrappers.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedWrappers.kt new file mode 100644 index 00000000..eda6f9fd --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedWrappers.kt @@ -0,0 +1,107 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.GraphQL +import graphql.execution.DefaultValueUnboxer +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.ExecutionInput +import graphql.schema.DataFetchingEnvironment +import org.dataloader.BatchLoader +import org.dataloader.DataLoaderFactory +import org.dataloader.DataLoaderRegistry +import java.util.concurrent.CompletableFuture +import java.util.concurrent.CompletableFuture.completedFuture + +object NestedWrappers : Scenario { + override val name = "nested-wrappers" + + override val files = listOf("compat/scenarios/nested-wrappers/schema.graphqls") + override val resolvers = listOf(NestedWrappersQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options(SchemaParserOptions.newOptions().genericWrappers(tryWrapper).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = builder.dataLoaderRegistry( + DataLoaderRegistry().apply { + register("items", DataLoaderFactory.newDataLoader(BatchLoader { keys -> completedFuture(keys.map { NestedItem(it) }) })) + } + ) + + private val tryWrapper = SchemaParserOptions.GenericWrapper.withTransformer(Try::class, 0, { t -> t.get() }) +} + +object NestedWrappersUnboxer : Scenario by NestedWrappers { + override val name = "nested-wrappers-unboxer" + + override fun graphQL(builder: GraphQL.Builder): GraphQL.Builder = builder.valueUnboxer { value -> + val unwrapped = when (value) { + is Try<*> -> value.get() + is CompletableFuture<*> -> value.join() + else -> value + } + unwrapped?.let { DefaultValueUnboxer.unboxValue(it) } + } +} + +sealed class Try { + abstract fun get(): T + + data class Success(val value: T) : Try() { + override fun get() = value + } + + data class Failure(val cause: Throwable) : Try() { + override fun get(): Nothing = throw cause + } +} + +data class Payload(val data: String) + +data class NestedItem(val id: String) + +class NestedWrappersQuery : GraphQLQueryResolver { + fun payload(): Try = Try.Success(Payload("single")) + + fun payloads(): List> = listOf(Try.Success(Payload("a")), Try.Success(Payload("b"))) + + fun payloadStrings(): List> = listOf(Try.Success("a"), Try.Success("b")) + + fun items(): List> = listOf(completedFuture(NestedItem("1")), CompletableFuture.supplyAsync { NestedItem("2") }) + + fun itemNames(): List> = listOf(completedFuture("one"), CompletableFuture.supplyAsync { "two" }) + + fun futureOfFuture(): CompletableFuture> = CompletableFuture.supplyAsync { completedFuture(NestedItem("inner")) } + + fun futureOfTries(): CompletableFuture>> = completedFuture(payloads()) + + fun triesOfFutures(): List>> = items().map { Try.Success(it) } + + fun loadedItems(env: DataFetchingEnvironment): List> = + listOf("x", "y").map { env.getDataLoader("items")!!.load(it) } + + fun failedTryInList(): List> = listOf(Try.Success(Payload("ok")), Try.Failure(IllegalStateException("payload failed"))) + + fun failedFutureInList(): List> = + listOf(completedFuture(NestedItem("ok")), CompletableFuture.failedFuture(IllegalStateException("item failed"))) + + fun plainItems(): List = listOf(NestedItem("p1"), NestedItem("p2")) + + fun futureOfItems(): CompletableFuture> = completedFuture(plainItems()) +} + +object NestedWrappersSuspend : Scenario { + override val name = "nested-wrappers-suspend" + + override val files = listOf("compat/scenarios/nested-wrappers-suspend/schema.graphqls") + override val resolvers = listOf(NestedWrappersSuspendQuery()) +} + +class NestedWrappersSuspendQuery : GraphQLQueryResolver { + suspend fun nullableItems(): List> = listOf(completedFuture(NestedItem("1")), CompletableFuture.supplyAsync { NestedItem("2") }) + + suspend fun nonNullItems(): List> = nullableItems() + + @Suppress("UNCHECKED_CAST") + suspend fun typeVariableStrings(): List = listOf("a", "b") as List +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedWrappersExact.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedWrappersExact.kt new file mode 100644 index 00000000..c326a28d --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/NestedWrappersExact.kt @@ -0,0 +1,81 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.GraphQLContext +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.Coercing +import graphql.schema.CoercingSerializeException +import graphql.schema.GraphQLScalarType +import org.apache.commons.lang3.reflect.TypeUtils +import java.time.OffsetDateTime +import java.util.Locale +import java.util.concurrent.CompletableFuture +import java.util.concurrent.CompletableFuture.completedFuture +import java.util.concurrent.Future +import java.util.concurrent.FutureTask + +object NestedWrappersExact : Scenario { + override val name = "nested-wrappers-exact" + + override val files = listOf("compat/scenarios/nested-wrappers-exact/schema.graphqls") + override val resolvers = listOf(NestedWrappersExactQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .scalars(dateTime) + .options(SchemaParserOptions.newOptions().genericWrappers(tryWrapper, batchWrapper, boxWrapper, specialBoxWrapper, laterWrapper).build()) + + private val tryWrapper = SchemaParserOptions.GenericWrapper.withTransformer(Try::class, 0, { t -> t.get() }) + + private val batchWrapper = SchemaParserOptions.GenericWrapper.withTransformer(NestedWrappersExactBatch::class, 0, { batch -> batch.items }) { item -> + TypeUtils.parameterize(List::class.java, TypeUtils.parameterize(CompletableFuture::class.java, item)) + } + + private val boxWrapper = SchemaParserOptions.GenericWrapper.withTransformer(NestedWrappersExactBox::class, 0, { box -> box.content }) + + private val specialBoxWrapper = SchemaParserOptions.GenericWrapper.withTransformer( + NestedWrappersExactSpecialBox::class, 0, { _ -> throw IllegalStateException("unwrapped by the value's class") } + ) + + private val laterWrapper = SchemaParserOptions.GenericWrapper.withTransformer( + NestedWrappersExactLater::class, 0, { later -> FutureTask { later.value }.apply { run() } } + ) + + private val dateTime = GraphQLScalarType.newScalar() + .name("DateTime") + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, graphQLContext: GraphQLContext, locale: Locale): String = + (dataFetcherResult as? OffsetDateTime)?.toString() + ?: throw CoercingSerializeException("Expected an OffsetDateTime but got a ${dataFetcherResult.javaClass.name}") + }) + .build() +} + +class NestedWrappersExactBatch(val items: List>) + +open class NestedWrappersExactBox(val content: T) + +class NestedWrappersExactSpecialBox(content: T) : NestedWrappersExactBox(content) + +class NestedWrappersExactLater(val value: T) + +class NestedWrappersExactQuery : GraphQLQueryResolver { + private val first = OffsetDateTime.parse("2026-10-23T12:00Z") + private val second = OffsetDateTime.parse("2026-10-24T12:00Z") + + fun dates(): List> = listOf(completedFuture(first), CompletableFuture.supplyAsync { second }) + + fun triedDates(): List> = listOf(Try.Success(first), Try.Success(second)) + + fun plainFutureItems(): List> = listOf(FutureTask { NestedItem("f1") }.apply { run() }) + + fun batchedItems(): NestedWrappersExactBatch = + NestedWrappersExactBatch(listOf(completedFuture(NestedItem("b1")), CompletableFuture.supplyAsync { NestedItem("b2") })) + + fun boxedItems(): List> = + listOf(NestedWrappersExactBox(NestedItem("x1")), NestedWrappersExactSpecialBox(NestedItem("x2"))) + + fun laterItems(): List> = listOf(NestedWrappersExactLater(NestedItem("l1"))) + + suspend fun suspendPlainFutureItems(): List> = plainFutureItems() +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/OptionalResults.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/OptionalResults.kt new file mode 100644 index 00000000..4892da21 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/OptionalResults.kt @@ -0,0 +1,62 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.GraphQLError +import graphql.execution.DataFetcherResult +import graphql.kickstart.tools.GraphQLQueryResolver +import java.util.Optional + +object OptionalResults : Scenario { + override val name = "optional-results" + + override val files = listOf("compat/scenarios/optional-results/schema.graphqls") + override val resolvers = listOf(OptionalResultsQuery()) +} + +object OptionalResultsMixed : Scenario { + override val name = "optional-results-mixed" + + override val files = listOf("compat/scenarios/optional-results-mixed/schema.graphqls") + override val resolvers = listOf(OptionalResultsMixedQuery()) +} + +object OptionalResultsList : Scenario { + override val name = "optional-results-list" + + override val files = listOf("compat/scenarios/optional-results-list/schema.graphqls") + override val resolvers = listOf(OptionalResultsListQuery()) +} + +object OptionalResultsNested : Scenario { + override val name = "optional-results-nested" + + override val files = listOf("compat/scenarios/optional-results-nested/schema.graphqls") + override val resolvers = listOf(OptionalResultsNestedQuery()) +} + +class OptionalResultsPayload(val data: String) + +private fun optionalResult(data: T, vararg errors: String): Optional> = Optional.of( + DataFetcherResult.newResult().data(data).errors(errors.map { GraphQLError.newError().message(it).build() }).build() +) + +class OptionalResultsQuery : GraphQLQueryResolver { + fun optionalResult(): Optional> = optionalResult(OptionalResultsPayload("a"), "partial") + fun optionalResultName(): Optional> = optionalResult("a") + fun emptyOptionalResult(): Optional> = Optional.empty() +} + +class OptionalResultsMixedQuery : GraphQLQueryResolver { + fun optionalResult(): Optional> = optionalResult(OptionalResultsPayload("a"), "partial") + fun resultOfOptional(): DataFetcherResult> = + DataFetcherResult.newResult>().data(Optional.of(OptionalResultsPayload("a"))).build() +} + +class OptionalResultsListQuery : GraphQLQueryResolver { + fun optionalResultList(): Optional>> = + optionalResult(listOf(OptionalResultsPayload("a"), OptionalResultsPayload("b"))) +} + +class OptionalResultsNestedQuery : GraphQLQueryResolver { + fun optionalResultOfResult(): Optional>> = + optionalResult(DataFetcherResult.newResult().data(OptionalResultsPayload("a")).build()) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Options.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Options.kt new file mode 100644 index 00000000..bedc0773 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Options.kt @@ -0,0 +1,27 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.resolver.MissingResolverDataFetcherProvider +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetcher + +object Options : Scenario { + override val name = "options" + + override val files = listOf("compat/scenarios/options/schema.graphqls") + override val resolvers = listOf(OptionsQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options( + SchemaParserOptions.newOptions() + .missingResolverDataFetcherProvider(MissingResolverDataFetcherProvider { field, _ -> + DataFetcher { "no resolver for ${field.name}" } + }) + .build() + ) +} + +class OptionsQuery : GraphQLQueryResolver { + fun name() = "tools" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Polymorphism.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Polymorphism.kt new file mode 100644 index 00000000..e1cb43b4 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Polymorphism.kt @@ -0,0 +1,34 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder + +object Polymorphism : Scenario { + override val name = "polymorphism" + + override val files = listOf("compat/scenarios/polymorphism/schema.graphqls") + override val resolvers = listOf(PolymorphismQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .dictionary(Novel::class.java) + .dictionary("Writer", WriterEntity::class.java) +} + +interface Entity { + val id: String +} + +data class Novel(override val id: String, val title: String) : Entity + +data class WriterEntity(override val id: String, val name: String) : Entity + +private val entities: List = listOf(Novel("n1", "Solaris"), WriterEntity("w1", "Stanisław Lem")) + +class PolymorphismQuery : GraphQLQueryResolver { + fun node(id: String): Entity? = entities.find { it.id == id } + + fun search(term: String): List = entities.filter { + val text = if (it is Novel) it.title else (it as WriterEntity).name + text.contains(term, ignoreCase = true) + } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ReadOnlySchema.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ReadOnlySchema.kt new file mode 100644 index 00000000..fccbb6f0 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ReadOnlySchema.kt @@ -0,0 +1,39 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLMutationResolver +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserBuilder + +object ReadOnlySchema : Scenario { + override val name = "read-only-schema" + + override val files = listOf("compat/scenarios/read-only-schema/schema.graphqls") + override val resolvers = listOf(ReadOnlyQuery(), ReadOnlyMutation()) + + override fun configure(builder: SchemaParserBuilder) = builder + .dictionary("Dog", ShelterDog::class.java) + .dictionary("Cat", ShelterCat::class.java) + + override fun schema(parser: SchemaParser) = parser.parseSchemaObjects().toReadOnlySchema() +} + +interface ShelterAnimal { + val name: String +} + +data class ShelterDog(override val name: String, val barks: Boolean) : ShelterAnimal + +data class ShelterCat(override val name: String, val lives: Int) : ShelterAnimal + +private val animals: List = listOf(ShelterDog("Rex", true), ShelterCat("Tom", 9)) + +class ReadOnlyQuery : GraphQLQueryResolver { + fun animal(name: String): ShelterAnimal? = animals.find { it.name == name } + + fun pets(): List = animals +} + +class ReadOnlyMutation : GraphQLMutationResolver { + fun adopt(name: String): ShelterAnimal = ShelterDog(name, false) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/RecursiveInputs.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/RecursiveInputs.kt new file mode 100644 index 00000000..5a7c220e --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/RecursiveInputs.kt @@ -0,0 +1,28 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder + +object RecursiveInputs : Scenario { + override val name = "recursive-inputs" + + override val files = listOf("compat/scenarios/recursive-inputs/schema.graphqls") + override val resolvers = listOf(RecursiveInputsQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .dictionary(RangeInput::class, LimitUnit::class) +} + +data class RangeInput(val min: Int, val max: Int) + +enum class LimitUnit { ITEMS, PAGES } + +data class TreeFilter(val name: String?, val and: List?, val not: TreeFilter?, val child: ChildFilter?) + +data class ChildFilter(val parent: TreeFilter?, val siblings: List>?, val depth: Int) + +class RecursiveInputsQuery : GraphQLQueryResolver { + fun describe(filter: TreeFilter): String = filter.toString() + + fun names(first: Int?): List = listOf("a", "b", "c").take(first ?: 3) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ScalarArgs.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ScalarArgs.kt new file mode 100644 index 00000000..54e8b569 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ScalarArgs.kt @@ -0,0 +1,95 @@ +package graphql.kickstart.tools.compat.scenarios + +import com.fasterxml.jackson.annotation.JsonIdentityInfo +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.ObjectIdGenerators +import graphql.GraphQLContext +import graphql.execution.CoercedVariables +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.language.StringValue +import graphql.language.Value +import graphql.schema.Coercing +import graphql.schema.GraphQLScalarType +import java.util.Locale +import java.util.Optional + +object ScalarArgs : Scenario { + override val name = "scalar-args" + + override val files = listOf("compat/scenarios/scalar-args/schema.graphqls") + override val resolvers = listOf(ScalarArgsQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .scalars(tagScalar, tokenScalar, typedTokenScalar, wrappedTokenScalar, idTokenScalar) +} + +class Tag private constructor(val value: String) { + companion object { + fun of(value: String) = Tag(value) + } +} + +private val tagScalar = GraphQLScalarType.newScalar() + .name("Tag") + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale) = (dataFetcherResult as Tag).value + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale) = Tag.of(input as String) + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale) = + Tag.of((input as StringValue).value.orEmpty()) + }) + .build() + +class ScalarArgsToken(private val value: String = "default") { + override fun toString() = value +} + +data class ScalarArgsTokenInput(val token: ScalarArgsToken? = null) + +@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY) +class ScalarArgsTypedToken(private val value: String = "default") { + override fun toString() = value +} + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) +class ScalarArgsWrappedToken(private val value: String = "default") { + override fun toString() = value +} + +@JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator::class) +class ScalarArgsIdToken(private val value: String = "default") { + override fun toString() = value +} + +data class ScalarArgsMarkedTokensInput( + val typed: ScalarArgsTypedToken? = null, + val wrapped: ScalarArgsWrappedToken? = null, + val ids: List? = null +) + +private val tokenScalar = stringScalar("Token") { ScalarArgsToken(it) } +private val typedTokenScalar = stringScalar("TypedToken") { ScalarArgsTypedToken(it) } +private val wrappedTokenScalar = stringScalar("WrappedToken") { ScalarArgsWrappedToken(it) } +private val idTokenScalar = stringScalar("IdToken") { ScalarArgsIdToken(it) } + +private fun stringScalar(name: String, parse: (String) -> T) = GraphQLScalarType.newScalar() + .name(name) + .coercing(object : Coercing { + override fun serialize(dataFetcherResult: Any, context: GraphQLContext, locale: Locale) = dataFetcherResult.toString() + override fun parseValue(input: Any, context: GraphQLContext, locale: Locale) = parse(input as String) + override fun parseLiteral(input: Value<*>, variables: CoercedVariables, context: GraphQLContext, locale: Locale) = + parse((input as StringValue).value.orEmpty()) + }) + .build() + +class ScalarArgsQuery : GraphQLQueryResolver { + fun tag(tag: Tag) = "tag ${tag.value}" + fun tags(tags: List) = "tags ${tags.map { it.value }}" + fun id(id: Long) = "id ${id + 1} (${id.javaClass.name})" + fun nestedSets(tags: List>) = "sets ${tags.map { it.sorted() }} sizes ${tags.map { it.size }}" + fun nestedLists(tags: List>) = "lists $tags" + fun tokenInput(input: ScalarArgsTokenInput) = "token ${input.token}" + fun markedTokens(input: ScalarArgsMarkedTokensInput) = "tokens ${input.typed} ${input.wrapped} ${input.ids}" + fun optionalTypedToken(token: Optional) = "typed ${token.orElse(null)}" + fun optionalIdToken(token: Optional) = "id ${token.orElse(null)}" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ScalarDirectives.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ScalarDirectives.kt new file mode 100644 index 00000000..a6a30f38 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/ScalarDirectives.kt @@ -0,0 +1,42 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.Scalars +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.schema.GraphQLScalarType +import graphql.schema.idl.SchemaDirectiveWiring +import graphql.schema.idl.SchemaDirectiveWiringEnvironment + +object ScalarDirectives : Scenario { + override val name = "scalar-directives" + + override val files = listOf("compat/scenarios/scalar-directives/schema.graphqls") + override val resolvers = listOf(ScalarDirectivesQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .scalars( + string("Date"), + GraphQLScalarType.newScalar(string("DateTime")).description("An RFC-3339 date-time") + .specifiedByUrl("https://scalars.graphql.org/andimarek/date-time").build(), + string("Money") + ) + .directive("since", ArgumentWiring("date")) + .directive("unit", ArgumentWiring("name")) + + private fun string(name: String) = GraphQLScalarType.newScalar().name(name).coercing(Scalars.GraphQLString.coercing).build() +} + +class ArgumentWiring(private val argument: String) : SchemaDirectiveWiring { + override fun onScalar(environment: SchemaDirectiveWiringEnvironment): GraphQLScalarType { + val directive = environment.appliedDirective + val value = directive.getArgument(argument)?.getValue() + return environment.element.transform { it.description("${environment.element.description}, wired with @${directive.name}($value)") } + } +} + +class ScalarDirectivesQuery : GraphQLQueryResolver { + fun today(): String = "2026-10-19" + fun now(): String = "2026-10-19T12:00:00Z" + fun shift(from: String?): String? = from + fun price(): String = "9.99" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Scenario.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Scenario.kt new file mode 100644 index 00000000..fda85626 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Scenario.kt @@ -0,0 +1,33 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.ExecutionInput +import graphql.GraphQL +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParser +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.schema.GraphQLSchema + +sealed interface Scenario { + val name: String + + val operations: String get() = name + + val files: List + + val resolvers: List> + + fun configure(builder: SchemaParserBuilder): SchemaParserBuilder = builder + + fun schema(parser: SchemaParser): GraphQLSchema = parser.makeExecutableSchema() + + fun inspect(schema: GraphQLSchema): String? = null + + fun graphQL(builder: GraphQL.Builder): GraphQL.Builder = builder + + fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = builder +} + +fun Scenario.parser(resolvers: List> = this.resolvers): SchemaParserBuilder = + configure(SchemaParser.newParser().files(*files.toTypedArray()).resolvers(resolvers)) + +val SCENARIOS: List = Scenario::class.sealedSubclasses.mapNotNull { it.objectInstance }.sortedBy { it.name } diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Sourceless.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Sourceless.kt new file mode 100644 index 00000000..a0f19132 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/Sourceless.kt @@ -0,0 +1,94 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.ExecutionInput +import graphql.GraphQLContext +import graphql.execution.DataFetcherResult +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.GraphQLResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.kickstart.tools.SchemaParserOptions +import graphql.schema.DataFetchingEnvironment + +object Sourceless : Scenario { + override val name = "sourceless" + + override val files = listOf("compat/scenarios/sourceless/schema.graphqls") + override val resolvers = listOf(SourcelessQuery(), SourcelessFolderResolver(), SourcelessImageResolver()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options(SchemaParserOptions.newOptions().contextClass(AppContext::class).build()) + + override fun input(builder: ExecutionInput.Builder): ExecutionInput.Builder = + builder.graphQLContext(mapOf(AppContext::class.java to AppContext("oryan", "en-CA"), "owner" to "ada")) +} + +object SourcelessShadowed : Scenario { + override val name = "sourceless-shadowed" + + override val files = listOf("compat/scenarios/sourceless-shadowed/schema.graphqls") + override val resolvers = listOf(SourcelessQuery(), SourcelessFolderResolver(), ShadowedImageResolver()) +} + +object SourcelessUnimplemented : Scenario { + override val name = "sourceless-unimplemented" + + override val files = listOf("compat/scenarios/sourceless-unimplemented/schema.graphqls") + override val resolvers = listOf(SourcelessQuery(), SourcelessFolderResolver(), HelperImageResolver()) + + override fun configure(builder: SchemaParserBuilder) = builder + .options(SchemaParserOptions.newOptions().allowUnimplementedResolvers(true).build()) +} + +object SourcelessMisbound : Scenario { + override val name = "sourceless-misbound" + + override val files = listOf("compat/scenarios/sourceless-misbound/schema.graphqls") + override val resolvers = listOf(SourcelessQuery(), SourcelessFolderResolver(), MisboundImageResolver()) +} + +class SourcelessFolder(val supportedFileTypes: List) + +class SourcelessImage(val name: String) + +class SourcelessQuery : GraphQLQueryResolver { + fun folder() = SourcelessFolder(listOf("png", "jpg")) +} + +class SourcelessFolderResolver : GraphQLResolver { + fun images(folder: SourcelessFolder): DataFetcherResult> = DataFetcherResult.newResult>() + .data(listOf(SourcelessImage("cat"), SourcelessImage("dog"))) + .localContext(folder.supportedFileTypes) + .build() +} + +class SourcelessImageResolver : GraphQLResolver { + fun imageBlob(env: DataFetchingEnvironment) = "blob for ${env.getLocalContext>()}" + + fun thumbnail(size: Int, env: DataFetchingEnvironment) = "${env.getLocalContext>()?.first()}@$size" + + fun owner(context: GraphQLContext): String? = context.get("owner") + + fun locale(context: AppContext) = context.locale + + fun signature(context: AppContext, env: DataFetchingEnvironment) = "${env.field.name} by ${context.user}" + + suspend fun caption(env: DataFetchingEnvironment) = "caption of ${env.getSource()?.name}" +} + +class ShadowedImageResolver : GraphQLResolver { + fun getName(env: DataFetchingEnvironment) = "sourceless ${env.field.name}" + + fun title(image: SourcelessImage) = "with source ${image.name}" + + fun title(env: DataFetchingEnvironment) = "sourceless ${env.field.name}" +} + +class HelperImageResolver : GraphQLResolver { + fun imageBlob(image: SourcelessImage) = "blob of ${image.name}" + + fun preview(env: DataFetchingEnvironment) = "helper ${env.field.name}" +} + +class MisboundImageResolver : GraphQLResolver { + fun thumbnail(context: GraphQLContext, env: DataFetchingEnvironment) = "thumbnail ${env.field.name}" +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensions.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensions.kt new file mode 100644 index 00000000..06a7b74c --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensions.kt @@ -0,0 +1,42 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder + +object TypeExtensions : Scenario { + override val name = "type-extensions" + + override val files = listOf("compat/scenarios/type-extensions/schema.graphqls") + override val resolvers = listOf(TypeExtensionsQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .dictionary(Article::class.java, Video::class.java) +} + +interface Node { + val id: String +} + +data class Article(override val id: String, val createdAt: String?, val name: String?, val title: String) : Node + +data class Video(override val id: String, val createdAt: String?, val name: String?, val seconds: Int) : Node + +enum class Color { RED, BLUE, GREEN } + +enum class Shade { LIGHT, DARK } + +data class Filter(val term: String?, val limit: Int?) + +private val nodes: List = listOf(Article("a1", "2026-10-01", "Launch", "We launched"), Video("v1", "2026-10-02", "Demo", 90)) + +class TypeExtensionsQuery : GraphQLQueryResolver { + fun node(id: String): Node? = nodes.find { it.id == id } + + fun search(): List = nodes + + fun colors(): List = Color.entries + + fun shades(): List = Shade.entries + + fun count(filter: Filter): Int = nodes.count { (it as? Article)?.title?.contains(filter.term.orEmpty()) ?: true }.coerceAtMost(filter.limit ?: Int.MAX_VALUE) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsInputOrder.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsInputOrder.kt new file mode 100644 index 00000000..1892dfdb --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsInputOrder.kt @@ -0,0 +1,20 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.schema.GraphQLInputObjectType +import graphql.schema.GraphQLSchema + +object TypeExtensionsInputOrder : Scenario { + override val name = "type-extensions-input-order" + + override val files = listOf("compat/scenarios/type-extensions-input-order/schema.graphqls") + override val resolvers = listOf(TypeExtensionsInputOrderQuery()) + + override fun inspect(schema: GraphQLSchema) = "Filter fields: ${(schema.getType("Filter") as GraphQLInputObjectType).fieldDefinitions.map { it.name }}" +} + +data class TypeExtensionsInputOrderFilter(val term: String?, val limit: Int?, val offset: Int?) + +class TypeExtensionsInputOrderQuery : GraphQLQueryResolver { + fun count(filter: TypeExtensionsInputOrderFilter?): Int = listOfNotNull(filter?.term, filter?.limit, filter?.offset).size +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsRepeatedFields.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsRepeatedFields.kt new file mode 100644 index 00000000..a33df7f4 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsRepeatedFields.kt @@ -0,0 +1,49 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.schema.GraphQLInputObjectType +import graphql.schema.GraphQLObjectType +import graphql.schema.GraphQLSchema + +object TypeExtensionsRepeatedFields : Scenario { + override val name = "type-extensions-repeated-fields" + + override val files = listOf("compat/scenarios/type-extensions-repeated-fields/schema.graphqls") + override val resolvers = listOf(TypeExtensionsRepeatedFieldsQuery()) + + override fun inspect(schema: GraphQLSchema): String { + val objects = listOf("TypeAndExtension", "TwoExtensions", "OneDefinition").map { + "$it.name: ${(schema.getType(it) as GraphQLObjectType).getFieldDefinition("name").description}" + } + val inputs = listOf("InputTypeAndExtension", "InputTwoExtensions", "InputOneDefinition").map { + "$it.id: ${(schema.getType(it) as GraphQLInputObjectType).getField("id").description}" + } + return (objects + inputs).joinToString("\n") + } +} + +data class TypeExtensionsRepeatedFieldsTypeAndExtension(val name: String?) + +data class TypeExtensionsRepeatedFieldsTwoExtensions(val id: String?, val name: String?) + +data class TypeExtensionsRepeatedFieldsOneDefinition(val name: String?) + +data class TypeExtensionsRepeatedFieldsInputTypeAndExtension(val id: String?) + +data class TypeExtensionsRepeatedFieldsInputTwoExtensions(val term: String?, val id: String?) + +data class TypeExtensionsRepeatedFieldsInputOneDefinition(val id: String?) + +class TypeExtensionsRepeatedFieldsQuery : GraphQLQueryResolver { + fun typeAndExtension() = TypeExtensionsRepeatedFieldsTypeAndExtension("a") + + fun twoExtensions() = TypeExtensionsRepeatedFieldsTwoExtensions("b", "c") + + fun oneDefinition() = TypeExtensionsRepeatedFieldsOneDefinition("d") + + fun echo( + typeAndExtension: TypeExtensionsRepeatedFieldsInputTypeAndExtension?, + twoExtensions: TypeExtensionsRepeatedFieldsInputTwoExtensions?, + oneDefinition: TypeExtensionsRepeatedFieldsInputOneDefinition? + ): String = listOf(typeAndExtension?.id, twoExtensions?.term, twoExtensions?.id, oneDefinition?.id).joinToString(",") +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsSealed.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsSealed.kt new file mode 100644 index 00000000..6ebc9b52 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/TypeExtensionsSealed.kt @@ -0,0 +1,30 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver + +object TypeExtensionsSealed : Scenario { + override val name = "type-extensions-sealed" + + override val files = listOf("compat/scenarios/type-extensions-sealed/schema.graphqls") + override val resolvers = listOf(TypeExtensionsSealedQuery()) +} + +sealed class Pet { + data class Dog(val name: String) : Pet() + + data class Cat(val lives: Int) : Pet() +} + +sealed interface Animal { + val name: String +} + +data class Cow(override val name: String) : Animal + +data class Horse(override val name: String) : Animal + +class TypeExtensionsSealedQuery : GraphQLQueryResolver { + fun pets(): List = listOf(Pet.Dog("Rex"), Pet.Cat(9)) + + fun animals(): List = listOf(Cow("Daisy"), Horse("Spirit")) +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/UnmappedInputs.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/UnmappedInputs.kt new file mode 100644 index 00000000..e58236f9 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/UnmappedInputs.kt @@ -0,0 +1,35 @@ +package graphql.kickstart.tools.compat.scenarios + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import graphql.kickstart.tools.GraphQLQueryResolver +import java.util.Optional + +object UnmappedInputs : Scenario { + override val name = "unmapped-inputs" + + override val files = listOf("compat/scenarios/unmapped-inputs/schema.graphqls") + override val resolvers = listOf(UnmappedInputsQuery()) +} + +class IgnoredInput { + @field:JsonIgnoreProperties("legacy") + var inner: Optional? = null +} + +class InnerInput { + var name: String? = null +} + +class TypoInput { + var item: Optional? = null +} + +class ItemInput { + var nmae: String? = null +} + +class UnmappedInputsQuery : GraphQLQueryResolver { + fun ignored(input: IgnoredInput): String? = input.inner?.get()?.name + + fun typo(input: TypoInput): String? = input.item?.get()?.nmae +} diff --git a/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/WiringShapes.kt b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/WiringShapes.kt new file mode 100644 index 00000000..849b15d6 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/compat/scenarios/WiringShapes.kt @@ -0,0 +1,66 @@ +package graphql.kickstart.tools.compat.scenarios + +import graphql.kickstart.tools.GraphQLQueryResolver +import graphql.kickstart.tools.SchemaParserBuilder +import graphql.schema.* +import graphql.schema.idl.SchemaDirectiveWiring +import graphql.schema.idl.SchemaDirectiveWiringEnvironment + +object WiringShapes : Scenario { + override val name = "wiring-shapes" + + override val files = listOf("compat/scenarios/wiring-shapes/schema.graphqls") + override val resolvers = listOf(WiringShapesQuery()) + + override fun configure(builder: SchemaParserBuilder) = builder + .directive("inspect", InspectWiring()) + .directive("required", RequiredWiring()) + .directive("described", DescribedWiring()) +} + +data class WiringTreeFilter(val name: String?, val children: List?) + +enum class State { ALIVE, GONE } + +class WiringPerson(val name: String) { + val friend: WiringPerson get() = this + val state: State get() = State.ALIVE + val someone: Any get() = this +} + +class WiringShapesQuery : GraphQLQueryResolver { + fun trees(filter: WiringTreeFilter?): Int = filter?.let { 1 + (it.children ?: emptyList()).sumOf { child -> trees(child) } } ?: 0 + + fun person() = WiringPerson("ada") + + fun someone(): Any = WiringPerson("grace") +} + +class InspectWiring : SchemaDirectiveWiring { + override fun onInputObjectField(environment: SchemaDirectiveWiringEnvironment): GraphQLInputObjectField { + val type = GraphQLTypeUtil.unwrapAllAs(environment.element.type) + return environment.element.transform { it.description("sees ${type.javaClass.simpleName} ${type.name}") } + } +} + +class RequiredWiring : SchemaDirectiveWiring { + override fun onField(environment: SchemaDirectiveWiringEnvironment): GraphQLFieldDefinition = + environment.element.transform { it.type(GraphQLNonNull.nonNull(environment.element.type)) } +} + +class DescribedWiring : SchemaDirectiveWiring { + override fun onObject(environment: SchemaDirectiveWiringEnvironment): GraphQLObjectType = + environment.element.transform { it.description("described") } + + override fun onInterface(environment: SchemaDirectiveWiringEnvironment): GraphQLInterfaceType = + environment.element.transform { it.description("described") } + + override fun onUnion(environment: SchemaDirectiveWiringEnvironment): GraphQLUnionType = + environment.element.transform { it.description("described") } + + override fun onEnum(environment: SchemaDirectiveWiringEnvironment): GraphQLEnumType = + environment.element.transform { it.description("described") } + + override fun onInputObjectType(environment: SchemaDirectiveWiringEnvironment): GraphQLInputObjectType = + environment.element.transform { it.description("described") } +} diff --git a/src/test/kotlin/graphql/kickstart/tools/returnvalue/ReturnValueUnwrappingTest.kt b/src/test/kotlin/graphql/kickstart/tools/returnvalue/ReturnValueUnwrappingTest.kt new file mode 100644 index 00000000..b2620193 --- /dev/null +++ b/src/test/kotlin/graphql/kickstart/tools/returnvalue/ReturnValueUnwrappingTest.kt @@ -0,0 +1,65 @@ +package graphql.kickstart.tools.returnvalue + +import graphql.kickstart.tools.resolver.ResolverKind +import graphql.kickstart.tools.resolver.TypeShape +import org.junit.Assert.fail +import org.junit.Test +import java.io.ByteArrayOutputStream +import java.io.File +import java.io.PrintStream +import java.net.URLClassLoader +import java.nio.file.Files +import java.nio.file.Path +import java.util.spi.ToolProvider + +class ReturnValueUnwrappingTest { + + @Test + fun `every return type the schema build accepts reaches graphql-java unwrapped`() { + val dir = Files.createTempDirectory("return-value-unwrapping") + try { + val classpath = listOfNotNull(System.getProperty("jdk.module.path"), System.getProperty("java.class.path")) + .joinToString(File.pathSeparator) + compile(classpath, dir, copy("Check.java", dir), copy("Fixtures.java", dir)) + + val args = System.getProperty("unwrapping.args", "").split(" ").filter { it.isNotBlank() } + + listOf( + "--known", copy("known-findings.txt", dir).toString(), + "--container-kinds", TypeShape.containerTypes.joinToString(",") { it.canonicalName }, + "--resolver-kinds", ResolverKind.entries.joinToString(",") { it.noun } + ) + val report = ByteArrayOutputStream() + val passed = URLClassLoader(arrayOf(dir.toUri().toURL()), javaClass.classLoader).use { loader -> + PrintStream(report, true, Charsets.UTF_8).use { out -> + loader.loadClass("unwrapcheck.Check") + .getMethod("check", Array::class.java, String::class.java, PrintStream::class.java) + .invoke(null, args.toTypedArray(), classpath + File.pathSeparator + dir, out) as Boolean + } + } + if (!passed) { + fail(report.toString(Charsets.UTF_8)) + } + print(report.toString(Charsets.UTF_8)) + } finally { + dir.toFile().deleteRecursively() + } + } + + private fun copy(resource: String, dir: Path): Path { + val target = dir.resolve(resource) + javaClass.getResourceAsStream("/returnvalue/$resource")!!.use { Files.copy(it, target) } + return target + } + + // java.util.spi.ToolProvider is in java.base, so this module needs no access to java.compiler + private fun compile(classpath: String, dir: Path, vararg sources: Path) { + val output = ByteArrayOutputStream() + val javac = ToolProvider.findFirst("javac").orElseThrow() + val status = PrintStream(output, true, Charsets.UTF_8).use { out -> + javac.run(out, out, "-d", dir.toString(), "-classpath", classpath, "-nowarn", "-proc:none", *sources.map { it.toString() }.toTypedArray()) + } + if (status != 0) { + fail("MODEL ERROR: the check doesn't compile against this checkout:\n" + output.toString(Charsets.UTF_8)) + } + } +} diff --git a/src/test/resources/compat/15.0.0/accepted.txt b/src/test/resources/compat/15.0.0/accepted.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/test/resources/compat/15.0.0/cases.tsv b/src/test/resources/compat/15.0.0/cases.tsv new file mode 100644 index 00000000..9987adb6 --- /dev/null +++ b/src/test/resources/compat/15.0.0/cases.tsv @@ -0,0 +1,1422 @@ +async seed BUILT +async proxy FieldResolverError: Field 'Query.future' resolves to graphql.kickstart.tools.compat.scenarios.AsyncQuery.future, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.AsyncQuery, so every query of the field will fail. Field 'Query.suspended' resolves to graphql.kickstart.tools.compat.scenarios.AsyncQuery.suspended, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.AsyncQuery, so every query of the field will fail. Field 'Query.shipments' resolves to graphql.kickstart.tools.compat.scenarios.AsyncQuery.shipments, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.AsyncQuery, so every query of the field will fail. Field 'Subscription.ticks' resolves to graphql.kickstart.tools.compat.scenarios.AsyncSubscription.ticks, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.AsyncSubscription, so every query of the field will fail. Field 'Shipment.status' resolves to graphql.kickstart.tools.compat.scenarios.ShipmentResolver.status, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ShipmentResolver, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +async kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +async kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +async kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +async kind extend union Query = Shipment BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +async kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +async undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +async repeat extend type Query { future: String! } SchemaError: Type 'Query' declares field 'future' more than once at line 1, column 21. +async location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +async kind extend interface Shipment { compatZ: String } BUILT Type 'Shipment' is defined as an object type, but extended as an interface. The extension is ignored. +async kind extend input Shipment { compatZ: String } BUILT Type 'Shipment' is defined as an object type, but extended as an input object type. The extension is ignored. +async kind extend enum Shipment { COMPAT_Z } BUILT Type 'Shipment' is defined as an object type, but extended as an enum. The extension is ignored. +async kind extend scalar Shipment @specifiedBy(url: "https://example.com") BUILT Type 'Shipment' is defined as an object type, but extended as a scalar. The extension is ignored. +async undeclared extend type Shipment @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +async repeat extend type Shipment { id: ID! } SchemaError: Type 'Shipment' declares field 'id' more than once at line 1, column 24. +async location extend type Shipment @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 22 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 22 is missing its required argument 'url'. +async kind extend interface Subscription { compatZ: String } BUILT Type 'Subscription' is defined as an object type, but extended as an interface. The extension is ignored. +async kind extend input Subscription { compatZ: String } BUILT Type 'Subscription' is defined as an object type, but extended as an input object type. The extension is ignored. +async kind extend enum Subscription { COMPAT_Z } BUILT Type 'Subscription' is defined as an object type, but extended as an enum. The extension is ignored. +async kind extend union Subscription = Shipment BUILT Type 'Subscription' is defined as an object type, but extended as a union. The extension is ignored. +async kind extend scalar Subscription @specifiedBy(url: "https://example.com") BUILT Type 'Subscription' is defined as an object type, but extended as a scalar. The extension is ignored. +async undeclared extend type Subscription @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +async repeat extend type Subscription { ticks(count: Int!): Int! } SchemaError: Type 'Subscription' declares field 'ticks' more than once at line 1, column 28. +async location extend type Subscription @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 26 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 26 is missing its required argument 'url'. +bookstore seed BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore proxy FieldResolverError: Field 'Query.books' resolves to graphql.kickstart.tools.compat.scenarios.BookstoreQuery.books, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.BookstoreQuery, so every query of the field will fail. Field 'Query.book' resolves to graphql.kickstart.tools.compat.scenarios.BookstoreQuery.book, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.BookstoreQuery, so every query of the field will fail. Field 'Book.author' resolves to graphql.kickstart.tools.compat.scenarios.AuthorResolver.author, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.AuthorResolver, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +bookstore kind extend type Date { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Date' is defined as a scalar, but extended as an object type. The extension is ignored. +bookstore kind extend interface Date { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Date' is defined as a scalar, but extended as an interface. The extension is ignored. +bookstore kind extend input Date { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Date' is defined as a scalar, but extended as an input object type. The extension is ignored. +bookstore kind extend enum Date { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Date' is defined as a scalar, but extended as an enum. The extension is ignored. +bookstore kind extend union Date = Book BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Date' is defined as a scalar, but extended as a union. The extension is ignored. +bookstore undeclared extend scalar Date @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore argval extend scalar Date @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore argval extend scalar Date @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore argval extend scalar Date @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore kind extend interface Query { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore kind extend input Query { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore kind extend enum Query { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore kind extend union Query = Book BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +bookstore kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore repeat extend type Query { books: [Book!]! } SchemaError: Type 'Query' declares field 'books' more than once at line 1, column 21. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore kind extend interface Book { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Book' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore kind extend input Book { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Book' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore kind extend enum Book { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Book' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore kind extend union Book = Author BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Book' is defined as an object type, but extended as a union. The extension is ignored. +bookstore kind extend scalar Book @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Book' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore undeclared extend type Book @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore repeat extend type Book { id: ID! } SchemaError: Type 'Book' declares field 'id' more than once at line 1, column 20. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore location extend type Book @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore kind extend interface Author { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Author' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore kind extend input Author { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Author' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore kind extend enum Author { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Author' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore kind extend union Author = Book BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Author' is defined as an object type, but extended as a union. The extension is ignored. +bookstore kind extend scalar Author @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Author' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore undeclared extend type Author @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore repeat extend type Author { id: ID! } SchemaError: Type 'Author' declares field 'id' more than once at line 1, column 22. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore location extend type Author @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore kind extend interface Review { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Review' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore kind extend input Review { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Review' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore kind extend enum Review { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Review' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore kind extend union Review = Book BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Review' is defined as an object type, but extended as a union. The extension is ignored. +bookstore kind extend scalar Review @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review Type 'Review' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore undeclared extend type Review @compatUndeclared BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore repeat extend type Review { stars: Int! } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore location extend type Review @specifiedBy BUILT Schema type was defined but can never be accessed, and can be safely deleted: Review +bookstore-missing-resolver seed FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver proxy FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver kind extend type Date { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Date' is defined as a scalar, but extended as an object type. The extension is ignored. +bookstore-missing-resolver kind extend interface Date { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Date' is defined as a scalar, but extended as an interface. The extension is ignored. +bookstore-missing-resolver kind extend input Date { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Date' is defined as a scalar, but extended as an input object type. The extension is ignored. +bookstore-missing-resolver kind extend enum Date { COMPAT_Z } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Date' is defined as a scalar, but extended as an enum. The extension is ignored. +bookstore-missing-resolver kind extend union Date = Book FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Date' is defined as a scalar, but extended as a union. The extension is ignored. +bookstore-missing-resolver undeclared extend scalar Date @compatUndeclared FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver argval extend scalar Date @specifiedBy(url: 5) FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver argval extend scalar Date @specifiedBy(url: NOPE) FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver argval extend scalar Date @specifiedBy(url: null) FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver kind extend interface Query { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore-missing-resolver kind extend input Query { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore-missing-resolver kind extend enum Query { COMPAT_Z } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore-missing-resolver kind extend union Query = Book FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +bookstore-missing-resolver kind extend scalar Query @specifiedBy(url: "https://example.com") FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore-missing-resolver undeclared extend type Query @compatUndeclared FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver repeat extend type Query { books: [Book!]! } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver location extend type Query @specifiedBy FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver kind extend interface Book { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Book' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore-missing-resolver kind extend input Book { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Book' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore-missing-resolver kind extend enum Book { COMPAT_Z } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Book' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore-missing-resolver kind extend union Book = Author FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Book' is defined as an object type, but extended as a union. The extension is ignored. +bookstore-missing-resolver kind extend scalar Book @specifiedBy(url: "https://example.com") FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Book' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore-missing-resolver undeclared extend type Book @compatUndeclared FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver repeat extend type Book { id: ID! } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver location extend type Book @specifiedBy FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver kind extend interface Author { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Author' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore-missing-resolver kind extend input Author { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Author' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore-missing-resolver kind extend enum Author { COMPAT_Z } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Author' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore-missing-resolver kind extend union Author = Book FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Author' is defined as an object type, but extended as a union. The extension is ignored. +bookstore-missing-resolver kind extend scalar Author @specifiedBy(url: "https://example.com") FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Author' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore-missing-resolver undeclared extend type Author @compatUndeclared FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver repeat extend type Author { id: ID! } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver location extend type Author @specifiedBy FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver kind extend interface Review { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Review' is defined as an object type, but extended as an interface. The extension is ignored. +bookstore-missing-resolver kind extend input Review { compatZ: String } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Review' is defined as an object type, but extended as an input object type. The extension is ignored. +bookstore-missing-resolver kind extend enum Review { COMPAT_Z } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Review' is defined as an object type, but extended as an enum. The extension is ignored. +bookstore-missing-resolver kind extend union Review = Book FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Review' is defined as an object type, but extended as a union. The extension is ignored. +bookstore-missing-resolver kind extend scalar Review @specifiedBy(url: "https://example.com") FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() Type 'Review' is defined as an object type, but extended as a scalar. The extension is ignored. +bookstore-missing-resolver undeclared extend type Review @compatUndeclared FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver repeat extend type Review { stars: Int! } FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +bookstore-missing-resolver location extend type Review @specifiedBy FieldResolverError: No method or field found as defined in schema compat/scenarios/bookstore-missing-resolver/extension.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn(graphql.kickstart.tools.compat.scenarios.Book) graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn graphql.kickstart.tools.compat.scenarios.Book.isbn() graphql.kickstart.tools.compat.scenarios.Book.getIsbn() graphql.kickstart.tools.compat.scenarios.Book.isbn graphql.kickstart.tools.compat.scenarios.AuthorResolver.isbn() graphql.kickstart.tools.compat.scenarios.AuthorResolver.getIsbn() +context-and-environment seed BUILT +context-and-environment proxy FieldResolverError: Field 'Query.greeting' resolves to graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery.greeting, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery, so every query of the field will fail. Field 'Query.farewell' resolves to graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery.farewell, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery, so every query of the field will fail. Field 'Query.user' resolves to graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery.user, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery, so every query of the field will fail. Field 'Query.environmentOnly' resolves to graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery.environmentOnly, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery, so every query of the field will fail. Field 'Query.contextOnly' resolves to graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery.contextOnly, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentQuery, so every query of the field will fail. Field 'User.locale' resolves to graphql.kickstart.tools.compat.scenarios.UserResolver.locale, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.UserResolver, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +context-and-environment kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +context-and-environment kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +context-and-environment kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +context-and-environment kind extend union Query = User BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +context-and-environment kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +context-and-environment undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +context-and-environment repeat extend type Query { greeting(name: String!): String! } SchemaError: Type 'Query' declares field 'greeting' more than once at line 1, column 21. +context-and-environment location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +context-and-environment kind extend interface User { compatZ: String } BUILT Type 'User' is defined as an object type, but extended as an interface. The extension is ignored. +context-and-environment kind extend input User { compatZ: String } BUILT Type 'User' is defined as an object type, but extended as an input object type. The extension is ignored. +context-and-environment kind extend enum User { COMPAT_Z } BUILT Type 'User' is defined as an object type, but extended as an enum. The extension is ignored. +context-and-environment kind extend scalar User @specifiedBy(url: "https://example.com") BUILT Type 'User' is defined as an object type, but extended as a scalar. The extension is ignored. +context-and-environment undeclared extend type User @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +context-and-environment repeat extend type User { name: String! } SchemaError: Type 'User' declares field 'name' more than once at line 1, column 20. +context-and-environment location extend type User @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +context-and-environment-invalid seed FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) +context-and-environment-invalid proxy FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) +context-and-environment-invalid kind extend interface Query { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +context-and-environment-invalid kind extend input Query { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +context-and-environment-invalid kind extend enum Query { COMPAT_Z } FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +context-and-environment-invalid kind extend scalar Query @specifiedBy(url: "https://example.com") FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +context-and-environment-invalid undeclared extend type Query @compatUndeclared FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) +context-and-environment-invalid repeat extend type Query { greeting(name: String!): String! } FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) +context-and-environment-invalid location extend type Query @specifiedBy FieldResolverError: No method found as defined in schema compat/scenarios/context-and-environment-invalid/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext, class graphql.kickstart.tools.compat.scenarios.AppContext]), in priority order: graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.greeting(~name) graphql.kickstart.tools.compat.scenarios.ContextAndEnvironmentInvalidQuery.getGreeting(~name) +context-misbound seed FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +context-misbound proxy FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +context-misbound kind extend interface Query { compatZ: String } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +context-misbound kind extend input Query { compatZ: String } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +context-misbound kind extend enum Query { COMPAT_Z } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +context-misbound kind extend union Query = User FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +context-misbound kind extend scalar Query @specifiedBy(url: "https://example.com") FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +context-misbound undeclared extend type Query @compatUndeclared FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +context-misbound repeat extend type Query { users(first: Int): [User!]! } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +context-misbound location extend type Query @specifiedBy FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +context-misbound kind extend interface User { compatZ: String } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'User' is defined as an object type, but extended as an interface. The extension is ignored. +context-misbound kind extend input User { compatZ: String } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'User' is defined as an object type, but extended as an input object type. The extension is ignored. +context-misbound kind extend enum User { COMPAT_Z } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'User' is defined as an object type, but extended as an enum. The extension is ignored. +context-misbound kind extend scalar User @specifiedBy(url: "https://example.com") FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. Type 'User' is defined as an object type, but extended as a scalar. The extension is ignored. +context-misbound undeclared extend type User @compatUndeclared FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +context-misbound repeat extend type User { name: String! } FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +context-misbound location extend type User @specifiedBy FieldResolverError: Field 'Query.users' has no parameter for its argument 'first: Int' in graphql.kickstart.tools.compat.scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter. +directive-drift seed BUILT +directive-drift proxy FieldResolverError: Field 'Query.plain' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.plain, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.old' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.old, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.older' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.older, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.search' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.search, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.animal' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.animal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.pet' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.pet, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.color' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.color, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.when' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.when, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. Field 'Query.price' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery.price, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +directive-drift kind extend type Kind { compatZ: String } BUILT Type 'Kind' is defined as an enum, but extended as an object type. The extension is ignored. +directive-drift kind extend interface Kind { compatZ: String } BUILT Type 'Kind' is defined as an enum, but extended as an interface. The extension is ignored. +directive-drift kind extend input Kind { compatZ: String } BUILT Type 'Kind' is defined as an enum, but extended as an input object type. The extension is ignored. +directive-drift kind extend union Kind = Dog BUILT Type 'Kind' is defined as an enum, but extended as a union. The extension is ignored. +directive-drift kind extend scalar Kind @specifiedBy(url: "https://example.com") BUILT Type 'Kind' is defined as an enum, but extended as a scalar. The extension is ignored. +directive-drift undeclared extend enum Kind @compatUndeclared BUILT +directive-drift repeat extend enum Kind { PLAIN } SchemaError: Type 'Kind' declares value 'PLAIN' more than once at line 1, column 20. +directive-drift argval extend enum Kind @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend enum Kind @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend enum Kind @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend enum Kind @tag(level: "x") SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend enum Kind @tag(kind: 5) SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend enum Kind @tag(kind: "x") SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend enum Kind @tag(meta: 5) SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend enum Kind @tag(meta: "x") SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend enum Kind @once(reason: 5) InvalidSchemaException: invalid schema: Invalid argument 'reason' for applied directive of name 'once' +directive-drift argval extend enum Kind @once(reason: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'reason' for applied directive of name 'once' +directive-drift repeat-directive extend enum Kind @once @once SchemaError: Directive @once at line 1, column 24 isn't repeatable but is applied more than once. +directive-drift location extend enum Kind @link SchemaError: Directive @link at line 1, column 18 is applied to ENUM, but it's declared on SCHEMA. Directive @link at line 1, column 18 is missing its required argument 'url'. +directive-drift location extend enum Kind @argDoc SchemaError: Directive @argDoc at line 1, column 18 is applied to ENUM, but it's declared on FIELD_DEFINITION. +directive-drift location extend enum Kind @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 18 is applied to ENUM, but it's declared on FIELD_DEFINITION. +directive-drift location extend enum Kind @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to ENUM, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +directive-drift kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +directive-drift kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +directive-drift kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +directive-drift kind extend union Query = Dog BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +directive-drift kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +directive-drift undeclared extend type Query @compatUndeclared BUILT +directive-drift repeat extend type Query { plain: String @tag(name: "plain", level: 2) @once(reason: "supplied") @fieldOnly @argDoc(note: "x") } SchemaError: Type 'Query' declares field 'plain' more than once at line 1, column 21. +directive-drift argval extend type Query @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend type Query @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend type Query @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend type Query @tag(level: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend type Query @tag(kind: 5) SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend type Query @tag(kind: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend type Query @tag(meta: 5) SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend type Query @tag(meta: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend type Query @once(reason: 5) SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift argval extend type Query @once(reason: NOPE) SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift repeat-directive extend type Query @once @once SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift location extend type Query @link SchemaError: Directive @link at line 1, column 19 is applied to OBJECT, but it's declared on SCHEMA. Directive @link at line 1, column 19 is missing its required argument 'url'. +directive-drift location extend type Query @argDoc SchemaError: Directive @argDoc at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +directive-drift location extend type Query @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +directive-drift location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +directive-drift kind extend type Animal { compatZ: String } BUILT Type 'Animal' is defined as an interface, but extended as an object type. The extension is ignored. +directive-drift kind extend input Animal { compatZ: String } BUILT Type 'Animal' is defined as an interface, but extended as an input object type. The extension is ignored. +directive-drift kind extend enum Animal { COMPAT_Z } BUILT Type 'Animal' is defined as an interface, but extended as an enum. The extension is ignored. +directive-drift kind extend union Animal = Dog BUILT Type 'Animal' is defined as an interface, but extended as a union. The extension is ignored. +directive-drift kind extend scalar Animal @specifiedBy(url: "https://example.com") BUILT Type 'Animal' is defined as an interface, but extended as a scalar. The extension is ignored. +directive-drift undeclared extend interface Animal @compatUndeclared BUILT +directive-drift repeat extend interface Animal { name: String @once } SchemaError: Type 'Animal' declares field 'name' more than once at line 1, column 27. +directive-drift argval extend interface Animal @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend interface Animal @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend interface Animal @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend interface Animal @tag(level: "x") SchemaError: Directive @tag at line 1, column 25 is missing its required argument 'name'. +directive-drift argval extend interface Animal @tag(kind: 5) SchemaError: Directive @tag at line 1, column 25 is missing its required argument 'name'. +directive-drift argval extend interface Animal @tag(kind: "x") SchemaError: Directive @tag at line 1, column 25 is missing its required argument 'name'. +directive-drift argval extend interface Animal @tag(meta: 5) SchemaError: Directive @tag at line 1, column 25 is missing its required argument 'name'. +directive-drift argval extend interface Animal @tag(meta: "x") SchemaError: Directive @tag at line 1, column 25 is missing its required argument 'name'. +directive-drift argval extend interface Animal @once(reason: 5) SchemaError: Directive @once at line 1, column 25 isn't repeatable but is applied more than once. +directive-drift argval extend interface Animal @once(reason: NOPE) SchemaError: Directive @once at line 1, column 25 isn't repeatable but is applied more than once. +directive-drift repeat-directive extend interface Animal @once @once SchemaError: Directive @once at line 1, column 25 isn't repeatable but is applied more than once. +directive-drift location extend interface Animal @link SchemaError: Directive @link at line 1, column 25 is applied to INTERFACE, but it's declared on SCHEMA. Directive @link at line 1, column 25 is missing its required argument 'url'. +directive-drift location extend interface Animal @argDoc SchemaError: Directive @argDoc at line 1, column 25 is applied to INTERFACE, but it's declared on FIELD_DEFINITION. +directive-drift location extend interface Animal @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 25 is applied to INTERFACE, but it's declared on FIELD_DEFINITION. +directive-drift location extend interface Animal @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INTERFACE, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +directive-drift kind extend interface Dog { compatZ: String } BUILT Type 'Dog' is defined as an object type, but extended as an interface. The extension is ignored. +directive-drift kind extend input Dog { compatZ: String } BUILT Type 'Dog' is defined as an object type, but extended as an input object type. The extension is ignored. +directive-drift kind extend enum Dog { COMPAT_Z } BUILT Type 'Dog' is defined as an object type, but extended as an enum. The extension is ignored. +directive-drift kind extend scalar Dog @specifiedBy(url: "https://example.com") BUILT Type 'Dog' is defined as an object type, but extended as a scalar. The extension is ignored. +directive-drift undeclared extend type Dog @compatUndeclared BUILT +directive-drift repeat extend type Dog { name: String } SchemaError: Type 'Dog' declares field 'name' more than once at line 1, column 19. +directive-drift argval extend type Dog @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend type Dog @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend type Dog @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend type Dog @tag(level: "x") SchemaError: Directive @tag at line 1, column 17 is missing its required argument 'name'. +directive-drift argval extend type Dog @tag(kind: 5) SchemaError: Directive @tag at line 1, column 17 is missing its required argument 'name'. +directive-drift argval extend type Dog @tag(kind: "x") SchemaError: Directive @tag at line 1, column 17 is missing its required argument 'name'. +directive-drift argval extend type Dog @tag(meta: 5) SchemaError: Directive @tag at line 1, column 17 is missing its required argument 'name'. +directive-drift argval extend type Dog @tag(meta: "x") SchemaError: Directive @tag at line 1, column 17 is missing its required argument 'name'. +directive-drift argval extend type Dog @once(reason: 5) InvalidSchemaException: invalid schema: Invalid argument 'reason' for applied directive of name 'once' +directive-drift argval extend type Dog @once(reason: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'reason' for applied directive of name 'once' +directive-drift repeat-directive extend type Dog @once @once SchemaError: Directive @once at line 1, column 23 isn't repeatable but is applied more than once. +directive-drift location extend type Dog @link SchemaError: Directive @link at line 1, column 17 is applied to OBJECT, but it's declared on SCHEMA. Directive @link at line 1, column 17 is missing its required argument 'url'. +directive-drift location extend type Dog @argDoc SchemaError: Directive @argDoc at line 1, column 17 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +directive-drift location extend type Dog @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 17 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +directive-drift location extend type Dog @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 17 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 17 is missing its required argument 'url'. +directive-drift kind extend type Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an object type. The extension is ignored. +directive-drift kind extend interface Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an interface. The extension is ignored. +directive-drift kind extend input Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an input object type. The extension is ignored. +directive-drift kind extend enum Pet { COMPAT_Z } BUILT Type 'Pet' is defined as a union, but extended as an enum. The extension is ignored. +directive-drift kind extend scalar Pet @specifiedBy(url: "https://example.com") BUILT Type 'Pet' is defined as a union, but extended as a scalar. The extension is ignored. +directive-drift undeclared extend union Pet @compatUndeclared BUILT +directive-drift repeat extend union Pet = Dog SchemaError: Type 'Pet' declares member 'Dog' more than once at line 1, column 20. +directive-drift argval extend union Pet @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend union Pet @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend union Pet @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend union Pet @tag(level: "x") SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend union Pet @tag(kind: 5) SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend union Pet @tag(kind: "x") SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend union Pet @tag(meta: 5) SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend union Pet @tag(meta: "x") SchemaError: Directive @tag at line 1, column 18 is missing its required argument 'name'. +directive-drift argval extend union Pet @once(reason: 5) SchemaError: Directive @once at line 1, column 18 isn't repeatable but is applied more than once. +directive-drift argval extend union Pet @once(reason: NOPE) SchemaError: Directive @once at line 1, column 18 isn't repeatable but is applied more than once. +directive-drift repeat-directive extend union Pet @once @once SchemaError: Directive @once at line 1, column 18 isn't repeatable but is applied more than once. +directive-drift location extend union Pet @link SchemaError: Directive @link at line 1, column 18 is applied to UNION, but it's declared on SCHEMA. Directive @link at line 1, column 18 is missing its required argument 'url'. +directive-drift location extend union Pet @argDoc SchemaError: Directive @argDoc at line 1, column 18 is applied to UNION, but it's declared on FIELD_DEFINITION. +directive-drift location extend union Pet @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 18 is applied to UNION, but it's declared on FIELD_DEFINITION. +directive-drift location extend union Pet @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +directive-drift kind extend type Color { compatZ: String } BUILT Type 'Color' is defined as an enum, but extended as an object type. The extension is ignored. +directive-drift kind extend interface Color { compatZ: String } BUILT Type 'Color' is defined as an enum, but extended as an interface. The extension is ignored. +directive-drift kind extend input Color { compatZ: String } BUILT Type 'Color' is defined as an enum, but extended as an input object type. The extension is ignored. +directive-drift kind extend union Color = Dog BUILT Type 'Color' is defined as an enum, but extended as a union. The extension is ignored. +directive-drift kind extend scalar Color @specifiedBy(url: "https://example.com") BUILT Type 'Color' is defined as an enum, but extended as a scalar. The extension is ignored. +directive-drift undeclared extend enum Color @compatUndeclared BUILT +directive-drift repeat extend enum Color { RED } SchemaError: Type 'Color' declares value 'RED' more than once at line 1, column 21. +directive-drift argval extend enum Color @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend enum Color @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend enum Color @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend enum Color @tag(level: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend enum Color @tag(kind: 5) SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend enum Color @tag(kind: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend enum Color @tag(meta: 5) SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend enum Color @tag(meta: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend enum Color @once(reason: 5) SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift argval extend enum Color @once(reason: NOPE) SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift repeat-directive extend enum Color @once @once SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift location extend enum Color @link SchemaError: Directive @link at line 1, column 19 is applied to ENUM, but it's declared on SCHEMA. Directive @link at line 1, column 19 is missing its required argument 'url'. +directive-drift location extend enum Color @argDoc SchemaError: Directive @argDoc at line 1, column 19 is applied to ENUM, but it's declared on FIELD_DEFINITION. +directive-drift location extend enum Color @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 19 is applied to ENUM, but it's declared on FIELD_DEFINITION. +directive-drift location extend enum Color @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to ENUM, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +directive-drift kind extend type Meta { compatZ: String } BUILT Type 'Meta' is defined as an input object type, but extended as an object type. The extension is ignored. +directive-drift kind extend interface Meta { compatZ: String } BUILT Type 'Meta' is defined as an input object type, but extended as an interface. The extension is ignored. +directive-drift kind extend enum Meta { COMPAT_Z } BUILT Type 'Meta' is defined as an input object type, but extended as an enum. The extension is ignored. +directive-drift kind extend union Meta = Dog BUILT Type 'Meta' is defined as an input object type, but extended as a union. The extension is ignored. +directive-drift kind extend scalar Meta @specifiedBy(url: "https://example.com") BUILT Type 'Meta' is defined as an input object type, but extended as a scalar. The extension is ignored. +directive-drift undeclared extend input Meta @compatUndeclared BUILT +directive-drift repeat extend input Meta { owner: String @once(reason: "x") } SchemaError: Type 'Meta' declares field 'owner' more than once at line 1, column 21. +directive-drift argval extend input Meta @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend input Meta @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend input Meta @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend input Meta @tag(level: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend input Meta @tag(kind: 5) SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend input Meta @tag(kind: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend input Meta @tag(meta: 5) SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend input Meta @tag(meta: "x") SchemaError: Directive @tag at line 1, column 19 is missing its required argument 'name'. +directive-drift argval extend input Meta @once(reason: 5) SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift argval extend input Meta @once(reason: NOPE) SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift repeat-directive extend input Meta @once @once SchemaError: Directive @once at line 1, column 19 isn't repeatable but is applied more than once. +directive-drift location extend input Meta @link SchemaError: Directive @link at line 1, column 19 is applied to INPUT_OBJECT, but it's declared on SCHEMA. Directive @link at line 1, column 19 is missing its required argument 'url'. +directive-drift location extend input Meta @argDoc SchemaError: Directive @argDoc at line 1, column 19 is applied to INPUT_OBJECT, but it's declared on FIELD_DEFINITION. +directive-drift location extend input Meta @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 19 is applied to INPUT_OBJECT, but it's declared on FIELD_DEFINITION. +directive-drift location extend input Meta @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +directive-drift kind extend type Date { compatZ: String } BUILT Type 'Date' is defined as a scalar, but extended as an object type. The extension is ignored. +directive-drift kind extend interface Date { compatZ: String } BUILT Type 'Date' is defined as a scalar, but extended as an interface. The extension is ignored. +directive-drift kind extend input Date { compatZ: String } BUILT Type 'Date' is defined as a scalar, but extended as an input object type. The extension is ignored. +directive-drift kind extend enum Date { COMPAT_Z } BUILT Type 'Date' is defined as a scalar, but extended as an enum. The extension is ignored. +directive-drift kind extend union Date = Dog BUILT Type 'Date' is defined as a scalar, but extended as a union. The extension is ignored. +directive-drift undeclared extend scalar Date @compatUndeclared BUILT +directive-drift argval extend scalar Date @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend scalar Date @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend scalar Date @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend scalar Date @tag(level: "x") SchemaError: Directive @tag at line 1, column 20 is missing its required argument 'name'. +directive-drift argval extend scalar Date @tag(kind: 5) SchemaError: Directive @tag at line 1, column 20 is missing its required argument 'name'. +directive-drift argval extend scalar Date @tag(kind: "x") SchemaError: Directive @tag at line 1, column 20 is missing its required argument 'name'. +directive-drift argval extend scalar Date @tag(meta: 5) SchemaError: Directive @tag at line 1, column 20 is missing its required argument 'name'. +directive-drift argval extend scalar Date @tag(meta: "x") SchemaError: Directive @tag at line 1, column 20 is missing its required argument 'name'. +directive-drift argval extend scalar Date @once(reason: 5) SchemaError: Directive @once at line 1, column 20 isn't repeatable but is applied more than once. +directive-drift argval extend scalar Date @once(reason: NOPE) SchemaError: Directive @once at line 1, column 20 isn't repeatable but is applied more than once. +directive-drift repeat-directive extend scalar Date @once @once SchemaError: Directive @once at line 1, column 20 isn't repeatable but is applied more than once. +directive-drift location extend scalar Date @link SchemaError: Directive @link at line 1, column 20 is applied to SCALAR, but it's declared on SCHEMA. Directive @link at line 1, column 20 is missing its required argument 'url'. +directive-drift location extend scalar Date @argDoc SchemaError: Directive @argDoc at line 1, column 20 is applied to SCALAR, but it's declared on FIELD_DEFINITION. +directive-drift location extend scalar Date @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 20 is applied to SCALAR, but it's declared on FIELD_DEFINITION. +directive-drift argval extend scalar Date @specifiedBy(url: 5) SchemaError: Directive @specifiedBy at line 1, column 20 isn't repeatable but is applied more than once. +directive-drift argval extend scalar Date @specifiedBy(url: NOPE) SchemaError: Directive @specifiedBy at line 1, column 20 isn't repeatable but is applied more than once. +directive-drift argval extend scalar Date @specifiedBy(url: null) SchemaError: Directive @specifiedBy at line 1, column 20 isn't repeatable but is applied more than once. +directive-drift kind extend type Money { compatZ: String } BUILT Type 'Money' is defined as a scalar, but extended as an object type. The extension is ignored. +directive-drift kind extend interface Money { compatZ: String } BUILT Type 'Money' is defined as a scalar, but extended as an interface. The extension is ignored. +directive-drift kind extend input Money { compatZ: String } BUILT Type 'Money' is defined as a scalar, but extended as an input object type. The extension is ignored. +directive-drift kind extend enum Money { COMPAT_Z } BUILT Type 'Money' is defined as a scalar, but extended as an enum. The extension is ignored. +directive-drift kind extend union Money = Dog BUILT Type 'Money' is defined as a scalar, but extended as a union. The extension is ignored. +directive-drift undeclared extend scalar Money @compatUndeclared BUILT +directive-drift argval extend scalar Money @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend scalar Money @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend scalar Money @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' +directive-drift argval extend scalar Money @tag(level: "x") SchemaError: Directive @tag at line 1, column 21 is missing its required argument 'name'. +directive-drift argval extend scalar Money @tag(kind: 5) SchemaError: Directive @tag at line 1, column 21 is missing its required argument 'name'. +directive-drift argval extend scalar Money @tag(kind: "x") SchemaError: Directive @tag at line 1, column 21 is missing its required argument 'name'. +directive-drift argval extend scalar Money @tag(meta: 5) SchemaError: Directive @tag at line 1, column 21 is missing its required argument 'name'. +directive-drift argval extend scalar Money @tag(meta: "x") SchemaError: Directive @tag at line 1, column 21 is missing its required argument 'name'. +directive-drift argval extend scalar Money @once(reason: 5) InvalidSchemaException: invalid schema: Invalid argument 'reason' for applied directive of name 'once' +directive-drift argval extend scalar Money @once(reason: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'reason' for applied directive of name 'once' +directive-drift repeat-directive extend scalar Money @once @once SchemaError: Directive @once at line 1, column 27 isn't repeatable but is applied more than once. +directive-drift location extend scalar Money @link SchemaError: Directive @link at line 1, column 21 is applied to SCALAR, but it's declared on SCHEMA. Directive @link at line 1, column 21 is missing its required argument 'url'. +directive-drift location extend scalar Money @argDoc SchemaError: Directive @argDoc at line 1, column 21 is applied to SCALAR, but it's declared on FIELD_DEFINITION. +directive-drift location extend scalar Money @fieldOnly SchemaError: Directive @fieldOnly at line 1, column 21 is applied to SCALAR, but it's declared on FIELD_DEFINITION. +directive-drift argval extend scalar Money @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +directive-drift argval extend scalar Money @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +directive-drift argval extend scalar Money @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +directive-drift-undeclared seed SchemaError: Found applied directive undeclared without corresponding directive definition. +directive-drift-undeclared proxy FieldResolverError: Field 'Query.a' resolves to graphql.kickstart.tools.compat.scenarios.DirectiveDriftOneField.a, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectiveDriftOneField, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +directive-drift-undeclared kind extend interface Query { compatZ: String } SchemaError: Found applied directive undeclared without corresponding directive definition. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +directive-drift-undeclared kind extend input Query { compatZ: String } SchemaError: Found applied directive undeclared without corresponding directive definition. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +directive-drift-undeclared kind extend enum Query { COMPAT_Z } SchemaError: Found applied directive undeclared without corresponding directive definition. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +directive-drift-undeclared kind extend scalar Query @specifiedBy(url: "https://example.com") SchemaError: Found applied directive undeclared without corresponding directive definition. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +directive-drift-undeclared undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +directive-drift-undeclared repeat extend type Query { a: String @undeclared(s: "x") } SchemaError: Type 'Query' declares field 'a' more than once at line 1, column 21. +directive-drift-undeclared location extend type Query @specifiedBy SchemaError: Found applied directive undeclared without corresponding directive definition. +directives seed BUILT +directives proxy FieldResolverError: Field 'Query.motto' resolves to graphql.kickstart.tools.compat.scenarios.DirectivesQuery.motto, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectivesQuery, so every query of the field will fail. Field 'Query.oldMotto' resolves to graphql.kickstart.tools.compat.scenarios.DirectivesQuery.oldMotto, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectivesQuery, so every query of the field will fail. Field 'Query.members' resolves to graphql.kickstart.tools.compat.scenarios.DirectivesQuery.members, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectivesQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +directives kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +directives kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +directives kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +directives kind extend union Query = Member BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +directives kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +directives undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +directives repeat extend type Query { motto: String! @uppercase } SchemaError: Type 'Query' declares field 'motto' more than once at line 1, column 21. +directives location extend type Query @uppercase SchemaError: Directive @uppercase at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +directives location extend type Query @connection SchemaError: Directive @connection at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @connection at line 1, column 19 is missing its required argument 'for'. +directives location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +directives kind extend interface Member { compatZ: String } BUILT Type 'Member' is defined as an object type, but extended as an interface. The extension is ignored. +directives kind extend input Member { compatZ: String } BUILT Type 'Member' is defined as an object type, but extended as an input object type. The extension is ignored. +directives kind extend enum Member { COMPAT_Z } BUILT Type 'Member' is defined as an object type, but extended as an enum. The extension is ignored. +directives kind extend scalar Member @specifiedBy(url: "https://example.com") BUILT Type 'Member' is defined as an object type, but extended as a scalar. The extension is ignored. +directives undeclared extend type Member @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +directives repeat extend type Member { id: ID! } SchemaError: Type 'Member' declares field 'id' more than once at line 1, column 22. +directives location extend type Member @uppercase SchemaError: Directive @uppercase at line 1, column 20 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +directives location extend type Member @connection SchemaError: Directive @connection at line 1, column 20 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @connection at line 1, column 20 is missing its required argument 'for'. +directives location extend type Member @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. +directives-invalid seed SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid proxy FieldResolverError: Field 'Query.motto' resolves to graphql.kickstart.tools.compat.scenarios.DirectivesInvalidQuery.motto, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectivesInvalidQuery, so every query of the field will fail. Field 'Query.secret' resolves to graphql.kickstart.tools.compat.scenarios.DirectivesInvalidQuery.secret, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectivesInvalidQuery, so every query of the field will fail. Field 'Query.members' resolves to graphql.kickstart.tools.compat.scenarios.DirectivesInvalidQuery.members, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.DirectivesInvalidQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +directives-invalid kind extend interface Query { compatZ: String } SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +directives-invalid kind extend input Query { compatZ: String } SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +directives-invalid kind extend enum Query { COMPAT_Z } SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +directives-invalid kind extend union Query = Member SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +directives-invalid kind extend scalar Query @specifiedBy(url: "https://example.com") SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +directives-invalid undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +directives-invalid repeat extend type Query { motto: String! @uppercase } SchemaError: Type 'Query' declares field 'motto' more than once at line 1, column 21. +directives-invalid repeat-directive extend type Query @uppercase @uppercase SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 1, column 30 isn't repeatable but is applied more than once. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid location extend type Query @auth SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @auth at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @auth at line 1, column 19 is missing its required argument 'role'. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid location extend type Query @cached SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @cached at line 1, column 19 is applied to OBJECT, but it's declared on SCHEMA | FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid location extend type Query @specifiedBy SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid kind extend interface Member { compatZ: String } SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Member' is defined as an object type, but extended as an interface. The extension is ignored. +directives-invalid kind extend input Member { compatZ: String } SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Member' is defined as an object type, but extended as an input object type. The extension is ignored. +directives-invalid kind extend enum Member { COMPAT_Z } SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Member' is defined as an object type, but extended as an enum. The extension is ignored. +directives-invalid kind extend scalar Member @specifiedBy(url: "https://example.com") SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Type 'Member' is defined as an object type, but extended as a scalar. The extension is ignored. +directives-invalid undeclared extend type Member @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +directives-invalid repeat extend type Member { id: ID! } SchemaError: Type 'Member' declares field 'id' more than once at line 1, column 22. +directives-invalid repeat-directive extend type Member @uppercase @uppercase SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @uppercase at line 1, column 31 isn't repeatable but is applied more than once. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid location extend type Member @auth SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @auth at line 1, column 20 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @auth at line 1, column 20 is missing its required argument 'role'. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid location extend type Member @cached SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @cached at line 1, column 20 is applied to OBJECT, but it's declared on SCHEMA | FIELD_DEFINITION. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +directives-invalid location extend type Member @specifiedBy SchemaError: Directive @deprecated at line 17, column 13 in compat/scenarios/directives-invalid/schema.graphqls is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM_VALUE | INPUT_FIELD_DEFINITION. Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. Directive @uppercase at line 12, column 20 in compat/scenarios/directives-invalid/schema.graphqls is applied to FIELD_DEFINITION, but it's declared on OBJECT. Directive @auth at line 13, column 20 in compat/scenarios/directives-invalid/schema.graphqls is missing its required argument 'role'. Directive @cached at line 14, column 32 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. Directive @cached at line 9, column 15 in compat/scenarios/directives-invalid/schema.graphqls isn't repeatable but is applied more than once. +generic-input-resolver seed BUILT +generic-input-resolver proxy FieldResolverError: Field 'Query.generic' resolves to graphql.kickstart.tools.compat.scenarios.InputResolver.generic, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.InputResolver, so every query of the field will fail. Field 'Query.plain' resolves to graphql.kickstart.tools.compat.scenarios.GreetingQuery.plain, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.GreetingQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +generic-input-resolver kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +generic-input-resolver kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +generic-input-resolver kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +generic-input-resolver kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +generic-input-resolver undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +generic-input-resolver repeat extend type Query { generic(input: GreetingInput!): String! } SchemaError: Type 'Query' declares field 'generic' more than once at line 1, column 21. +generic-input-resolver location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +generic-input-resolver kind extend type GreetingInput { compatZ: String } BUILT Type 'GreetingInput' is defined as an input object type, but extended as an object type. The extension is ignored. +generic-input-resolver kind extend interface GreetingInput { compatZ: String } BUILT Type 'GreetingInput' is defined as an input object type, but extended as an interface. The extension is ignored. +generic-input-resolver kind extend enum GreetingInput { COMPAT_Z } BUILT Type 'GreetingInput' is defined as an input object type, but extended as an enum. The extension is ignored. +generic-input-resolver kind extend scalar GreetingInput @specifiedBy(url: "https://example.com") BUILT Type 'GreetingInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +generic-input-resolver undeclared extend input GreetingInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +generic-input-resolver repeat extend input GreetingInput { name: String! } SchemaError: Type 'GreetingInput' declares field 'name' more than once at line 1, column 30. +generic-input-resolver location extend input GreetingInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 28 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 28 is missing its required argument 'url'. +inputs seed BUILT +inputs proxy FieldResolverError: Field 'Query.search' resolves to graphql.kickstart.tools.compat.scenarios.InputsQuery.search, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.InputsQuery, so every query of the field will fail. Field 'Query.nickname' resolves to graphql.kickstart.tools.compat.scenarios.InputsQuery.nickname, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.InputsQuery, so every query of the field will fail. Field 'Mutation.addBook' resolves to graphql.kickstart.tools.compat.scenarios.InputsMutation.addBook, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.InputsMutation, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +inputs kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +inputs kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +inputs kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +inputs kind extend union Query = SavedBook BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +inputs kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +inputs undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +inputs repeat extend type Query { search(term: String!, limit: Int = 10, genres: [Genre!]): String! } SchemaError: Type 'Query' declares field 'search' more than once at line 1, column 21. +inputs location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +inputs kind extend interface Mutation { compatZ: String } BUILT Type 'Mutation' is defined as an object type, but extended as an interface. The extension is ignored. +inputs kind extend input Mutation { compatZ: String } BUILT Type 'Mutation' is defined as an object type, but extended as an input object type. The extension is ignored. +inputs kind extend enum Mutation { COMPAT_Z } BUILT Type 'Mutation' is defined as an object type, but extended as an enum. The extension is ignored. +inputs kind extend union Mutation = SavedBook BUILT Type 'Mutation' is defined as an object type, but extended as a union. The extension is ignored. +inputs kind extend scalar Mutation @specifiedBy(url: "https://example.com") BUILT Type 'Mutation' is defined as an object type, but extended as a scalar. The extension is ignored. +inputs undeclared extend type Mutation @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +inputs repeat extend type Mutation { addBook(input: BookInput!): SavedBook! } SchemaError: Type 'Mutation' declares field 'addBook' more than once at line 1, column 24. +inputs location extend type Mutation @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 22 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 22 is missing its required argument 'url'. +inputs kind extend type Genre { compatZ: String } BUILT Type 'Genre' is defined as an enum, but extended as an object type. The extension is ignored. +inputs kind extend interface Genre { compatZ: String } BUILT Type 'Genre' is defined as an enum, but extended as an interface. The extension is ignored. +inputs kind extend input Genre { compatZ: String } BUILT Type 'Genre' is defined as an enum, but extended as an input object type. The extension is ignored. +inputs kind extend union Genre = SavedBook BUILT Type 'Genre' is defined as an enum, but extended as a union. The extension is ignored. +inputs kind extend scalar Genre @specifiedBy(url: "https://example.com") BUILT Type 'Genre' is defined as an enum, but extended as a scalar. The extension is ignored. +inputs undeclared extend enum Genre @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +inputs repeat extend enum Genre { FICTION } SchemaError: Type 'Genre' declares value 'FICTION' more than once at line 1, column 21. +inputs location extend enum Genre @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to ENUM, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +inputs kind extend type BookInput { compatZ: String } BUILT Type 'BookInput' is defined as an input object type, but extended as an object type. The extension is ignored. +inputs kind extend interface BookInput { compatZ: String } BUILT Type 'BookInput' is defined as an input object type, but extended as an interface. The extension is ignored. +inputs kind extend enum BookInput { COMPAT_Z } BUILT Type 'BookInput' is defined as an input object type, but extended as an enum. The extension is ignored. +inputs kind extend union BookInput = SavedBook BUILT Type 'BookInput' is defined as an input object type, but extended as a union. The extension is ignored. +inputs kind extend scalar BookInput @specifiedBy(url: "https://example.com") BUILT Type 'BookInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +inputs undeclared extend input BookInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +inputs repeat extend input BookInput { title: String! } SchemaError: Type 'BookInput' declares field 'title' more than once at line 1, column 26. +inputs location extend input BookInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 24 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 24 is missing its required argument 'url'. +inputs kind extend type DetailsInput { compatZ: String } BUILT Type 'DetailsInput' is defined as an input object type, but extended as an object type. The extension is ignored. +inputs kind extend interface DetailsInput { compatZ: String } BUILT Type 'DetailsInput' is defined as an input object type, but extended as an interface. The extension is ignored. +inputs kind extend enum DetailsInput { COMPAT_Z } BUILT Type 'DetailsInput' is defined as an input object type, but extended as an enum. The extension is ignored. +inputs kind extend union DetailsInput = SavedBook BUILT Type 'DetailsInput' is defined as an input object type, but extended as a union. The extension is ignored. +inputs kind extend scalar DetailsInput @specifiedBy(url: "https://example.com") BUILT Type 'DetailsInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +inputs undeclared extend input DetailsInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +inputs repeat extend input DetailsInput { pages: Int! } SchemaError: Type 'DetailsInput' declares field 'pages' more than once at line 1, column 29. +inputs location extend input DetailsInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 27 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 27 is missing its required argument 'url'. +inputs kind extend interface SavedBook { compatZ: String } BUILT Type 'SavedBook' is defined as an object type, but extended as an interface. The extension is ignored. +inputs kind extend input SavedBook { compatZ: String } BUILT Type 'SavedBook' is defined as an object type, but extended as an input object type. The extension is ignored. +inputs kind extend enum SavedBook { COMPAT_Z } BUILT Type 'SavedBook' is defined as an object type, but extended as an enum. The extension is ignored. +inputs kind extend scalar SavedBook @specifiedBy(url: "https://example.com") BUILT Type 'SavedBook' is defined as an object type, but extended as a scalar. The extension is ignored. +inputs undeclared extend type SavedBook @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +inputs repeat extend type SavedBook { title: String! } SchemaError: Type 'SavedBook' declares field 'title' more than once at line 1, column 25. +inputs location extend type SavedBook @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 23 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 23 is missing its required argument 'url'. +jdk-proxy seed FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. +jdk-proxy proxy FieldResolverError: No method or field found as defined in schema compat/scenarios/jdk-proxy/schema.graphqls:2 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: jdk.proxyN.$ProxyN.test() jdk.proxyN.$ProxyN.getTest() jdk.proxyN.$ProxyN.test +jdk-proxy kind extend interface Query { compatZ: String } FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +jdk-proxy kind extend input Query { compatZ: String } FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +jdk-proxy kind extend enum Query { COMPAT_Z } FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +jdk-proxy kind extend scalar Query @specifiedBy(url: "https://example.com") FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +jdk-proxy undeclared extend type Query @compatUndeclared FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. +jdk-proxy repeat extend type Query { test: String } FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. +jdk-proxy location extend type Query @specifiedBy FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. +jdk-proxy-cglib seed AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib proxy AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib kind extend interface Query { compatZ: String } AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib kind extend input Query { compatZ: String } AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib kind extend enum Query { COMPAT_Z } AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib kind extend scalar Query @specifiedBy(url: "https://example.com") AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib undeclared extend type Query @compatUndeclared AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib repeat extend type Query { test: String } AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-cglib location extend type Query @specifiedBy AopConfigException: Could not generate CGLIB subclass of class graphql.kickstart.tools.compat.scenarios.ProxiedQuery: Common causes of this problem include using a final class or a non-visible class +jdk-proxy-plain seed BUILT +jdk-proxy-plain proxy FieldResolverError: Field 'Query.test' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.test, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. Field 'Query.total' resolves to graphql.kickstart.tools.compat.scenarios.ProxiedQuery.getTotal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. For a public field, also add a getter, since class-based proxies don't pass field reads to the target. +jdk-proxy-plain kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +jdk-proxy-plain kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +jdk-proxy-plain kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +jdk-proxy-plain kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +jdk-proxy-plain undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +jdk-proxy-plain repeat extend type Query { test: String } SchemaError: Type 'Query' declares field 'test' more than once at line 1, column 21. +jdk-proxy-plain location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +nested-unions seed BUILT +nested-unions proxy FieldResolverError: Field 'Query.results' resolves to graphql.kickstart.tools.compat.scenarios.NestedUnionsQuery.results, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedUnionsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +nested-unions kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +nested-unions kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-unions kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +nested-unions kind extend union Query = Book BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +nested-unions kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-unions undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-unions repeat extend type Query { results: [Result!]! } SchemaError: Type 'Query' declares field 'results' more than once at line 1, column 21. +nested-unions location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +nested-unions kind extend type Result { compatZ: String } BUILT Type 'Result' is defined as a union, but extended as an object type. The extension is ignored. +nested-unions kind extend interface Result { compatZ: String } BUILT Type 'Result' is defined as a union, but extended as an interface. The extension is ignored. +nested-unions kind extend input Result { compatZ: String } BUILT Type 'Result' is defined as a union, but extended as an input object type. The extension is ignored. +nested-unions kind extend enum Result { COMPAT_Z } BUILT Type 'Result' is defined as a union, but extended as an enum. The extension is ignored. +nested-unions kind extend scalar Result @specifiedBy(url: "https://example.com") BUILT Type 'Result' is defined as a union, but extended as a scalar. The extension is ignored. +nested-unions undeclared extend union Result @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-unions repeat extend union Result = Book SchemaError: Type 'Result' declares member 'Book' more than once at line 1, column 23. +nested-unions location extend union Result @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. +nested-unions kind extend type Media { compatZ: String } BUILT Type 'Media' is defined as a union, but extended as an object type. The extension is ignored. +nested-unions kind extend interface Media { compatZ: String } BUILT Type 'Media' is defined as a union, but extended as an interface. The extension is ignored. +nested-unions kind extend input Media { compatZ: String } BUILT Type 'Media' is defined as a union, but extended as an input object type. The extension is ignored. +nested-unions kind extend enum Media { COMPAT_Z } BUILT Type 'Media' is defined as a union, but extended as an enum. The extension is ignored. +nested-unions kind extend scalar Media @specifiedBy(url: "https://example.com") BUILT Type 'Media' is defined as a union, but extended as a scalar. The extension is ignored. +nested-unions undeclared extend union Media @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-unions repeat extend union Media = Movie SchemaError: Type 'Media' declares member 'Movie' more than once at line 1, column 22. +nested-unions location extend union Media @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. +nested-unions kind extend interface Book { compatZ: String } BUILT Type 'Book' is defined as an object type, but extended as an interface. The extension is ignored. +nested-unions kind extend input Book { compatZ: String } BUILT Type 'Book' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-unions kind extend enum Book { COMPAT_Z } BUILT Type 'Book' is defined as an object type, but extended as an enum. The extension is ignored. +nested-unions kind extend union Book = Movie BUILT Type 'Book' is defined as an object type, but extended as a union. The extension is ignored. +nested-unions kind extend scalar Book @specifiedBy(url: "https://example.com") BUILT Type 'Book' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-unions undeclared extend type Book @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-unions repeat extend type Book { title: String! } SchemaError: Type 'Book' declares field 'title' more than once at line 1, column 20. +nested-unions location extend type Book @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +nested-unions kind extend interface Movie { compatZ: String } BUILT Type 'Movie' is defined as an object type, but extended as an interface. The extension is ignored. +nested-unions kind extend input Movie { compatZ: String } BUILT Type 'Movie' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-unions kind extend enum Movie { COMPAT_Z } BUILT Type 'Movie' is defined as an object type, but extended as an enum. The extension is ignored. +nested-unions kind extend union Movie = Book BUILT Type 'Movie' is defined as an object type, but extended as a union. The extension is ignored. +nested-unions kind extend scalar Movie @specifiedBy(url: "https://example.com") BUILT Type 'Movie' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-unions undeclared extend type Movie @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-unions repeat extend type Movie { title: String! } SchemaError: Type 'Movie' declares field 'title' more than once at line 1, column 21. +nested-unions location extend type Movie @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +nested-wrappers seed BUILT +nested-wrappers proxy FieldResolverError: Field 'Query.payload' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.payload, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.payloads' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.payloads, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.payloadStrings' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.payloadStrings, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.items' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.items, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.itemNames' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.itemNames, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.futureOfFuture' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.futureOfFuture, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.futureOfTries' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.futureOfTries, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.triesOfFutures' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.triesOfFutures, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.loadedItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.loadedItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.failedTryInList' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.failedTryInList, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.failedFutureInList' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.failedFutureInList, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.plainItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.plainItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.futureOfItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.futureOfItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +nested-wrappers kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers kind extend union Query = Payload BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers repeat extend type Query { payload: Payload! } SchemaError: Type 'Query' declares field 'payload' more than once at line 1, column 21. +nested-wrappers location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +nested-wrappers kind extend interface Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers kind extend input Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers kind extend enum Payload { COMPAT_Z } BUILT Type 'Payload' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers kind extend union Payload = Item BUILT Type 'Payload' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers kind extend scalar Payload @specifiedBy(url: "https://example.com") BUILT Type 'Payload' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers undeclared extend type Payload @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers repeat extend type Payload { data: String! } SchemaError: Type 'Payload' declares field 'data' more than once at line 1, column 23. +nested-wrappers location extend type Payload @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. +nested-wrappers kind extend interface Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers kind extend input Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers kind extend enum Item { COMPAT_Z } BUILT Type 'Item' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers kind extend union Item = Payload BUILT Type 'Item' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers kind extend scalar Item @specifiedBy(url: "https://example.com") BUILT Type 'Item' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers undeclared extend type Item @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers repeat extend type Item { id: ID! } SchemaError: Type 'Item' declares field 'id' more than once at line 1, column 20. +nested-wrappers location extend type Item @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +nested-wrappers-exact seed BUILT +nested-wrappers-exact proxy FieldResolverError: Field 'Query.dates' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery.dates, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery, so every query of the field will fail. Field 'Query.triedDates' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery.triedDates, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery, so every query of the field will fail. Field 'Query.plainFutureItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery.plainFutureItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery, so every query of the field will fail. Field 'Query.batchedItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery.batchedItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery, so every query of the field will fail. Field 'Query.boxedItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery.boxedItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery, so every query of the field will fail. Field 'Query.laterItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery.laterItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery, so every query of the field will fail. Field 'Query.suspendPlainFutureItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery.suspendPlainFutureItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersExactQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +nested-wrappers-exact kind extend type DateTime { compatZ: String } BUILT Type 'DateTime' is defined as a scalar, but extended as an object type. The extension is ignored. +nested-wrappers-exact kind extend interface DateTime { compatZ: String } BUILT Type 'DateTime' is defined as a scalar, but extended as an interface. The extension is ignored. +nested-wrappers-exact kind extend input DateTime { compatZ: String } BUILT Type 'DateTime' is defined as a scalar, but extended as an input object type. The extension is ignored. +nested-wrappers-exact kind extend enum DateTime { COMPAT_Z } BUILT Type 'DateTime' is defined as a scalar, but extended as an enum. The extension is ignored. +nested-wrappers-exact kind extend union DateTime = Item BUILT Type 'DateTime' is defined as a scalar, but extended as a union. The extension is ignored. +nested-wrappers-exact undeclared extend scalar DateTime @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-exact argval extend scalar DateTime @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +nested-wrappers-exact argval extend scalar DateTime @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +nested-wrappers-exact argval extend scalar DateTime @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +nested-wrappers-exact kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers-exact kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers-exact kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers-exact kind extend union Query = Item BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers-exact kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers-exact undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-exact repeat extend type Query { dates: [DateTime] } SchemaError: Type 'Query' declares field 'dates' more than once at line 1, column 21. +nested-wrappers-exact location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +nested-wrappers-exact kind extend interface Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers-exact kind extend input Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers-exact kind extend enum Item { COMPAT_Z } BUILT Type 'Item' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers-exact kind extend scalar Item @specifiedBy(url: "https://example.com") BUILT Type 'Item' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers-exact undeclared extend type Item @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-exact repeat extend type Item { id: ID! } SchemaError: Type 'Item' declares field 'id' more than once at line 1, column 20. +nested-wrappers-exact location extend type Item @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +nested-wrappers-suspend seed BUILT +nested-wrappers-suspend proxy FieldResolverError: Field 'Query.nullableItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersSuspendQuery.nullableItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersSuspendQuery, so every query of the field will fail. Field 'Query.nonNullItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersSuspendQuery.nonNullItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersSuspendQuery, so every query of the field will fail. Field 'Query.typeVariableStrings' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersSuspendQuery.typeVariableStrings, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersSuspendQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +nested-wrappers-suspend kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers-suspend kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers-suspend kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers-suspend kind extend union Query = Item BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers-suspend kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers-suspend undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-suspend repeat extend type Query { nullableItems: [Item] } SchemaError: Type 'Query' declares field 'nullableItems' more than once at line 1, column 21. +nested-wrappers-suspend location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +nested-wrappers-suspend kind extend interface Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers-suspend kind extend input Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers-suspend kind extend enum Item { COMPAT_Z } BUILT Type 'Item' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers-suspend kind extend scalar Item @specifiedBy(url: "https://example.com") BUILT Type 'Item' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers-suspend undeclared extend type Item @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-suspend repeat extend type Item { id: ID! } SchemaError: Type 'Item' declares field 'id' more than once at line 1, column 20. +nested-wrappers-suspend location extend type Item @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +nested-wrappers-unboxer seed BUILT +nested-wrappers-unboxer proxy FieldResolverError: Field 'Query.payload' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.payload, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.payloads' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.payloads, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.payloadStrings' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.payloadStrings, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.items' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.items, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.itemNames' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.itemNames, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.futureOfFuture' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.futureOfFuture, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.futureOfTries' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.futureOfTries, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.triesOfFutures' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.triesOfFutures, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.loadedItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.loadedItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.failedTryInList' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.failedTryInList, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.failedFutureInList' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.failedFutureInList, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.plainItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.plainItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. Field 'Query.futureOfItems' resolves to graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery.futureOfItems, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.NestedWrappersQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +nested-wrappers-unboxer kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers-unboxer kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers-unboxer kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers-unboxer kind extend union Query = Payload BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers-unboxer kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers-unboxer undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-unboxer repeat extend type Query { payload: Payload! } SchemaError: Type 'Query' declares field 'payload' more than once at line 1, column 21. +nested-wrappers-unboxer location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +nested-wrappers-unboxer kind extend interface Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers-unboxer kind extend input Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers-unboxer kind extend enum Payload { COMPAT_Z } BUILT Type 'Payload' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers-unboxer kind extend union Payload = Item BUILT Type 'Payload' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers-unboxer kind extend scalar Payload @specifiedBy(url: "https://example.com") BUILT Type 'Payload' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers-unboxer undeclared extend type Payload @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-unboxer repeat extend type Payload { data: String! } SchemaError: Type 'Payload' declares field 'data' more than once at line 1, column 23. +nested-wrappers-unboxer location extend type Payload @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. +nested-wrappers-unboxer kind extend interface Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an interface. The extension is ignored. +nested-wrappers-unboxer kind extend input Item { compatZ: String } BUILT Type 'Item' is defined as an object type, but extended as an input object type. The extension is ignored. +nested-wrappers-unboxer kind extend enum Item { COMPAT_Z } BUILT Type 'Item' is defined as an object type, but extended as an enum. The extension is ignored. +nested-wrappers-unboxer kind extend union Item = Payload BUILT Type 'Item' is defined as an object type, but extended as a union. The extension is ignored. +nested-wrappers-unboxer kind extend scalar Item @specifiedBy(url: "https://example.com") BUILT Type 'Item' is defined as an object type, but extended as a scalar. The extension is ignored. +nested-wrappers-unboxer undeclared extend type Item @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +nested-wrappers-unboxer repeat extend type Item { id: ID! } SchemaError: Type 'Item' declares field 'id' more than once at line 1, column 20. +nested-wrappers-unboxer location extend type Item @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +optional-results seed BUILT +optional-results proxy FieldResolverError: Field 'Query.optionalResult' resolves to graphql.kickstart.tools.compat.scenarios.OptionalResultsQuery.optionalResult, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.OptionalResultsQuery, so every query of the field will fail. Field 'Query.optionalResultName' resolves to graphql.kickstart.tools.compat.scenarios.OptionalResultsQuery.optionalResultName, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.OptionalResultsQuery, so every query of the field will fail. Field 'Query.emptyOptionalResult' resolves to graphql.kickstart.tools.compat.scenarios.OptionalResultsQuery.emptyOptionalResult, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.OptionalResultsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +optional-results kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results kind extend union Query = Payload BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +optional-results kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +optional-results repeat extend type Query { optionalResult: Payload } SchemaError: Type 'Query' declares field 'optionalResult' more than once at line 1, column 21. +optional-results location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +optional-results kind extend interface Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results kind extend input Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results kind extend enum Payload { COMPAT_Z } BUILT Type 'Payload' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results kind extend scalar Payload @specifiedBy(url: "https://example.com") BUILT Type 'Payload' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results undeclared extend type Payload @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +optional-results repeat extend type Payload { data: String } SchemaError: Type 'Payload' declares field 'data' more than once at line 1, column 23. +optional-results location extend type Payload @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. +optional-results-list seed BUILT +optional-results-list proxy FieldResolverError: Field 'Query.optionalResultList' resolves to graphql.kickstart.tools.compat.scenarios.OptionalResultsListQuery.optionalResultList, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.OptionalResultsListQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +optional-results-list kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results-list kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results-list kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results-list kind extend union Query = Payload BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +optional-results-list kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results-list undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +optional-results-list repeat extend type Query { optionalResultList: [Payload] } SchemaError: Type 'Query' declares field 'optionalResultList' more than once at line 1, column 21. +optional-results-list location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +optional-results-list kind extend interface Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results-list kind extend input Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results-list kind extend enum Payload { COMPAT_Z } BUILT Type 'Payload' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results-list kind extend scalar Payload @specifiedBy(url: "https://example.com") BUILT Type 'Payload' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results-list undeclared extend type Payload @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +optional-results-list repeat extend type Payload { data: String } SchemaError: Type 'Payload' declares field 'data' more than once at line 1, column 23. +optional-results-list location extend type Payload @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. +optional-results-mixed seed BUILT +optional-results-mixed proxy FieldResolverError: Field 'Query.optionalResult' resolves to graphql.kickstart.tools.compat.scenarios.OptionalResultsMixedQuery.optionalResult, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.OptionalResultsMixedQuery, so every query of the field will fail. Field 'Query.resultOfOptional' resolves to graphql.kickstart.tools.compat.scenarios.OptionalResultsMixedQuery.resultOfOptional, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.OptionalResultsMixedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +optional-results-mixed kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results-mixed kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results-mixed kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results-mixed kind extend union Query = Payload BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +optional-results-mixed kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results-mixed undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +optional-results-mixed repeat extend type Query { optionalResult: Payload } SchemaError: Type 'Query' declares field 'optionalResult' more than once at line 1, column 21. +optional-results-mixed location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +optional-results-mixed kind extend interface Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results-mixed kind extend input Payload { compatZ: String } BUILT Type 'Payload' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results-mixed kind extend enum Payload { COMPAT_Z } BUILT Type 'Payload' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results-mixed kind extend scalar Payload @specifiedBy(url: "https://example.com") BUILT Type 'Payload' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results-mixed undeclared extend type Payload @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +optional-results-mixed repeat extend type Payload { data: String } SchemaError: Type 'Payload' declares field 'data' more than once at line 1, column 23. +optional-results-mixed location extend type Payload @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. +optional-results-nested seed SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +optional-results-nested proxy SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +optional-results-nested kind extend interface Query { compatZ: String } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results-nested kind extend input Query { compatZ: String } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results-nested kind extend enum Query { COMPAT_Z } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results-nested kind extend union Query = Payload SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +optional-results-nested kind extend scalar Query @specifiedBy(url: "https://example.com") SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results-nested undeclared extend type Query @compatUndeclared SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +optional-results-nested repeat extend type Query { optionalResultOfResult: Payload } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +optional-results-nested location extend type Query @specifiedBy SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +optional-results-nested kind extend interface Payload { compatZ: String } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Payload' is defined as an object type, but extended as an interface. The extension is ignored. +optional-results-nested kind extend input Payload { compatZ: String } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Payload' is defined as an object type, but extended as an input object type. The extension is ignored. +optional-results-nested kind extend enum Payload { COMPAT_Z } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Payload' is defined as an object type, but extended as an enum. The extension is ignored. +optional-results-nested kind extend scalar Payload @specifiedBy(url: "https://example.com") SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself Type 'Payload' is defined as an object type, but extended as a scalar. The extension is ignored. +optional-results-nested undeclared extend type Payload @compatUndeclared SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +optional-results-nested repeat extend type Payload { data: String } SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +optional-results-nested location extend type Payload @specifiedBy SchemaClassScannerError: Unable to match type definition (Payload) for reference return type of method public final java.util.Optional graphql.kickstart.tools.compat.scenarios.OptionalResultsNestedQuery.optionalResultOfResult() with java type (java.util.Optional>>): graphql.execution.DataFetcherResult cannot be nested within itself +options seed BUILT +options proxy FieldResolverError: Field 'Query.name' resolves to graphql.kickstart.tools.compat.scenarios.OptionsQuery.name, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.OptionsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +options kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +options kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +options kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +options kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +options undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +options repeat extend type Query { name: String! } SchemaError: Type 'Query' declares field 'name' more than once at line 1, column 21. +options location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +polymorphism seed BUILT +polymorphism proxy FieldResolverError: Field 'Query.node' resolves to graphql.kickstart.tools.compat.scenarios.PolymorphismQuery.node, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.PolymorphismQuery, so every query of the field will fail. Field 'Query.search' resolves to graphql.kickstart.tools.compat.scenarios.PolymorphismQuery.search, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.PolymorphismQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +polymorphism kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +polymorphism kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +polymorphism kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +polymorphism kind extend union Query = Novel BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +polymorphism kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +polymorphism undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +polymorphism repeat extend type Query { node(id: ID!): Node } SchemaError: Type 'Query' declares field 'node' more than once at line 1, column 21. +polymorphism location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +polymorphism kind extend type Node { compatZ: String } BUILT Type 'Node' is defined as an interface, but extended as an object type. The extension is ignored. +polymorphism kind extend input Node { compatZ: String } BUILT Type 'Node' is defined as an interface, but extended as an input object type. The extension is ignored. +polymorphism kind extend enum Node { COMPAT_Z } BUILT Type 'Node' is defined as an interface, but extended as an enum. The extension is ignored. +polymorphism kind extend union Node = Novel BUILT Type 'Node' is defined as an interface, but extended as a union. The extension is ignored. +polymorphism kind extend scalar Node @specifiedBy(url: "https://example.com") BUILT Type 'Node' is defined as an interface, but extended as a scalar. The extension is ignored. +polymorphism undeclared extend interface Node @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +polymorphism repeat extend interface Node { id: ID! } SchemaError: Type 'Node' declares field 'id' more than once at line 1, column 25. +polymorphism location extend interface Node @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 23 is applied to INTERFACE, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 23 is missing its required argument 'url'. +polymorphism kind extend interface Novel { compatZ: String } BUILT Type 'Novel' is defined as an object type, but extended as an interface. The extension is ignored. +polymorphism kind extend input Novel { compatZ: String } BUILT Type 'Novel' is defined as an object type, but extended as an input object type. The extension is ignored. +polymorphism kind extend enum Novel { COMPAT_Z } BUILT Type 'Novel' is defined as an object type, but extended as an enum. The extension is ignored. +polymorphism kind extend union Novel = Writer BUILT Type 'Novel' is defined as an object type, but extended as a union. The extension is ignored. +polymorphism kind extend scalar Novel @specifiedBy(url: "https://example.com") BUILT Type 'Novel' is defined as an object type, but extended as a scalar. The extension is ignored. +polymorphism undeclared extend type Novel @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +polymorphism repeat extend type Novel { id: ID! } SchemaError: Type 'Novel' declares field 'id' more than once at line 1, column 21. +polymorphism location extend type Novel @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +polymorphism kind extend interface Writer { compatZ: String } BUILT Type 'Writer' is defined as an object type, but extended as an interface. The extension is ignored. +polymorphism kind extend input Writer { compatZ: String } BUILT Type 'Writer' is defined as an object type, but extended as an input object type. The extension is ignored. +polymorphism kind extend enum Writer { COMPAT_Z } BUILT Type 'Writer' is defined as an object type, but extended as an enum. The extension is ignored. +polymorphism kind extend union Writer = Novel BUILT Type 'Writer' is defined as an object type, but extended as a union. The extension is ignored. +polymorphism kind extend scalar Writer @specifiedBy(url: "https://example.com") BUILT Type 'Writer' is defined as an object type, but extended as a scalar. The extension is ignored. +polymorphism undeclared extend type Writer @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +polymorphism repeat extend type Writer { id: ID! } SchemaError: Type 'Writer' declares field 'id' more than once at line 1, column 22. +polymorphism location extend type Writer @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. +polymorphism kind extend type SearchResult { compatZ: String } BUILT Type 'SearchResult' is defined as a union, but extended as an object type. The extension is ignored. +polymorphism kind extend interface SearchResult { compatZ: String } BUILT Type 'SearchResult' is defined as a union, but extended as an interface. The extension is ignored. +polymorphism kind extend input SearchResult { compatZ: String } BUILT Type 'SearchResult' is defined as a union, but extended as an input object type. The extension is ignored. +polymorphism kind extend enum SearchResult { COMPAT_Z } BUILT Type 'SearchResult' is defined as a union, but extended as an enum. The extension is ignored. +polymorphism kind extend scalar SearchResult @specifiedBy(url: "https://example.com") BUILT Type 'SearchResult' is defined as a union, but extended as a scalar. The extension is ignored. +polymorphism undeclared extend union SearchResult @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +polymorphism repeat extend union SearchResult = Novel SchemaError: Type 'SearchResult' declares member 'Novel' more than once at line 1, column 29. +polymorphism location extend union SearchResult @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 27 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 27 is missing its required argument 'url'. +read-only-schema seed BUILT +read-only-schema proxy FieldResolverError: Field 'Query.animal' resolves to graphql.kickstart.tools.compat.scenarios.ReadOnlyQuery.animal, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ReadOnlyQuery, so every query of the field will fail. Field 'Query.pets' resolves to graphql.kickstart.tools.compat.scenarios.ReadOnlyQuery.pets, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ReadOnlyQuery, so every query of the field will fail. Field 'Mutation.adopt' resolves to graphql.kickstart.tools.compat.scenarios.ReadOnlyMutation.adopt, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ReadOnlyMutation, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +read-only-schema kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +read-only-schema kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +read-only-schema kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +read-only-schema kind extend union Query = Dog BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +read-only-schema kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +read-only-schema undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +read-only-schema repeat extend type Query { animal(name: String!): Animal } SchemaError: Type 'Query' declares field 'animal' more than once at line 1, column 21. +read-only-schema location extend type Query @tag SchemaError: Directive @tag at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @tag at line 1, column 19 is missing its required argument 'name'. +read-only-schema location extend type Query @contact SchemaError: Directive @contact at line 1, column 19 is applied to OBJECT, but it's declared on SCHEMA. Directive @contact at line 1, column 19 is missing its required argument 'name'. +read-only-schema location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +read-only-schema kind extend interface Mutation { compatZ: String } BUILT Type 'Mutation' is defined as an object type, but extended as an interface. The extension is ignored. +read-only-schema kind extend input Mutation { compatZ: String } BUILT Type 'Mutation' is defined as an object type, but extended as an input object type. The extension is ignored. +read-only-schema kind extend enum Mutation { COMPAT_Z } BUILT Type 'Mutation' is defined as an object type, but extended as an enum. The extension is ignored. +read-only-schema kind extend union Mutation = Dog BUILT Type 'Mutation' is defined as an object type, but extended as a union. The extension is ignored. +read-only-schema kind extend scalar Mutation @specifiedBy(url: "https://example.com") BUILT Type 'Mutation' is defined as an object type, but extended as a scalar. The extension is ignored. +read-only-schema undeclared extend type Mutation @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +read-only-schema repeat extend type Mutation { adopt(name: String!): Animal! } SchemaError: Type 'Mutation' declares field 'adopt' more than once at line 1, column 24. +read-only-schema location extend type Mutation @tag SchemaError: Directive @tag at line 1, column 22 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @tag at line 1, column 22 is missing its required argument 'name'. +read-only-schema location extend type Mutation @contact SchemaError: Directive @contact at line 1, column 22 is applied to OBJECT, but it's declared on SCHEMA. Directive @contact at line 1, column 22 is missing its required argument 'name'. +read-only-schema location extend type Mutation @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 22 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 22 is missing its required argument 'url'. +read-only-schema kind extend type Animal { compatZ: String } BUILT Type 'Animal' is defined as an interface, but extended as an object type. The extension is ignored. +read-only-schema kind extend input Animal { compatZ: String } BUILT Type 'Animal' is defined as an interface, but extended as an input object type. The extension is ignored. +read-only-schema kind extend enum Animal { COMPAT_Z } BUILT Type 'Animal' is defined as an interface, but extended as an enum. The extension is ignored. +read-only-schema kind extend union Animal = Dog BUILT Type 'Animal' is defined as an interface, but extended as a union. The extension is ignored. +read-only-schema kind extend scalar Animal @specifiedBy(url: "https://example.com") BUILT Type 'Animal' is defined as an interface, but extended as a scalar. The extension is ignored. +read-only-schema undeclared extend interface Animal @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +read-only-schema repeat extend interface Animal { name: String! @tag(name: "public") } SchemaError: Type 'Animal' declares field 'name' more than once at line 1, column 27. +read-only-schema location extend interface Animal @tag SchemaError: Directive @tag at line 1, column 25 is applied to INTERFACE, but it's declared on FIELD_DEFINITION. Directive @tag at line 1, column 25 is missing its required argument 'name'. +read-only-schema location extend interface Animal @contact SchemaError: Directive @contact at line 1, column 25 is applied to INTERFACE, but it's declared on SCHEMA. Directive @contact at line 1, column 25 is missing its required argument 'name'. +read-only-schema location extend interface Animal @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INTERFACE, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +read-only-schema kind extend interface Dog { compatZ: String } BUILT Type 'Dog' is defined as an object type, but extended as an interface. The extension is ignored. +read-only-schema kind extend input Dog { compatZ: String } BUILT Type 'Dog' is defined as an object type, but extended as an input object type. The extension is ignored. +read-only-schema kind extend enum Dog { COMPAT_Z } BUILT Type 'Dog' is defined as an object type, but extended as an enum. The extension is ignored. +read-only-schema kind extend union Dog = Cat BUILT Type 'Dog' is defined as an object type, but extended as a union. The extension is ignored. +read-only-schema kind extend scalar Dog @specifiedBy(url: "https://example.com") BUILT Type 'Dog' is defined as an object type, but extended as a scalar. The extension is ignored. +read-only-schema undeclared extend type Dog @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +read-only-schema repeat extend type Dog { name: String! @tag(name: "public") } SchemaError: Type 'Dog' declares field 'name' more than once at line 1, column 19. +read-only-schema location extend type Dog @tag SchemaError: Directive @tag at line 1, column 17 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @tag at line 1, column 17 is missing its required argument 'name'. +read-only-schema location extend type Dog @contact SchemaError: Directive @contact at line 1, column 17 is applied to OBJECT, but it's declared on SCHEMA. Directive @contact at line 1, column 17 is missing its required argument 'name'. +read-only-schema location extend type Dog @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 17 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 17 is missing its required argument 'url'. +read-only-schema kind extend interface Cat { compatZ: String } BUILT Type 'Cat' is defined as an object type, but extended as an interface. The extension is ignored. +read-only-schema kind extend input Cat { compatZ: String } BUILT Type 'Cat' is defined as an object type, but extended as an input object type. The extension is ignored. +read-only-schema kind extend enum Cat { COMPAT_Z } BUILT Type 'Cat' is defined as an object type, but extended as an enum. The extension is ignored. +read-only-schema kind extend union Cat = Dog BUILT Type 'Cat' is defined as an object type, but extended as a union. The extension is ignored. +read-only-schema kind extend scalar Cat @specifiedBy(url: "https://example.com") BUILT Type 'Cat' is defined as an object type, but extended as a scalar. The extension is ignored. +read-only-schema undeclared extend type Cat @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +read-only-schema repeat extend type Cat { name: String! @tag(name: "public") } SchemaError: Type 'Cat' declares field 'name' more than once at line 1, column 19. +read-only-schema location extend type Cat @tag SchemaError: Directive @tag at line 1, column 17 is applied to OBJECT, but it's declared on FIELD_DEFINITION. Directive @tag at line 1, column 17 is missing its required argument 'name'. +read-only-schema location extend type Cat @contact SchemaError: Directive @contact at line 1, column 17 is applied to OBJECT, but it's declared on SCHEMA. Directive @contact at line 1, column 17 is missing its required argument 'name'. +read-only-schema location extend type Cat @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 17 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 17 is missing its required argument 'url'. +read-only-schema kind extend type Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an object type. The extension is ignored. +read-only-schema kind extend interface Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an interface. The extension is ignored. +read-only-schema kind extend input Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an input object type. The extension is ignored. +read-only-schema kind extend enum Pet { COMPAT_Z } BUILT Type 'Pet' is defined as a union, but extended as an enum. The extension is ignored. +read-only-schema kind extend scalar Pet @specifiedBy(url: "https://example.com") BUILT Type 'Pet' is defined as a union, but extended as a scalar. The extension is ignored. +read-only-schema undeclared extend union Pet @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +read-only-schema repeat extend union Pet = Dog SchemaError: Type 'Pet' declares member 'Dog' more than once at line 1, column 20. +read-only-schema location extend union Pet @tag SchemaError: Directive @tag at line 1, column 18 is applied to UNION, but it's declared on FIELD_DEFINITION. Directive @tag at line 1, column 18 is missing its required argument 'name'. +read-only-schema location extend union Pet @contact SchemaError: Directive @contact at line 1, column 18 is applied to UNION, but it's declared on SCHEMA. Directive @contact at line 1, column 18 is missing its required argument 'name'. +read-only-schema location extend union Pet @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +recursive-inputs seed BUILT +recursive-inputs proxy FieldResolverError: Field 'Query.describe' resolves to graphql.kickstart.tools.compat.scenarios.RecursiveInputsQuery.describe, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.RecursiveInputsQuery, so every query of the field will fail. Field 'Query.names' resolves to graphql.kickstart.tools.compat.scenarios.RecursiveInputsQuery.names, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.RecursiveInputsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +recursive-inputs kind extend type LimitUnit { compatZ: String } BUILT Type 'LimitUnit' is defined as an enum, but extended as an object type. The extension is ignored. +recursive-inputs kind extend interface LimitUnit { compatZ: String } BUILT Type 'LimitUnit' is defined as an enum, but extended as an interface. The extension is ignored. +recursive-inputs kind extend input LimitUnit { compatZ: String } BUILT Type 'LimitUnit' is defined as an enum, but extended as an input object type. The extension is ignored. +recursive-inputs kind extend scalar LimitUnit @specifiedBy(url: "https://example.com") BUILT Type 'LimitUnit' is defined as an enum, but extended as a scalar. The extension is ignored. +recursive-inputs undeclared extend enum LimitUnit @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +recursive-inputs repeat extend enum LimitUnit { ITEMS } SchemaError: Type 'LimitUnit' declares value 'ITEMS' more than once at line 1, column 25. +recursive-inputs location extend enum LimitUnit @limit SchemaError: Directive @limit at line 1, column 23 is applied to ENUM, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION. Directive @limit at line 1, column 23 is missing its required argument 'range'. +recursive-inputs location extend enum LimitUnit @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 23 is applied to ENUM, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 23 is missing its required argument 'url'. +recursive-inputs kind extend type RangeInput { compatZ: String } BUILT Type 'RangeInput' is defined as an input object type, but extended as an object type. The extension is ignored. +recursive-inputs kind extend interface RangeInput { compatZ: String } BUILT Type 'RangeInput' is defined as an input object type, but extended as an interface. The extension is ignored. +recursive-inputs kind extend enum RangeInput { COMPAT_Z } BUILT Type 'RangeInput' is defined as an input object type, but extended as an enum. The extension is ignored. +recursive-inputs kind extend scalar RangeInput @specifiedBy(url: "https://example.com") BUILT Type 'RangeInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +recursive-inputs undeclared extend input RangeInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +recursive-inputs repeat extend input RangeInput { min: Int! } SchemaError: Type 'RangeInput' declares field 'min' more than once at line 1, column 27. +recursive-inputs location extend input RangeInput @limit SchemaError: Directive @limit at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION. Directive @limit at line 1, column 25 is missing its required argument 'range'. +recursive-inputs location extend input RangeInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +recursive-inputs kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +recursive-inputs kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +recursive-inputs kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +recursive-inputs kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +recursive-inputs undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +recursive-inputs repeat extend type Query { describe(filter: TreeFilter!): String! @limit(range: {min : 0, max : 5}, labels: ["a", "b"]) } SchemaError: Type 'Query' declares field 'describe' more than once at line 1, column 21. +recursive-inputs location extend type Query @limit SchemaError: Directive @limit at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION. Directive @limit at line 1, column 19 is missing its required argument 'range'. +recursive-inputs location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +recursive-inputs kind extend type TreeFilter { compatZ: String } BUILT Type 'TreeFilter' is defined as an input object type, but extended as an object type. The extension is ignored. +recursive-inputs kind extend interface TreeFilter { compatZ: String } BUILT Type 'TreeFilter' is defined as an input object type, but extended as an interface. The extension is ignored. +recursive-inputs kind extend enum TreeFilter { COMPAT_Z } BUILT Type 'TreeFilter' is defined as an input object type, but extended as an enum. The extension is ignored. +recursive-inputs kind extend scalar TreeFilter @specifiedBy(url: "https://example.com") BUILT Type 'TreeFilter' is defined as an input object type, but extended as a scalar. The extension is ignored. +recursive-inputs undeclared extend input TreeFilter @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +recursive-inputs repeat extend input TreeFilter { name: String } SchemaError: Type 'TreeFilter' declares field 'name' more than once at line 1, column 27. +recursive-inputs location extend input TreeFilter @limit SchemaError: Directive @limit at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION. Directive @limit at line 1, column 25 is missing its required argument 'range'. +recursive-inputs location extend input TreeFilter @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +recursive-inputs kind extend type ChildFilter { compatZ: String } BUILT Type 'ChildFilter' is defined as an input object type, but extended as an object type. The extension is ignored. +recursive-inputs kind extend interface ChildFilter { compatZ: String } BUILT Type 'ChildFilter' is defined as an input object type, but extended as an interface. The extension is ignored. +recursive-inputs kind extend enum ChildFilter { COMPAT_Z } BUILT Type 'ChildFilter' is defined as an input object type, but extended as an enum. The extension is ignored. +recursive-inputs kind extend scalar ChildFilter @specifiedBy(url: "https://example.com") BUILT Type 'ChildFilter' is defined as an input object type, but extended as a scalar. The extension is ignored. +recursive-inputs undeclared extend input ChildFilter @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +recursive-inputs repeat extend input ChildFilter { parent: TreeFilter } SchemaError: Type 'ChildFilter' declares field 'parent' more than once at line 1, column 28. +recursive-inputs location extend input ChildFilter @limit SchemaError: Directive @limit at line 1, column 26 is applied to INPUT_OBJECT, but it's declared on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION. Directive @limit at line 1, column 26 is missing its required argument 'range'. +recursive-inputs location extend input ChildFilter @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 26 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 26 is missing its required argument 'url'. +scalar-args seed BUILT +scalar-args proxy FieldResolverError: Field 'Query.tag' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.tag, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.tags' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.tags, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.id' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.id, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.nestedSets' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.nestedSets, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.nestedLists' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.nestedLists, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.tokenInput' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.tokenInput, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.markedTokens' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.markedTokens, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.optionalTypedToken' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.optionalTypedToken, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. Field 'Query.optionalIdToken' resolves to graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery.optionalIdToken, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarArgsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +scalar-args kind extend type Tag { compatZ: String } BUILT Type 'Tag' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-args kind extend interface Tag { compatZ: String } BUILT Type 'Tag' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-args kind extend input Tag { compatZ: String } BUILT Type 'Tag' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-args kind extend enum Tag { COMPAT_Z } BUILT Type 'Tag' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-args undeclared extend scalar Tag @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args argval extend scalar Tag @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar Tag @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar Tag @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args kind extend type Token { compatZ: String } BUILT Type 'Token' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-args kind extend interface Token { compatZ: String } BUILT Type 'Token' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-args kind extend input Token { compatZ: String } BUILT Type 'Token' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-args kind extend enum Token { COMPAT_Z } BUILT Type 'Token' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-args undeclared extend scalar Token @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args argval extend scalar Token @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar Token @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar Token @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args kind extend type TypedToken { compatZ: String } BUILT Type 'TypedToken' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-args kind extend interface TypedToken { compatZ: String } BUILT Type 'TypedToken' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-args kind extend input TypedToken { compatZ: String } BUILT Type 'TypedToken' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-args kind extend enum TypedToken { COMPAT_Z } BUILT Type 'TypedToken' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-args undeclared extend scalar TypedToken @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args argval extend scalar TypedToken @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar TypedToken @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar TypedToken @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args kind extend type WrappedToken { compatZ: String } BUILT Type 'WrappedToken' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-args kind extend interface WrappedToken { compatZ: String } BUILT Type 'WrappedToken' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-args kind extend input WrappedToken { compatZ: String } BUILT Type 'WrappedToken' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-args kind extend enum WrappedToken { COMPAT_Z } BUILT Type 'WrappedToken' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-args undeclared extend scalar WrappedToken @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args argval extend scalar WrappedToken @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar WrappedToken @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar WrappedToken @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args kind extend type IdToken { compatZ: String } BUILT Type 'IdToken' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-args kind extend interface IdToken { compatZ: String } BUILT Type 'IdToken' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-args kind extend input IdToken { compatZ: String } BUILT Type 'IdToken' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-args kind extend enum IdToken { COMPAT_Z } BUILT Type 'IdToken' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-args undeclared extend scalar IdToken @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args argval extend scalar IdToken @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar IdToken @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args argval extend scalar IdToken @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-args kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +scalar-args kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +scalar-args kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +scalar-args kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +scalar-args undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args repeat extend type Query { tag(tag: Tag!): String! } SchemaError: Type 'Query' declares field 'tag' more than once at line 1, column 21. +scalar-args location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +scalar-args kind extend type TokenInput { compatZ: String } BUILT Type 'TokenInput' is defined as an input object type, but extended as an object type. The extension is ignored. +scalar-args kind extend interface TokenInput { compatZ: String } BUILT Type 'TokenInput' is defined as an input object type, but extended as an interface. The extension is ignored. +scalar-args kind extend enum TokenInput { COMPAT_Z } BUILT Type 'TokenInput' is defined as an input object type, but extended as an enum. The extension is ignored. +scalar-args kind extend scalar TokenInput @specifiedBy(url: "https://example.com") BUILT Type 'TokenInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +scalar-args undeclared extend input TokenInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args repeat extend input TokenInput { token: Token } SchemaError: Type 'TokenInput' declares field 'token' more than once at line 1, column 27. +scalar-args location extend input TokenInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +scalar-args kind extend type MarkedTokensInput { compatZ: String } BUILT Type 'MarkedTokensInput' is defined as an input object type, but extended as an object type. The extension is ignored. +scalar-args kind extend interface MarkedTokensInput { compatZ: String } BUILT Type 'MarkedTokensInput' is defined as an input object type, but extended as an interface. The extension is ignored. +scalar-args kind extend enum MarkedTokensInput { COMPAT_Z } BUILT Type 'MarkedTokensInput' is defined as an input object type, but extended as an enum. The extension is ignored. +scalar-args kind extend scalar MarkedTokensInput @specifiedBy(url: "https://example.com") BUILT Type 'MarkedTokensInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +scalar-args undeclared extend input MarkedTokensInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-args repeat extend input MarkedTokensInput { typed: TypedToken } SchemaError: Type 'MarkedTokensInput' declares field 'typed' more than once at line 1, column 34. +scalar-args location extend input MarkedTokensInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 32 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 32 is missing its required argument 'url'. +scalar-directives seed BUILT +scalar-directives proxy FieldResolverError: Field 'Query.today' resolves to graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery.today, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery, so every query of the field will fail. Field 'Query.now' resolves to graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery.now, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery, so every query of the field will fail. Field 'Query.shift' resolves to graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery.shift, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery, so every query of the field will fail. Field 'Query.price' resolves to graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery.price, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ScalarDirectivesQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +scalar-directives kind extend type Date { compatZ: String } BUILT Type 'Date' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-directives kind extend interface Date { compatZ: String } BUILT Type 'Date' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-directives kind extend input Date { compatZ: String } BUILT Type 'Date' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-directives kind extend enum Date { COMPAT_Z } BUILT Type 'Date' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-directives undeclared extend scalar Date @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-directives argval extend scalar Date @since(date: 5) SchemaError: Directive @since at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Date @since(date: "x") SchemaError: Directive @since at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives repeat-directive extend scalar Date @since @since SchemaError: Directive @since at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Date @unit(name: 5) SchemaError: Directive @unit at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Date @unit(name: NOPE) SchemaError: Directive @unit at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Date @unit(name: null) SchemaError: Directive @unit at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Date @specifiedBy(url: 5) SchemaError: Directive @specifiedBy at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Date @specifiedBy(url: NOPE) SchemaError: Directive @specifiedBy at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Date @specifiedBy(url: null) SchemaError: Directive @specifiedBy at line 1, column 20 isn't repeatable but is applied more than once. +scalar-directives kind extend type DateTime { compatZ: String } BUILT Type 'DateTime' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-directives kind extend interface DateTime { compatZ: String } BUILT Type 'DateTime' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-directives kind extend input DateTime { compatZ: String } BUILT Type 'DateTime' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-directives kind extend enum DateTime { COMPAT_Z } BUILT Type 'DateTime' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-directives undeclared extend scalar DateTime @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-directives argval extend scalar DateTime @since(date: 5) InvalidSchemaException: invalid schema: Invalid argument 'date' for applied directive of name 'since' +scalar-directives argval extend scalar DateTime @since(date: "x") BUILT +scalar-directives repeat-directive extend scalar DateTime @since @since SchemaError: Directive @since at line 1, column 31 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar DateTime @unit(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'unit' +scalar-directives argval extend scalar DateTime @unit(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'unit' +scalar-directives argval extend scalar DateTime @unit(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'unit' +scalar-directives argval extend scalar DateTime @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-directives argval extend scalar DateTime @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-directives argval extend scalar DateTime @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-directives kind extend type Money { compatZ: String } BUILT Type 'Money' is defined as a scalar, but extended as an object type. The extension is ignored. +scalar-directives kind extend interface Money { compatZ: String } BUILT Type 'Money' is defined as a scalar, but extended as an interface. The extension is ignored. +scalar-directives kind extend input Money { compatZ: String } BUILT Type 'Money' is defined as a scalar, but extended as an input object type. The extension is ignored. +scalar-directives kind extend enum Money { COMPAT_Z } BUILT Type 'Money' is defined as a scalar, but extended as an enum. The extension is ignored. +scalar-directives undeclared extend scalar Money @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-directives argval extend scalar Money @since(date: 5) InvalidSchemaException: invalid schema: Invalid argument 'date' for applied directive of name 'since' +scalar-directives argval extend scalar Money @since(date: "x") BUILT +scalar-directives repeat-directive extend scalar Money @since @since SchemaError: Directive @since at line 1, column 28 isn't repeatable but is applied more than once. +scalar-directives argval extend scalar Money @unit(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'unit' +scalar-directives argval extend scalar Money @unit(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'unit' +scalar-directives argval extend scalar Money @unit(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'unit' +scalar-directives argval extend scalar Money @specifiedBy(url: 5) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-directives argval extend scalar Money @specifiedBy(url: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-directives argval extend scalar Money @specifiedBy(url: null) InvalidSchemaException: invalid schema: Invalid argument 'url' for applied directive of name 'specifiedBy' +scalar-directives kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +scalar-directives kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +scalar-directives kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +scalar-directives kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +scalar-directives undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +scalar-directives repeat extend type Query { today: Date @since(date: "2021-01-01") } SchemaError: Type 'Query' declares field 'today' more than once at line 1, column 21. +scalar-directives location extend type Query @since SchemaError: Directive @since at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR | FIELD_DEFINITION. +scalar-directives location extend type Query @unit SchemaError: Directive @unit at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @unit at line 1, column 19 is missing its required argument 'name'. +scalar-directives location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +sourceless seed BUILT +sourceless proxy FieldResolverError: Field 'Query.folder' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessQuery.folder, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessQuery, so every query of the field will fail. Field 'Folder.images' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessFolderResolver.images, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessFolderResolver, so every query of the field will fail. Field 'Image.imageBlob' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver.imageBlob, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver, so every query of the field will fail. Field 'Image.thumbnail' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver.thumbnail, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver, so every query of the field will fail. Field 'Image.owner' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver.owner, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver, so every query of the field will fail. Field 'Image.locale' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver.locale, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver, so every query of the field will fail. Field 'Image.signature' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver.signature, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver, so every query of the field will fail. Field 'Image.caption' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver.caption, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessImageResolver, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +sourceless kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless kind extend union Query = Folder BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +sourceless kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +sourceless repeat extend type Query { folder: Folder! } SchemaError: Type 'Query' declares field 'folder' more than once at line 1, column 21. +sourceless location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +sourceless kind extend interface Folder { compatZ: String } BUILT Type 'Folder' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless kind extend input Folder { compatZ: String } BUILT Type 'Folder' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless kind extend enum Folder { COMPAT_Z } BUILT Type 'Folder' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless kind extend union Folder = Image BUILT Type 'Folder' is defined as an object type, but extended as a union. The extension is ignored. +sourceless kind extend scalar Folder @specifiedBy(url: "https://example.com") BUILT Type 'Folder' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless undeclared extend type Folder @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +sourceless repeat extend type Folder { supportedFileTypes: [String!]! } SchemaError: Type 'Folder' declares field 'supportedFileTypes' more than once at line 1, column 22. +sourceless location extend type Folder @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. +sourceless kind extend interface Image { compatZ: String } BUILT Type 'Image' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless kind extend input Image { compatZ: String } BUILT Type 'Image' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless kind extend enum Image { COMPAT_Z } BUILT Type 'Image' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless kind extend union Image = Folder BUILT Type 'Image' is defined as an object type, but extended as a union. The extension is ignored. +sourceless kind extend scalar Image @specifiedBy(url: "https://example.com") BUILT Type 'Image' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless undeclared extend type Image @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +sourceless repeat extend type Image { name: String! } SchemaError: Type 'Image' declares field 'name' more than once at line 1, column 21. +sourceless location extend type Image @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +sourceless-misbound seed FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound proxy FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound kind extend interface Query { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-misbound kind extend input Query { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-misbound kind extend enum Query { COMPAT_Z } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-misbound kind extend union Query = Folder FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-misbound kind extend scalar Query @specifiedBy(url: "https://example.com") FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-misbound undeclared extend type Query @compatUndeclared FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound repeat extend type Query { folder: Folder! } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound location extend type Query @specifiedBy FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound kind extend interface Folder { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Folder' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-misbound kind extend input Folder { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Folder' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-misbound kind extend enum Folder { COMPAT_Z } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Folder' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-misbound kind extend union Folder = Image FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Folder' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-misbound kind extend scalar Folder @specifiedBy(url: "https://example.com") FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Folder' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-misbound undeclared extend type Folder @compatUndeclared FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound repeat extend type Folder { images: [Image!]! } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound location extend type Folder @specifiedBy FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound kind extend interface Image { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Image' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-misbound kind extend input Image { compatZ: String } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Image' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-misbound kind extend enum Image { COMPAT_Z } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Image' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-misbound kind extend union Image = Folder FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Image' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-misbound kind extend scalar Image @specifiedBy(url: "https://example.com") FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) Type 'Image' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-misbound undeclared extend type Image @compatUndeclared FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound repeat extend type Image { name: String! } FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-misbound location extend type Image @specifiedBy FieldResolverError: No method found as defined in schema compat/scenarios/sourceless-misbound/schema.graphqls:11 with any of the following signatures (optionally followed by any of [interface graphql.schema.DataFetchingEnvironment, class graphql.GraphQLContext]), in priority order: graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(graphql.kickstart.tools.compat.scenarios.SourcelessImage, ~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.thumbnail(~size) graphql.kickstart.tools.compat.scenarios.SourcelessImage.getThumbnail(~size) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.thumbnail(~size, ) graphql.kickstart.tools.compat.scenarios.MisboundImageResolver.getThumbnail(~size, ) +sourceless-shadowed seed BUILT +sourceless-shadowed proxy FieldResolverError: Field 'Query.folder' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessQuery.folder, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessQuery, so every query of the field will fail. Field 'Folder.images' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessFolderResolver.images, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessFolderResolver, so every query of the field will fail. Field 'Image.title' resolves to graphql.kickstart.tools.compat.scenarios.ShadowedImageResolver.title, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.ShadowedImageResolver, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +sourceless-shadowed kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-shadowed kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-shadowed kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-shadowed kind extend union Query = Folder BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-shadowed kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-shadowed undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +sourceless-shadowed repeat extend type Query { folder: Folder! } SchemaError: Type 'Query' declares field 'folder' more than once at line 1, column 21. +sourceless-shadowed location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +sourceless-shadowed kind extend interface Folder { compatZ: String } BUILT Type 'Folder' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-shadowed kind extend input Folder { compatZ: String } BUILT Type 'Folder' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-shadowed kind extend enum Folder { COMPAT_Z } BUILT Type 'Folder' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-shadowed kind extend union Folder = Image BUILT Type 'Folder' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-shadowed kind extend scalar Folder @specifiedBy(url: "https://example.com") BUILT Type 'Folder' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-shadowed undeclared extend type Folder @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +sourceless-shadowed repeat extend type Folder { images: [Image!]! } SchemaError: Type 'Folder' declares field 'images' more than once at line 1, column 22. +sourceless-shadowed location extend type Folder @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. +sourceless-shadowed kind extend interface Image { compatZ: String } BUILT Type 'Image' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-shadowed kind extend input Image { compatZ: String } BUILT Type 'Image' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-shadowed kind extend enum Image { COMPAT_Z } BUILT Type 'Image' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-shadowed kind extend union Image = Folder BUILT Type 'Image' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-shadowed kind extend scalar Image @specifiedBy(url: "https://example.com") BUILT Type 'Image' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-shadowed undeclared extend type Image @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +sourceless-shadowed repeat extend type Image { name: String! } SchemaError: Type 'Image' declares field 'name' more than once at line 1, column 21. +sourceless-shadowed location extend type Image @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +sourceless-unimplemented seed BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented proxy FieldResolverError: Field 'Query.folder' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessQuery.folder, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessQuery, so every query of the field will fail. Field 'Folder.images' resolves to graphql.kickstart.tools.compat.scenarios.SourcelessFolderResolver.images, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.SourcelessFolderResolver, so every query of the field will fail. Field 'Image.imageBlob' resolves to graphql.kickstart.tools.compat.scenarios.HelperImageResolver.imageBlob, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.HelperImageResolver, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented kind extend interface Query { compatZ: String } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-unimplemented kind extend input Query { compatZ: String } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-unimplemented kind extend enum Query { COMPAT_Z } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-unimplemented kind extend union Query = Folder BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-unimplemented kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-unimplemented undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented repeat extend type Query { folder: Folder! } SchemaError: Type 'Query' declares field 'folder' more than once at line 1, column 21. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented kind extend interface Folder { compatZ: String } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Folder' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-unimplemented kind extend input Folder { compatZ: String } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Folder' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-unimplemented kind extend enum Folder { COMPAT_Z } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Folder' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-unimplemented kind extend union Folder = Image BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Folder' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-unimplemented kind extend scalar Folder @specifiedBy(url: "https://example.com") BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Folder' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-unimplemented undeclared extend type Folder @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented repeat extend type Folder { images: [Image!]! } SchemaError: Type 'Folder' declares field 'images' more than once at line 1, column 22. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented location extend type Folder @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented kind extend interface Image { compatZ: String } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Image' is defined as an object type, but extended as an interface. The extension is ignored. +sourceless-unimplemented kind extend input Image { compatZ: String } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Image' is defined as an object type, but extended as an input object type. The extension is ignored. +sourceless-unimplemented kind extend enum Image { COMPAT_Z } BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Image' is defined as an object type, but extended as an enum. The extension is ignored. +sourceless-unimplemented kind extend union Image = Folder BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Image' is defined as an object type, but extended as a union. The extension is ignored. +sourceless-unimplemented kind extend scalar Image @specifiedBy(url: "https://example.com") BUILT Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. Type 'Image' is defined as an object type, but extended as a scalar. The extension is ignored. +sourceless-unimplemented undeclared extend type Image @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented repeat extend type Image { name: String! } SchemaError: Type 'Image' declares field 'name' more than once at line 1, column 21. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +sourceless-unimplemented location extend type Image @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. Missing resolver for field: FieldDefinition{name='preview', type=TypeName{name='String'}, inputValueDefinitions=[], directives=[]} Option 'allowUnimplementedResolvers' should only be set to true during development, as it can cause schema errors to be moved to query time instead of schema creation time. Make sure this is turned off in production. +type-extensions seed BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions proxy FieldResolverError: Field 'Query.node' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery.node, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery, so every query of the field will fail. Field 'Query.search' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery.search, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery, so every query of the field will fail. Field 'Query.colors' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery.colors, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery, so every query of the field will fail. Field 'Query.shades' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery.shades, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery, so every query of the field will fail. Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend interface Query { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions kind extend input Query { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions kind extend enum Query { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions kind extend union Query = Article BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend type Query { node(id: ID!): Node } SchemaError: Type 'Query' declares field 'node' more than once at line 1, column 21. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Query @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Query @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Query @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Query @owner(team: 5) InvalidSchemaException: invalid schema: Invalid argument 'team' for applied directive of name 'owner' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Query @owner(team: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'team' for applied directive of name 'owner' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Query @owner(team: null) InvalidSchemaException: invalid schema: Invalid argument 'team' for applied directive of name 'owner' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend type Node { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Node' is defined as an interface, but extended as an object type. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend input Node { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Node' is defined as an interface, but extended as an input object type. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend enum Node { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Node' is defined as an interface, but extended as an enum. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend union Node = Article BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Node' is defined as an interface, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend scalar Node @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Node' is defined as an interface, but extended as a scalar. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions undeclared extend interface Node @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend interface Node { "The base id" id: ID! } SchemaError: Type 'Node' declares field 'id' more than once at line 1, column 25. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend interface Node @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend interface Node @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend interface Node @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend interface Node @owner SchemaError: Directive @owner at line 1, column 23 is applied to INTERFACE, but it's declared on OBJECT. Directive @owner at line 1, column 23 is missing its required argument 'team'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend interface Node @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 23 is applied to INTERFACE, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 23 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend interface Article { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Article' is defined as an object type, but extended as an interface. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend input Article { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Article' is defined as an object type, but extended as an input object type. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend enum Article { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Article' is defined as an object type, but extended as an enum. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend union Article = Video BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Article' is defined as an object type, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend scalar Article @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Article' is defined as an object type, but extended as a scalar. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions undeclared extend type Article @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend type Article { id: ID! } SchemaError: Type 'Article' declares field 'id' more than once at line 1, column 23. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Article @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Article @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Article @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Article @owner(team: 5) SchemaError: Directive @owner at line 1, column 21 isn't repeatable but is applied more than once. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Article @owner(team: NOPE) SchemaError: Directive @owner at line 1, column 21 isn't repeatable but is applied more than once. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Article @owner(team: null) SchemaError: Directive @owner at line 1, column 21 isn't repeatable but is applied more than once. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend type Article @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend interface Video { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Video' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions kind extend input Video { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Video' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions kind extend enum Video { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Video' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions kind extend union Video = Article BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Video' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend scalar Video @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Video' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions undeclared extend type Video @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend type Video { id: ID! } SchemaError: Type 'Video' declares field 'id' more than once at line 1, column 21. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Video @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Video @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Video @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Video @owner(team: 5) InvalidSchemaException: invalid schema: Invalid argument 'team' for applied directive of name 'owner' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Video @owner(team: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'team' for applied directive of name 'owner' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Video @owner(team: null) InvalidSchemaException: invalid schema: Invalid argument 'team' for applied directive of name 'owner' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend type Video @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend type SearchResult { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'SearchResult' is defined as a union, but extended as an object type. The extension is ignored. +type-extensions kind extend interface SearchResult { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'SearchResult' is defined as a union, but extended as an interface. The extension is ignored. +type-extensions kind extend input SearchResult { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'SearchResult' is defined as a union, but extended as an input object type. The extension is ignored. +type-extensions kind extend enum SearchResult { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'SearchResult' is defined as a union, but extended as an enum. The extension is ignored. +type-extensions kind extend scalar SearchResult @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'SearchResult' is defined as a union, but extended as a scalar. The extension is ignored. +type-extensions undeclared extend union SearchResult @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend union SearchResult = Article SchemaError: Type 'SearchResult' declares member 'Article' more than once at line 1, column 29. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend union SearchResult @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend union SearchResult @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend union SearchResult @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend union SearchResult @owner SchemaError: Directive @owner at line 1, column 27 is applied to UNION, but it's declared on OBJECT. Directive @owner at line 1, column 27 is missing its required argument 'team'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend union SearchResult @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 27 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 27 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend type Color { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Color' is defined as an enum, but extended as an object type. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend interface Color { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Color' is defined as an enum, but extended as an interface. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend input Color { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Color' is defined as an enum, but extended as an input object type. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend union Color = Article BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Color' is defined as an enum, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend scalar Color @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Color' is defined as an enum, but extended as a scalar. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions undeclared extend enum Color @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend enum Color { RED } SchemaError: Type 'Color' declares value 'RED' more than once at line 1, column 21. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend enum Color @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend enum Color @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend enum Color @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend enum Color @owner SchemaError: Directive @owner at line 1, column 19 is applied to ENUM, but it's declared on OBJECT. Directive @owner at line 1, column 19 is missing its required argument 'team'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend enum Color @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to ENUM, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend type Filter { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Filter' is defined as an input object type, but extended as an object type. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend interface Filter { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Filter' is defined as an input object type, but extended as an interface. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend enum Filter { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Filter' is defined as an input object type, but extended as an enum. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend union Filter = Article BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Filter' is defined as an input object type, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend scalar Filter @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Filter' is defined as an input object type, but extended as a scalar. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions undeclared extend input Filter @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend input Filter { term: String } SchemaError: Type 'Filter' declares field 'term' more than once at line 1, column 23. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend input Filter @tag(name: 5) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend input Filter @tag(name: NOPE) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend input Filter @tag(name: null) InvalidSchemaException: invalid schema: Invalid argument 'name' for applied directive of name 'tag' Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend input Filter @owner SchemaError: Directive @owner at line 1, column 21 is applied to INPUT_OBJECT, but it's declared on OBJECT. Directive @owner at line 1, column 21 is missing its required argument 'team'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend input Filter @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend interface Note { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions kind extend input Note { compatZ: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions kind extend enum Note { COMPAT_Z } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions kind extend union Note = Article BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions kind extend scalar Note @specifiedBy(url: "https://example.com") BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a scalar. The extension is ignored. Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions undeclared extend type Note @compatUndeclared BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions repeat extend type Note { text: String } BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Note @tag(name: 5) BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Note @tag(name: NOPE) BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Note @tag(name: null) BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Note @owner(team: 5) BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Note @owner(team: NOPE) BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions argval extend type Note @owner(team: null) BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions location extend type Note @specifiedBy BUILT Schema type was defined but can never be accessed, and can be safely deleted: Note Type 'Note' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-input-order seed BUILT +type-extensions-input-order proxy FieldResolverError: Field 'Query.count' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsInputOrderQuery.count, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsInputOrderQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +type-extensions-input-order kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-input-order kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-input-order kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-input-order kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-input-order undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-input-order repeat extend type Query { count(filter: Filter): Int! } SchemaError: Type 'Query' declares field 'count' more than once at line 1, column 21. +type-extensions-input-order location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +type-extensions-input-order kind extend type Filter { compatZ: String } BUILT Type 'Filter' is defined as an input object type, but extended as an object type. The extension is ignored. +type-extensions-input-order kind extend interface Filter { compatZ: String } BUILT Type 'Filter' is defined as an input object type, but extended as an interface. The extension is ignored. +type-extensions-input-order kind extend enum Filter { COMPAT_Z } BUILT Type 'Filter' is defined as an input object type, but extended as an enum. The extension is ignored. +type-extensions-input-order kind extend scalar Filter @specifiedBy(url: "https://example.com") BUILT Type 'Filter' is defined as an input object type, but extended as a scalar. The extension is ignored. +type-extensions-input-order undeclared extend input Filter @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-input-order repeat extend input Filter { term: String } SchemaError: Type 'Filter' declares field 'term' more than once at line 1, column 23. +type-extensions-input-order location extend input Filter @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 21 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 21 is missing its required argument 'url'. +type-extensions-repeated-fields seed SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields proxy FieldResolverError: Field 'Query.typeAndExtension' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery.typeAndExtension, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery, so every query of the field will fail. Field 'Query.twoExtensions' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery.twoExtensions, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery, so every query of the field will fail. Field 'Query.oneDefinition' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery.oneDefinition, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery, so every query of the field will fail. Field 'Query.echo' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery.echo, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsRepeatedFieldsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +type-extensions-repeated-fields kind extend interface Query { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-repeated-fields kind extend input Query { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-repeated-fields kind extend enum Query { COMPAT_Z } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-repeated-fields kind extend union Query = TypeAndExtension SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-repeated-fields kind extend scalar Query @specifiedBy(url: "https://example.com") SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-repeated-fields undeclared extend type Query @compatUndeclared SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields repeat extend type Query { typeAndExtension: TypeAndExtension } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields location extend type Query @specifiedBy SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields kind extend interface TypeAndExtension { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TypeAndExtension' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-repeated-fields kind extend input TypeAndExtension { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TypeAndExtension' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-repeated-fields kind extend enum TypeAndExtension { COMPAT_Z } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TypeAndExtension' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-repeated-fields kind extend union TypeAndExtension = TwoExtensions SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TypeAndExtension' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-repeated-fields kind extend scalar TypeAndExtension @specifiedBy(url: "https://example.com") SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TypeAndExtension' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-repeated-fields undeclared extend type TypeAndExtension @compatUndeclared SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields repeat extend type TypeAndExtension { "From the type" name: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields location extend type TypeAndExtension @specifiedBy SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields kind extend interface TwoExtensions { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TwoExtensions' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-repeated-fields kind extend input TwoExtensions { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TwoExtensions' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-repeated-fields kind extend enum TwoExtensions { COMPAT_Z } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TwoExtensions' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-repeated-fields kind extend union TwoExtensions = TypeAndExtension SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TwoExtensions' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-repeated-fields kind extend scalar TwoExtensions @specifiedBy(url: "https://example.com") SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'TwoExtensions' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-repeated-fields undeclared extend type TwoExtensions @compatUndeclared SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields repeat extend type TwoExtensions { id: ID } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields location extend type TwoExtensions @specifiedBy SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields kind extend interface OneDefinition { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'OneDefinition' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-repeated-fields kind extend input OneDefinition { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'OneDefinition' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-repeated-fields kind extend enum OneDefinition { COMPAT_Z } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'OneDefinition' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-repeated-fields kind extend union OneDefinition = TypeAndExtension SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'OneDefinition' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-repeated-fields kind extend scalar OneDefinition @specifiedBy(url: "https://example.com") SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'OneDefinition' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-repeated-fields undeclared extend type OneDefinition @compatUndeclared SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields repeat extend type OneDefinition { "The first" name: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields location extend type OneDefinition @specifiedBy SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields kind extend type InputTypeAndExtension { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTypeAndExtension' is defined as an input object type, but extended as an object type. The extension is ignored. +type-extensions-repeated-fields kind extend interface InputTypeAndExtension { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTypeAndExtension' is defined as an input object type, but extended as an interface. The extension is ignored. +type-extensions-repeated-fields kind extend enum InputTypeAndExtension { COMPAT_Z } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTypeAndExtension' is defined as an input object type, but extended as an enum. The extension is ignored. +type-extensions-repeated-fields kind extend union InputTypeAndExtension = TypeAndExtension SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTypeAndExtension' is defined as an input object type, but extended as a union. The extension is ignored. +type-extensions-repeated-fields kind extend scalar InputTypeAndExtension @specifiedBy(url: "https://example.com") SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTypeAndExtension' is defined as an input object type, but extended as a scalar. The extension is ignored. +type-extensions-repeated-fields undeclared extend input InputTypeAndExtension @compatUndeclared SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields repeat extend input InputTypeAndExtension { "From the type" id: ID } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields location extend input InputTypeAndExtension @specifiedBy SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields kind extend type InputTwoExtensions { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTwoExtensions' is defined as an input object type, but extended as an object type. The extension is ignored. +type-extensions-repeated-fields kind extend interface InputTwoExtensions { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTwoExtensions' is defined as an input object type, but extended as an interface. The extension is ignored. +type-extensions-repeated-fields kind extend enum InputTwoExtensions { COMPAT_Z } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTwoExtensions' is defined as an input object type, but extended as an enum. The extension is ignored. +type-extensions-repeated-fields kind extend union InputTwoExtensions = TypeAndExtension SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTwoExtensions' is defined as an input object type, but extended as a union. The extension is ignored. +type-extensions-repeated-fields kind extend scalar InputTwoExtensions @specifiedBy(url: "https://example.com") SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputTwoExtensions' is defined as an input object type, but extended as a scalar. The extension is ignored. +type-extensions-repeated-fields undeclared extend input InputTwoExtensions @compatUndeclared SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields repeat extend input InputTwoExtensions { term: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields location extend input InputTwoExtensions @specifiedBy SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields kind extend type InputOneDefinition { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputOneDefinition' is defined as an input object type, but extended as an object type. The extension is ignored. +type-extensions-repeated-fields kind extend interface InputOneDefinition { compatZ: String } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputOneDefinition' is defined as an input object type, but extended as an interface. The extension is ignored. +type-extensions-repeated-fields kind extend enum InputOneDefinition { COMPAT_Z } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputOneDefinition' is defined as an input object type, but extended as an enum. The extension is ignored. +type-extensions-repeated-fields kind extend union InputOneDefinition = TypeAndExtension SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputOneDefinition' is defined as an input object type, but extended as a union. The extension is ignored. +type-extensions-repeated-fields kind extend scalar InputOneDefinition @specifiedBy(url: "https://example.com") SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. Type 'InputOneDefinition' is defined as an input object type, but extended as a scalar. The extension is ignored. +type-extensions-repeated-fields undeclared extend input InputOneDefinition @compatUndeclared SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields repeat extend input InputOneDefinition { "The first" id: ID } SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-repeated-fields location extend input InputOneDefinition @specifiedBy SchemaError: Type 'InputTypeAndExtension' declares field 'id' more than once at line 49, column 5 in compat/scenarios/type-extensions-repeated-fields/schema.graphqls. +type-extensions-sealed seed BUILT +type-extensions-sealed proxy FieldResolverError: Field 'Query.pets' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsSealedQuery.pets, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsSealedQuery, so every query of the field will fail. Field 'Query.animals' resolves to graphql.kickstart.tools.compat.scenarios.TypeExtensionsSealedQuery.animals, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.TypeExtensionsSealedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +type-extensions-sealed kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-sealed kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-sealed kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-sealed kind extend union Query = Dog BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-sealed kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-sealed undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-sealed repeat extend type Query { pets: [Pet!]! } SchemaError: Type 'Query' declares field 'pets' more than once at line 1, column 21. +type-extensions-sealed location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +type-extensions-sealed kind extend type Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an object type. The extension is ignored. +type-extensions-sealed kind extend interface Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an interface. The extension is ignored. +type-extensions-sealed kind extend input Pet { compatZ: String } BUILT Type 'Pet' is defined as a union, but extended as an input object type. The extension is ignored. +type-extensions-sealed kind extend enum Pet { COMPAT_Z } BUILT Type 'Pet' is defined as a union, but extended as an enum. The extension is ignored. +type-extensions-sealed kind extend scalar Pet @specifiedBy(url: "https://example.com") BUILT Type 'Pet' is defined as a union, but extended as a scalar. The extension is ignored. +type-extensions-sealed undeclared extend union Pet @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-sealed repeat extend union Pet = Dog SchemaError: Type 'Pet' declares member 'Dog' more than once at line 1, column 20. +type-extensions-sealed location extend union Pet @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 18 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 18 is missing its required argument 'url'. +type-extensions-sealed kind extend interface Dog { compatZ: String } BUILT Type 'Dog' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-sealed kind extend input Dog { compatZ: String } BUILT Type 'Dog' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-sealed kind extend enum Dog { COMPAT_Z } BUILT Type 'Dog' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-sealed kind extend union Dog = Cat BUILT Type 'Dog' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-sealed kind extend scalar Dog @specifiedBy(url: "https://example.com") BUILT Type 'Dog' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-sealed undeclared extend type Dog @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-sealed repeat extend type Dog { name: String } SchemaError: Type 'Dog' declares field 'name' more than once at line 1, column 19. +type-extensions-sealed location extend type Dog @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 17 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 17 is missing its required argument 'url'. +type-extensions-sealed kind extend interface Cat { compatZ: String } BUILT Type 'Cat' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-sealed kind extend input Cat { compatZ: String } BUILT Type 'Cat' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-sealed kind extend enum Cat { COMPAT_Z } BUILT Type 'Cat' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-sealed kind extend union Cat = Dog BUILT Type 'Cat' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-sealed kind extend scalar Cat @specifiedBy(url: "https://example.com") BUILT Type 'Cat' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-sealed undeclared extend type Cat @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-sealed repeat extend type Cat { lives: Int } SchemaError: Type 'Cat' declares field 'lives' more than once at line 1, column 19. +type-extensions-sealed location extend type Cat @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 17 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 17 is missing its required argument 'url'. +type-extensions-sealed kind extend type Animal { compatZ: String } BUILT Type 'Animal' is defined as an interface, but extended as an object type. The extension is ignored. +type-extensions-sealed kind extend input Animal { compatZ: String } BUILT Type 'Animal' is defined as an interface, but extended as an input object type. The extension is ignored. +type-extensions-sealed kind extend enum Animal { COMPAT_Z } BUILT Type 'Animal' is defined as an interface, but extended as an enum. The extension is ignored. +type-extensions-sealed kind extend union Animal = Dog BUILT Type 'Animal' is defined as an interface, but extended as a union. The extension is ignored. +type-extensions-sealed kind extend scalar Animal @specifiedBy(url: "https://example.com") BUILT Type 'Animal' is defined as an interface, but extended as a scalar. The extension is ignored. +type-extensions-sealed undeclared extend interface Animal @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-sealed repeat extend interface Animal { name: String } SchemaError: Type 'Animal' declares field 'name' more than once at line 1, column 27. +type-extensions-sealed location extend interface Animal @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INTERFACE, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +type-extensions-sealed kind extend interface Cow { compatZ: String } BUILT Type 'Cow' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-sealed kind extend input Cow { compatZ: String } BUILT Type 'Cow' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-sealed kind extend enum Cow { COMPAT_Z } BUILT Type 'Cow' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-sealed kind extend union Cow = Dog BUILT Type 'Cow' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-sealed kind extend scalar Cow @specifiedBy(url: "https://example.com") BUILT Type 'Cow' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-sealed undeclared extend type Cow @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-sealed repeat extend type Cow { name: String } SchemaError: Type 'Cow' declares field 'name' more than once at line 1, column 19. +type-extensions-sealed location extend type Cow @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 17 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 17 is missing its required argument 'url'. +type-extensions-sealed kind extend interface Horse { compatZ: String } BUILT Type 'Horse' is defined as an object type, but extended as an interface. The extension is ignored. +type-extensions-sealed kind extend input Horse { compatZ: String } BUILT Type 'Horse' is defined as an object type, but extended as an input object type. The extension is ignored. +type-extensions-sealed kind extend enum Horse { COMPAT_Z } BUILT Type 'Horse' is defined as an object type, but extended as an enum. The extension is ignored. +type-extensions-sealed kind extend union Horse = Dog BUILT Type 'Horse' is defined as an object type, but extended as a union. The extension is ignored. +type-extensions-sealed kind extend scalar Horse @specifiedBy(url: "https://example.com") BUILT Type 'Horse' is defined as an object type, but extended as a scalar. The extension is ignored. +type-extensions-sealed undeclared extend type Horse @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +type-extensions-sealed repeat extend type Horse { name: String } SchemaError: Type 'Horse' declares field 'name' more than once at line 1, column 21. +type-extensions-sealed location extend type Horse @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +unmapped-inputs seed BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. +unmapped-inputs proxy FieldResolverError: Field 'Query.ignored' resolves to graphql.kickstart.tools.compat.scenarios.UnmappedInputsQuery.ignored, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.UnmappedInputsQuery, so every query of the field will fail. Field 'Query.typo' resolves to graphql.kickstart.tools.compat.scenarios.UnmappedInputsQuery.typo, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.UnmappedInputsQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +unmapped-inputs kind extend interface Query { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +unmapped-inputs kind extend input Query { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +unmapped-inputs kind extend enum Query { COMPAT_Z } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +unmapped-inputs kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +unmapped-inputs undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +unmapped-inputs repeat extend type Query { ignored(input: IgnoredInput!): String } SchemaError: Type 'Query' declares field 'ignored' more than once at line 1, column 21. +unmapped-inputs location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +unmapped-inputs kind extend type IgnoredInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'IgnoredInput' is defined as an input object type, but extended as an object type. The extension is ignored. +unmapped-inputs kind extend interface IgnoredInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'IgnoredInput' is defined as an input object type, but extended as an interface. The extension is ignored. +unmapped-inputs kind extend enum IgnoredInput { COMPAT_Z } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'IgnoredInput' is defined as an input object type, but extended as an enum. The extension is ignored. +unmapped-inputs kind extend scalar IgnoredInput @specifiedBy(url: "https://example.com") BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'IgnoredInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +unmapped-inputs undeclared extend input IgnoredInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +unmapped-inputs repeat extend input IgnoredInput { inner: InnerInput } SchemaError: Type 'IgnoredInput' declares field 'inner' more than once at line 1, column 29. +unmapped-inputs location extend input IgnoredInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 27 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 27 is missing its required argument 'url'. +unmapped-inputs kind extend type InnerInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'InnerInput' is defined as an input object type, but extended as an object type. The extension is ignored. +unmapped-inputs kind extend interface InnerInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'InnerInput' is defined as an input object type, but extended as an interface. The extension is ignored. +unmapped-inputs kind extend enum InnerInput { COMPAT_Z } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'InnerInput' is defined as an input object type, but extended as an enum. The extension is ignored. +unmapped-inputs kind extend scalar InnerInput @specifiedBy(url: "https://example.com") BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'InnerInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +unmapped-inputs undeclared extend input InnerInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +unmapped-inputs repeat extend input InnerInput { name: String } SchemaError: Type 'InnerInput' declares field 'name' more than once at line 1, column 27. +unmapped-inputs location extend input InnerInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +unmapped-inputs kind extend type TypoInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'TypoInput' is defined as an input object type, but extended as an object type. The extension is ignored. +unmapped-inputs kind extend interface TypoInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'TypoInput' is defined as an input object type, but extended as an interface. The extension is ignored. +unmapped-inputs kind extend enum TypoInput { COMPAT_Z } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'TypoInput' is defined as an input object type, but extended as an enum. The extension is ignored. +unmapped-inputs kind extend scalar TypoInput @specifiedBy(url: "https://example.com") BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'TypoInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +unmapped-inputs undeclared extend input TypoInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +unmapped-inputs repeat extend input TypoInput { item: ItemInput } SchemaError: Type 'TypoInput' declares field 'item' more than once at line 1, column 26. +unmapped-inputs location extend input TypoInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 24 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 24 is missing its required argument 'url'. +unmapped-inputs kind extend type ItemInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'ItemInput' is defined as an input object type, but extended as an object type. The extension is ignored. +unmapped-inputs kind extend interface ItemInput { compatZ: String } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'ItemInput' is defined as an input object type, but extended as an interface. The extension is ignored. +unmapped-inputs kind extend enum ItemInput { COMPAT_Z } BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'ItemInput' is defined as an input object type, but extended as an enum. The extension is ignored. +unmapped-inputs kind extend scalar ItemInput @specifiedBy(url: "https://example.com") BUILT Input field 'ItemInput.name' has no matching property in graphql.kickstart.tools.compat.scenarios.ItemInput. Converting argument 'input' of field 'Query.typo' fails whenever the field is sent. Known properties: nmae. Rename the property or map it with @JsonProperty("name"). If it's left unmapped on purpose, list it in @JsonIgnoreProperties on the class. Type 'ItemInput' is defined as an input object type, but extended as a scalar. The extension is ignored. +unmapped-inputs undeclared extend input ItemInput @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +unmapped-inputs repeat extend input ItemInput { name: String } SchemaError: Type 'ItemInput' declares field 'name' more than once at line 1, column 26. +unmapped-inputs location extend input ItemInput @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 24 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 24 is missing its required argument 'url'. +wiring-shapes seed BUILT +wiring-shapes proxy FieldResolverError: Field 'Query.trees' resolves to graphql.kickstart.tools.compat.scenarios.WiringShapesQuery.trees, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.WiringShapesQuery, so every query of the field will fail. Field 'Query.person' resolves to graphql.kickstart.tools.compat.scenarios.WiringShapesQuery.person, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.WiringShapesQuery, so every query of the field will fail. Field 'Query.someone' resolves to graphql.kickstart.tools.compat.scenarios.WiringShapesQuery.someone, but the resolver is a jdk.proxyN.$ProxyN, which isn't a graphql.kickstart.tools.compat.scenarios.WiringShapesQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring. +wiring-shapes kind extend interface Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an interface. The extension is ignored. +wiring-shapes kind extend input Query { compatZ: String } BUILT Type 'Query' is defined as an object type, but extended as an input object type. The extension is ignored. +wiring-shapes kind extend enum Query { COMPAT_Z } BUILT Type 'Query' is defined as an object type, but extended as an enum. The extension is ignored. +wiring-shapes kind extend union Query = Person BUILT Type 'Query' is defined as an object type, but extended as a union. The extension is ignored. +wiring-shapes kind extend scalar Query @specifiedBy(url: "https://example.com") BUILT Type 'Query' is defined as an object type, but extended as a scalar. The extension is ignored. +wiring-shapes undeclared extend type Query @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +wiring-shapes repeat extend type Query { trees(filter: TreeFilter): Int } SchemaError: Type 'Query' declares field 'trees' more than once at line 1, column 21. +wiring-shapes location extend type Query @inspect SchemaError: Directive @inspect at line 1, column 19 is applied to OBJECT, but it's declared on INPUT_FIELD_DEFINITION. +wiring-shapes location extend type Query @required SchemaError: Directive @required at line 1, column 19 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +wiring-shapes repeat-directive extend type Query @described @described SchemaError: Directive @described at line 1, column 30 isn't repeatable but is applied more than once. +wiring-shapes location extend type Query @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. +wiring-shapes kind extend type TreeFilter { compatZ: String } BUILT Type 'TreeFilter' is defined as an input object type, but extended as an object type. The extension is ignored. +wiring-shapes kind extend interface TreeFilter { compatZ: String } BUILT Type 'TreeFilter' is defined as an input object type, but extended as an interface. The extension is ignored. +wiring-shapes kind extend enum TreeFilter { COMPAT_Z } BUILT Type 'TreeFilter' is defined as an input object type, but extended as an enum. The extension is ignored. +wiring-shapes kind extend union TreeFilter = Person BUILT Type 'TreeFilter' is defined as an input object type, but extended as a union. The extension is ignored. +wiring-shapes kind extend scalar TreeFilter @specifiedBy(url: "https://example.com") BUILT Type 'TreeFilter' is defined as an input object type, but extended as a scalar. The extension is ignored. +wiring-shapes undeclared extend input TreeFilter @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +wiring-shapes repeat extend input TreeFilter { name: String } SchemaError: Type 'TreeFilter' declares field 'name' more than once at line 1, column 27. +wiring-shapes location extend input TreeFilter @inspect SchemaError: Directive @inspect at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on INPUT_FIELD_DEFINITION. +wiring-shapes location extend input TreeFilter @required SchemaError: Directive @required at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on FIELD_DEFINITION. +wiring-shapes repeat-directive extend input TreeFilter @described @described SchemaError: Directive @described at line 1, column 25 isn't repeatable but is applied more than once. +wiring-shapes location extend input TreeFilter @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 25 is applied to INPUT_OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 25 is missing its required argument 'url'. +wiring-shapes kind extend type Named { compatZ: String } BUILT Type 'Named' is defined as an interface, but extended as an object type. The extension is ignored. +wiring-shapes kind extend input Named { compatZ: String } BUILT Type 'Named' is defined as an interface, but extended as an input object type. The extension is ignored. +wiring-shapes kind extend enum Named { COMPAT_Z } BUILT Type 'Named' is defined as an interface, but extended as an enum. The extension is ignored. +wiring-shapes kind extend union Named = Person BUILT Type 'Named' is defined as an interface, but extended as a union. The extension is ignored. +wiring-shapes kind extend scalar Named @specifiedBy(url: "https://example.com") BUILT Type 'Named' is defined as an interface, but extended as a scalar. The extension is ignored. +wiring-shapes undeclared extend interface Named @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +wiring-shapes repeat extend interface Named { name: String } SchemaError: Type 'Named' declares field 'name' more than once at line 1, column 26. +wiring-shapes location extend interface Named @inspect SchemaError: Directive @inspect at line 1, column 24 is applied to INTERFACE, but it's declared on INPUT_FIELD_DEFINITION. +wiring-shapes location extend interface Named @required SchemaError: Directive @required at line 1, column 24 is applied to INTERFACE, but it's declared on FIELD_DEFINITION. +wiring-shapes repeat-directive extend interface Named @described @described SchemaError: Directive @described at line 1, column 24 isn't repeatable but is applied more than once. +wiring-shapes location extend interface Named @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 24 is applied to INTERFACE, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 24 is missing its required argument 'url'. +wiring-shapes kind extend interface Person { compatZ: String } BUILT Type 'Person' is defined as an object type, but extended as an interface. The extension is ignored. +wiring-shapes kind extend input Person { compatZ: String } BUILT Type 'Person' is defined as an object type, but extended as an input object type. The extension is ignored. +wiring-shapes kind extend enum Person { COMPAT_Z } BUILT Type 'Person' is defined as an object type, but extended as an enum. The extension is ignored. +wiring-shapes kind extend scalar Person @specifiedBy(url: "https://example.com") BUILT Type 'Person' is defined as an object type, but extended as a scalar. The extension is ignored. +wiring-shapes undeclared extend type Person @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +wiring-shapes repeat extend type Person { name: String } SchemaError: Type 'Person' declares field 'name' more than once at line 1, column 22. +wiring-shapes location extend type Person @inspect SchemaError: Directive @inspect at line 1, column 20 is applied to OBJECT, but it's declared on INPUT_FIELD_DEFINITION. +wiring-shapes location extend type Person @required SchemaError: Directive @required at line 1, column 20 is applied to OBJECT, but it's declared on FIELD_DEFINITION. +wiring-shapes repeat-directive extend type Person @described @described SchemaError: Directive @described at line 1, column 20 isn't repeatable but is applied more than once. +wiring-shapes location extend type Person @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 20 is applied to OBJECT, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 20 is missing its required argument 'url'. +wiring-shapes kind extend type Someone { compatZ: String } BUILT Type 'Someone' is defined as a union, but extended as an object type. The extension is ignored. +wiring-shapes kind extend interface Someone { compatZ: String } BUILT Type 'Someone' is defined as a union, but extended as an interface. The extension is ignored. +wiring-shapes kind extend input Someone { compatZ: String } BUILT Type 'Someone' is defined as a union, but extended as an input object type. The extension is ignored. +wiring-shapes kind extend enum Someone { COMPAT_Z } BUILT Type 'Someone' is defined as a union, but extended as an enum. The extension is ignored. +wiring-shapes kind extend scalar Someone @specifiedBy(url: "https://example.com") BUILT Type 'Someone' is defined as a union, but extended as a scalar. The extension is ignored. +wiring-shapes undeclared extend union Someone @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +wiring-shapes repeat extend union Someone = Person SchemaError: Type 'Someone' declares member 'Person' more than once at line 1, column 24. +wiring-shapes location extend union Someone @inspect SchemaError: Directive @inspect at line 1, column 22 is applied to UNION, but it's declared on INPUT_FIELD_DEFINITION. +wiring-shapes location extend union Someone @required SchemaError: Directive @required at line 1, column 22 is applied to UNION, but it's declared on FIELD_DEFINITION. +wiring-shapes repeat-directive extend union Someone @described @described SchemaError: Directive @described at line 1, column 22 isn't repeatable but is applied more than once. +wiring-shapes location extend union Someone @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 22 is applied to UNION, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 22 is missing its required argument 'url'. +wiring-shapes kind extend type State { compatZ: String } BUILT Type 'State' is defined as an enum, but extended as an object type. The extension is ignored. +wiring-shapes kind extend interface State { compatZ: String } BUILT Type 'State' is defined as an enum, but extended as an interface. The extension is ignored. +wiring-shapes kind extend input State { compatZ: String } BUILT Type 'State' is defined as an enum, but extended as an input object type. The extension is ignored. +wiring-shapes kind extend union State = Person BUILT Type 'State' is defined as an enum, but extended as a union. The extension is ignored. +wiring-shapes kind extend scalar State @specifiedBy(url: "https://example.com") BUILT Type 'State' is defined as an enum, but extended as a scalar. The extension is ignored. +wiring-shapes undeclared extend enum State @compatUndeclared SchemaError: Found applied directive compatUndeclared without corresponding directive definition. +wiring-shapes repeat extend enum State { ALIVE } SchemaError: Type 'State' declares value 'ALIVE' more than once at line 1, column 21. +wiring-shapes location extend enum State @inspect SchemaError: Directive @inspect at line 1, column 19 is applied to ENUM, but it's declared on INPUT_FIELD_DEFINITION. +wiring-shapes location extend enum State @required SchemaError: Directive @required at line 1, column 19 is applied to ENUM, but it's declared on FIELD_DEFINITION. +wiring-shapes repeat-directive extend enum State @described @described SchemaError: Directive @described at line 1, column 19 isn't repeatable but is applied more than once. +wiring-shapes location extend enum State @specifiedBy SchemaError: Directive @specifiedBy at line 1, column 19 is applied to ENUM, but it's declared on SCALAR. Directive @specifiedBy at line 1, column 19 is missing its required argument 'url'. diff --git a/src/test/resources/compat/scenarios/async/01-query.graphql b/src/test/resources/compat/scenarios/async/01-query.graphql new file mode 100644 index 00000000..f6145c99 --- /dev/null +++ b/src/test/resources/compat/scenarios/async/01-query.graphql @@ -0,0 +1,5 @@ +query Async { + future + suspended + shipments { id status } +} diff --git a/src/test/resources/compat/scenarios/async/02-subscription.graphql b/src/test/resources/compat/scenarios/async/02-subscription.graphql new file mode 100644 index 00000000..8be1c798 --- /dev/null +++ b/src/test/resources/compat/scenarios/async/02-subscription.graphql @@ -0,0 +1,3 @@ +subscription Ticks { + ticks(count: 3) +} diff --git a/src/test/resources/compat/scenarios/async/schema.graphqls b/src/test/resources/compat/scenarios/async/schema.graphqls new file mode 100644 index 00000000..40f853fe --- /dev/null +++ b/src/test/resources/compat/scenarios/async/schema.graphqls @@ -0,0 +1,14 @@ +type Query { + future: String! + suspended: String! + shipments: [Shipment!]! +} + +type Shipment { + id: ID! + status: String! +} + +type Subscription { + ticks(count: Int!): Int! +} diff --git a/src/test/resources/compat/scenarios/bookstore-missing-resolver/extension.graphqls b/src/test/resources/compat/scenarios/bookstore-missing-resolver/extension.graphqls new file mode 100644 index 00000000..ed31d413 --- /dev/null +++ b/src/test/resources/compat/scenarios/bookstore-missing-resolver/extension.graphqls @@ -0,0 +1,3 @@ +extend type Book { + isbn: String! +} diff --git a/src/test/resources/compat/scenarios/bookstore/01-books.graphql b/src/test/resources/compat/scenarios/bookstore/01-books.graphql new file mode 100644 index 00000000..253c349c --- /dev/null +++ b/src/test/resources/compat/scenarios/bookstore/01-books.graphql @@ -0,0 +1,9 @@ +query Books { + books { + id + title + published + inStock + author { name } + } +} diff --git a/src/test/resources/compat/scenarios/bookstore/02-book-by-id.graphql b/src/test/resources/compat/scenarios/bookstore/02-book-by-id.graphql new file mode 100644 index 00000000..e7f97751 --- /dev/null +++ b/src/test/resources/compat/scenarios/bookstore/02-book-by-id.graphql @@ -0,0 +1,7 @@ +query BookById($id: ID!) { + book(id: $id) { + title + author { id name } + } + missing: book(id: "nope") { title } +} diff --git a/src/test/resources/compat/scenarios/bookstore/02-book-by-id.variables.json b/src/test/resources/compat/scenarios/bookstore/02-book-by-id.variables.json new file mode 100644 index 00000000..775ead7c --- /dev/null +++ b/src/test/resources/compat/scenarios/bookstore/02-book-by-id.variables.json @@ -0,0 +1 @@ +{ "id": "b3" } diff --git a/src/test/resources/compat/scenarios/bookstore/schema.graphqls b/src/test/resources/compat/scenarios/bookstore/schema.graphqls new file mode 100644 index 00000000..8e8fb418 --- /dev/null +++ b/src/test/resources/compat/scenarios/bookstore/schema.graphqls @@ -0,0 +1,24 @@ +scalar Date + +type Query { + books: [Book!]! + book(id: ID!): Book +} + +type Book { + id: ID! + title: String! + author: Author! + published: Date! + inStock: Boolean! +} + +type Author { + id: ID! + name: String! +} + +# Reachable from no root type: graphql-java-tools logs a warning and leaves it out of the schema +type Review { + stars: Int! +} diff --git a/src/test/resources/compat/scenarios/context-and-environment-invalid/schema.graphqls b/src/test/resources/compat/scenarios/context-and-environment-invalid/schema.graphqls new file mode 100644 index 00000000..89a7d1a7 --- /dev/null +++ b/src/test/resources/compat/scenarios/context-and-environment-invalid/schema.graphqls @@ -0,0 +1,3 @@ +type Query { + greeting(name: String!): String! +} diff --git a/src/test/resources/compat/scenarios/context-and-environment/01-query.graphql b/src/test/resources/compat/scenarios/context-and-environment/01-query.graphql new file mode 100644 index 00000000..860160ad --- /dev/null +++ b/src/test/resources/compat/scenarios/context-and-environment/01-query.graphql @@ -0,0 +1,7 @@ +query { + greeting(name: "ada") + farewell(name: "ada") + user { name locale } + environmentOnly + contextOnly +} diff --git a/src/test/resources/compat/scenarios/context-and-environment/schema.graphqls b/src/test/resources/compat/scenarios/context-and-environment/schema.graphqls new file mode 100644 index 00000000..e3779905 --- /dev/null +++ b/src/test/resources/compat/scenarios/context-and-environment/schema.graphqls @@ -0,0 +1,12 @@ +type Query { + greeting(name: String!): String! + farewell(name: String!): String! + user: User! + environmentOnly: String! + contextOnly: String! +} + +type User { + name: String! + locale: String! +} diff --git a/src/test/resources/compat/scenarios/context-misbound/01-without-argument.graphql b/src/test/resources/compat/scenarios/context-misbound/01-without-argument.graphql new file mode 100644 index 00000000..f9f1e4e3 --- /dev/null +++ b/src/test/resources/compat/scenarios/context-misbound/01-without-argument.graphql @@ -0,0 +1,3 @@ +query { + users { name } +} diff --git a/src/test/resources/compat/scenarios/context-misbound/02-with-argument.graphql b/src/test/resources/compat/scenarios/context-misbound/02-with-argument.graphql new file mode 100644 index 00000000..1f60d526 --- /dev/null +++ b/src/test/resources/compat/scenarios/context-misbound/02-with-argument.graphql @@ -0,0 +1,3 @@ +query { + users(first: 1) { name } +} diff --git a/src/test/resources/compat/scenarios/context-misbound/03-context-and-correct.graphql b/src/test/resources/compat/scenarios/context-misbound/03-context-and-correct.graphql new file mode 100644 index 00000000..e0a1a5a0 --- /dev/null +++ b/src/test/resources/compat/scenarios/context-misbound/03-context-and-correct.graphql @@ -0,0 +1,4 @@ +query { + contextArgument(name: "ada") + greeting(name: "ada") +} diff --git a/src/test/resources/compat/scenarios/context-misbound/04-type-resolver.graphql b/src/test/resources/compat/scenarios/context-misbound/04-type-resolver.graphql new file mode 100644 index 00000000..70171552 --- /dev/null +++ b/src/test/resources/compat/scenarios/context-misbound/04-type-resolver.graphql @@ -0,0 +1,3 @@ +query { + user { name thumbnail(size: 64) } +} diff --git a/src/test/resources/compat/scenarios/context-misbound/schema.graphqls b/src/test/resources/compat/scenarios/context-misbound/schema.graphqls new file mode 100644 index 00000000..d8385510 --- /dev/null +++ b/src/test/resources/compat/scenarios/context-misbound/schema.graphqls @@ -0,0 +1,11 @@ +type Query { + users(first: Int): [User!]! + user: User! + contextArgument(name: String): String + greeting(name: String!): String! +} + +type User { + name: String! + thumbnail(size: Int): String +} diff --git a/src/test/resources/compat/scenarios/directive-drift-undeclared/schema.graphqls b/src/test/resources/compat/scenarios/directive-drift-undeclared/schema.graphqls new file mode 100644 index 00000000..a00d59f1 --- /dev/null +++ b/src/test/resources/compat/scenarios/directive-drift-undeclared/schema.graphqls @@ -0,0 +1,3 @@ +type Query { + a: String @undeclared(s: "x") +} diff --git a/src/test/resources/compat/scenarios/directive-drift/schema.graphqls b/src/test/resources/compat/scenarios/directive-drift/schema.graphqls new file mode 100644 index 00000000..eb4657e9 --- /dev/null +++ b/src/test/resources/compat/scenarios/directive-drift/schema.graphqls @@ -0,0 +1,75 @@ +schema @tag(name: "schema") @link(url: "https://example.com/v1") @link(url: "https://example.com/v2") { + query: Query +} + +"Tags a node" +directive @tag( + "The tag's name" + name: String! + "How loud" + level: Int = 1 + kind: Kind = PLAIN + meta: Meta +) repeatable on OBJECT | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | FIELD_DEFINITION | ARGUMENT_DEFINITION | SCALAR | SCHEMA + +"Marks a node once" +directive @once( + "Why" + reason: String = "because" +) on OBJECT | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | FIELD_DEFINITION | ARGUMENT_DEFINITION | SCALAR + +directive @link(url: String!) repeatable on SCHEMA + +directive @argDoc(note: String @once @tag(name: "on a directive argument")) on FIELD_DEFINITION + +directive @fieldOnly on FIELD_DEFINITION + +enum Kind { PLAIN LOUD } + +type Query @tag(name: "query") { + plain: String + # described by a comment + @tag(name: "plain", level: 2) + @once(reason: "supplied") + @fieldOnly + @argDoc(note: "x") + old: String @deprecated + older: String @deprecated(reason: "use plain") + search( + filter: Meta @tag(name: "arg", kind: LOUD, meta: {owner: "me"}) + term: String @once + ): String @undeclared(s: "x", i: 1, f: 1.5, b: true, n: null, l: [1, 2], e: []) @undeclared(s: "again") @tag(name: "a") @tag(name: "b") + animal: Animal + pet: Pet + color: Color + when: Date + price: Money +} + +extend type Query @once(reason: "extension") @tag(name: "extension") @undeclared + +interface Animal @tag(name: "animal") @once { + name: String @once +} + +type Dog implements Animal { + name: String +} + +union Pet @tag(name: "pet") @once = Dog + +enum Color @once { + RED @tag(name: "red") @once + GREEN @deprecated + BLUE @deprecated(reason: "too blue") @undeclared(why: "blue") +} + +input Meta @tag(name: "input") @once { + owner: String @once(reason: "x") +} + +"A date" +scalar Date @tag(name: "date") @specifiedBy(url: "https://example.com/date") +extend scalar Date @once(reason: "extension") @tag(name: "extension") + +scalar Money @undeclared(code: "USD") diff --git a/src/test/resources/compat/scenarios/directives-invalid/01-query.graphql b/src/test/resources/compat/scenarios/directives-invalid/01-query.graphql new file mode 100644 index 00000000..ecd6b647 --- /dev/null +++ b/src/test/resources/compat/scenarios/directives-invalid/01-query.graphql @@ -0,0 +1,8 @@ +query Invalid { + motto + secret + members { + id + name + } +} diff --git a/src/test/resources/compat/scenarios/directives-invalid/schema.graphqls b/src/test/resources/compat/scenarios/directives-invalid/schema.graphqls new file mode 100644 index 00000000..b2e14ab7 --- /dev/null +++ b/src/test/resources/compat/scenarios/directives-invalid/schema.graphqls @@ -0,0 +1,20 @@ +directive @uppercase on OBJECT +directive @auth(role: String!, scope: String = "all") on FIELD_DEFINITION +directive @cached(ttl: Int) on FIELD_DEFINITION | SCHEMA + +schema @cached(ttl: 60) { + query: Query +} + +extend schema @cached(ttl: 30) + +type Query { + motto: String! @uppercase + secret: String @auth + members: [Member!] @cached @cached(ttl: 10) +} + +type Member @deprecated { + id: ID! + name: String! +} diff --git a/src/test/resources/compat/scenarios/directives/01-uppercase.graphql b/src/test/resources/compat/scenarios/directives/01-uppercase.graphql new file mode 100644 index 00000000..80daec1f --- /dev/null +++ b/src/test/resources/compat/scenarios/directives/01-uppercase.graphql @@ -0,0 +1,4 @@ +query Uppercase { + motto + oldMotto +} diff --git a/src/test/resources/compat/scenarios/directives/02-deprecated.graphql b/src/test/resources/compat/scenarios/directives/02-deprecated.graphql new file mode 100644 index 00000000..43fd27bd --- /dev/null +++ b/src/test/resources/compat/scenarios/directives/02-deprecated.graphql @@ -0,0 +1,9 @@ +query Deprecated { + __type(name: "Query") { + fields(includeDeprecated: true) { + name + isDeprecated + deprecationReason + } + } +} diff --git a/src/test/resources/compat/scenarios/directives/03-connection.graphql b/src/test/resources/compat/scenarios/directives/03-connection.graphql new file mode 100644 index 00000000..23d8dba2 --- /dev/null +++ b/src/test/resources/compat/scenarios/directives/03-connection.graphql @@ -0,0 +1,14 @@ +query Members { + members(first: 2) { + edges { + cursor + node { id name } + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } +} diff --git a/src/test/resources/compat/scenarios/directives/schema.graphqls b/src/test/resources/compat/scenarios/directives/schema.graphqls new file mode 100644 index 00000000..37ef47d2 --- /dev/null +++ b/src/test/resources/compat/scenarios/directives/schema.graphqls @@ -0,0 +1,13 @@ +directive @uppercase on FIELD_DEFINITION +directive @connection(for: String!) on FIELD_DEFINITION + +type Query { + motto: String! @uppercase + oldMotto: String! @deprecated(reason: "Use motto") + members(first: Int, after: String): MemberConnection @connection(for: "Member") +} + +type Member { + id: ID! + name: String! @uppercase +} diff --git a/src/test/resources/compat/scenarios/generic-input-resolver/01-plain.graphql b/src/test/resources/compat/scenarios/generic-input-resolver/01-plain.graphql new file mode 100644 index 00000000..ee5eb8eb --- /dev/null +++ b/src/test/resources/compat/scenarios/generic-input-resolver/01-plain.graphql @@ -0,0 +1 @@ +{ plain(input: { name: "a" }) } diff --git a/src/test/resources/compat/scenarios/generic-input-resolver/02-generic.graphql b/src/test/resources/compat/scenarios/generic-input-resolver/02-generic.graphql new file mode 100644 index 00000000..61415273 --- /dev/null +++ b/src/test/resources/compat/scenarios/generic-input-resolver/02-generic.graphql @@ -0,0 +1 @@ +{ generic(input: { name: "a" }) } diff --git a/src/test/resources/compat/scenarios/generic-input-resolver/schema.graphqls b/src/test/resources/compat/scenarios/generic-input-resolver/schema.graphqls new file mode 100644 index 00000000..13da2912 --- /dev/null +++ b/src/test/resources/compat/scenarios/generic-input-resolver/schema.graphqls @@ -0,0 +1,8 @@ +type Query { + generic(input: GreetingInput!): String! + plain(input: GreetingInput!): String! +} + +input GreetingInput { + name: String! +} diff --git a/src/test/resources/compat/scenarios/inputs/01-search.graphql b/src/test/resources/compat/scenarios/inputs/01-search.graphql new file mode 100644 index 00000000..5ec6030a --- /dev/null +++ b/src/test/resources/compat/scenarios/inputs/01-search.graphql @@ -0,0 +1,4 @@ +query Search { + defaults: search(term: "dune") + explicit: search(term: "dune", limit: 2, genres: [SCIENCE, HISTORY]) +} diff --git a/src/test/resources/compat/scenarios/inputs/02-nickname.graphql b/src/test/resources/compat/scenarios/inputs/02-nickname.graphql new file mode 100644 index 00000000..54851ae0 --- /dev/null +++ b/src/test/resources/compat/scenarios/inputs/02-nickname.graphql @@ -0,0 +1,5 @@ +query Nickname { + omitted: nickname + explicitNull: nickname(value: null) + given: nickname(value: "Bilbo") +} diff --git a/src/test/resources/compat/scenarios/inputs/03-add-book.graphql b/src/test/resources/compat/scenarios/inputs/03-add-book.graphql new file mode 100644 index 00000000..e4cbfcb0 --- /dev/null +++ b/src/test/resources/compat/scenarios/inputs/03-add-book.graphql @@ -0,0 +1,14 @@ +mutation AddBook($input: BookInput!) { + addBook(input: $input) { + title + genre + tags + pages + language + } + defaults: addBook(input: { title: "Untitled" }) { + genre + tags + pages + } +} diff --git a/src/test/resources/compat/scenarios/inputs/03-add-book.variables.json b/src/test/resources/compat/scenarios/inputs/03-add-book.variables.json new file mode 100644 index 00000000..ff1ebf8c --- /dev/null +++ b/src/test/resources/compat/scenarios/inputs/03-add-book.variables.json @@ -0,0 +1 @@ +{ "input": { "title": "Cosmos", "genre": "SCIENCE", "tags": ["space", "classic"], "details": { "pages": 396 } } } diff --git a/src/test/resources/compat/scenarios/inputs/04-invalid-enum.graphql b/src/test/resources/compat/scenarios/inputs/04-invalid-enum.graphql new file mode 100644 index 00000000..e6e7fe8f --- /dev/null +++ b/src/test/resources/compat/scenarios/inputs/04-invalid-enum.graphql @@ -0,0 +1,3 @@ +query InvalidEnum { + search(term: "x", genres: [POETRY]) +} diff --git a/src/test/resources/compat/scenarios/inputs/schema.graphqls b/src/test/resources/compat/scenarios/inputs/schema.graphqls new file mode 100644 index 00000000..d987dd68 --- /dev/null +++ b/src/test/resources/compat/scenarios/inputs/schema.graphqls @@ -0,0 +1,34 @@ +type Query { + search(term: String!, limit: Int = 10, genres: [Genre!]): String! + nickname(value: String): String! +} + +type Mutation { + addBook(input: BookInput!): SavedBook! +} + +enum Genre { + FICTION + SCIENCE + HISTORY +} + +input BookInput { + title: String! + genre: Genre = FICTION + tags: [String!] + details: DetailsInput +} + +input DetailsInput { + pages: Int! + language: String = "en" +} + +type SavedBook { + title: String! + genre: Genre! + tags: [String!]! + pages: Int + language: String +} diff --git a/src/test/resources/compat/scenarios/jdk-proxy/01-query.graphql b/src/test/resources/compat/scenarios/jdk-proxy/01-query.graphql new file mode 100644 index 00000000..190fbb0f --- /dev/null +++ b/src/test/resources/compat/scenarios/jdk-proxy/01-query.graphql @@ -0,0 +1 @@ +{ test count total } diff --git a/src/test/resources/compat/scenarios/jdk-proxy/schema.graphqls b/src/test/resources/compat/scenarios/jdk-proxy/schema.graphqls new file mode 100644 index 00000000..2c6feced --- /dev/null +++ b/src/test/resources/compat/scenarios/jdk-proxy/schema.graphqls @@ -0,0 +1,5 @@ +type Query { + test: String + count: Int + total: Int +} diff --git a/src/test/resources/compat/scenarios/nested-unions/01-results.graphql b/src/test/resources/compat/scenarios/nested-unions/01-results.graphql new file mode 100644 index 00000000..1dbe8f8f --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-unions/01-results.graphql @@ -0,0 +1,9 @@ +query Results { + results { + __typename + ... on Book { title } + ... on Media { + ... on Movie { title } + } + } +} diff --git a/src/test/resources/compat/scenarios/nested-unions/schema.graphqls b/src/test/resources/compat/scenarios/nested-unions/schema.graphqls new file mode 100644 index 00000000..7c040dac --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-unions/schema.graphqls @@ -0,0 +1,15 @@ +type Query { + results: [Result!]! +} + +union Result = Book | Media + +union Media = Movie + +type Book { + title: String! +} + +type Movie { + title: String! +} diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/01-dates.graphql b/src/test/resources/compat/scenarios/nested-wrappers-exact/01-dates.graphql new file mode 100644 index 00000000..7edc9dc0 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/01-dates.graphql @@ -0,0 +1 @@ +{ dates } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/02-tried-dates.graphql b/src/test/resources/compat/scenarios/nested-wrappers-exact/02-tried-dates.graphql new file mode 100644 index 00000000..be584969 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/02-tried-dates.graphql @@ -0,0 +1 @@ +{ triedDates } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/03-plain-future-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers-exact/03-plain-future-items.graphql new file mode 100644 index 00000000..ca6d7a1a --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/03-plain-future-items.graphql @@ -0,0 +1 @@ +{ plainFutureItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/04-batched-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers-exact/04-batched-items.graphql new file mode 100644 index 00000000..2156bae0 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/04-batched-items.graphql @@ -0,0 +1 @@ +{ batchedItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/05-boxed-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers-exact/05-boxed-items.graphql new file mode 100644 index 00000000..08db2ed0 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/05-boxed-items.graphql @@ -0,0 +1 @@ +{ boxedItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/06-later-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers-exact/06-later-items.graphql new file mode 100644 index 00000000..aacfda86 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/06-later-items.graphql @@ -0,0 +1 @@ +{ laterItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/07-suspend-plain-future-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers-exact/07-suspend-plain-future-items.graphql new file mode 100644 index 00000000..0dbbf8cc --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/07-suspend-plain-future-items.graphql @@ -0,0 +1 @@ +{ suspendPlainFutureItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-exact/schema.graphqls b/src/test/resources/compat/scenarios/nested-wrappers-exact/schema.graphqls new file mode 100644 index 00000000..dd5ac5ce --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-exact/schema.graphqls @@ -0,0 +1,15 @@ +scalar DateTime + +type Query { + dates: [DateTime] + triedDates: [DateTime!]! + plainFutureItems: [Item] + batchedItems: [Item!]! + boxedItems: [Item!]! + laterItems: [Item] + suspendPlainFutureItems: [Item] +} + +type Item { + id: ID! +} diff --git a/src/test/resources/compat/scenarios/nested-wrappers-suspend/01-nullable-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers-suspend/01-nullable-items.graphql new file mode 100644 index 00000000..25e05572 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-suspend/01-nullable-items.graphql @@ -0,0 +1 @@ +{ nullableItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-suspend/02-non-null-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers-suspend/02-non-null-items.graphql new file mode 100644 index 00000000..d8a89355 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-suspend/02-non-null-items.graphql @@ -0,0 +1 @@ +{ nonNullItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-suspend/03-type-variable-strings.graphql b/src/test/resources/compat/scenarios/nested-wrappers-suspend/03-type-variable-strings.graphql new file mode 100644 index 00000000..9e894423 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-suspend/03-type-variable-strings.graphql @@ -0,0 +1 @@ +{ typeVariableStrings } diff --git a/src/test/resources/compat/scenarios/nested-wrappers-suspend/schema.graphqls b/src/test/resources/compat/scenarios/nested-wrappers-suspend/schema.graphqls new file mode 100644 index 00000000..b1575798 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers-suspend/schema.graphqls @@ -0,0 +1,9 @@ +type Query { + nullableItems: [Item] + nonNullItems: [Item!]! + typeVariableStrings: [String] +} + +type Item { + id: ID! +} diff --git a/src/test/resources/compat/scenarios/nested-wrappers/01-payload.graphql b/src/test/resources/compat/scenarios/nested-wrappers/01-payload.graphql new file mode 100644 index 00000000..3ed5ffc1 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/01-payload.graphql @@ -0,0 +1 @@ +{ payload { data } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/02-payloads.graphql b/src/test/resources/compat/scenarios/nested-wrappers/02-payloads.graphql new file mode 100644 index 00000000..84d0bc6b --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/02-payloads.graphql @@ -0,0 +1 @@ +{ payloads { data } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/03-payload-strings.graphql b/src/test/resources/compat/scenarios/nested-wrappers/03-payload-strings.graphql new file mode 100644 index 00000000..3568fe8b --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/03-payload-strings.graphql @@ -0,0 +1 @@ +{ payloadStrings } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/04-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers/04-items.graphql new file mode 100644 index 00000000..3c1faaf8 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/04-items.graphql @@ -0,0 +1 @@ +{ items { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/05-item-names.graphql b/src/test/resources/compat/scenarios/nested-wrappers/05-item-names.graphql new file mode 100644 index 00000000..44577a66 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/05-item-names.graphql @@ -0,0 +1 @@ +{ itemNames } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/06-future-of-future.graphql b/src/test/resources/compat/scenarios/nested-wrappers/06-future-of-future.graphql new file mode 100644 index 00000000..b362257c --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/06-future-of-future.graphql @@ -0,0 +1 @@ +{ futureOfFuture { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/07-future-of-tries.graphql b/src/test/resources/compat/scenarios/nested-wrappers/07-future-of-tries.graphql new file mode 100644 index 00000000..0bcafb9c --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/07-future-of-tries.graphql @@ -0,0 +1 @@ +{ futureOfTries { data } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/08-tries-of-futures.graphql b/src/test/resources/compat/scenarios/nested-wrappers/08-tries-of-futures.graphql new file mode 100644 index 00000000..590b87ab --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/08-tries-of-futures.graphql @@ -0,0 +1 @@ +{ triesOfFutures { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/09-loaded-items.graphql b/src/test/resources/compat/scenarios/nested-wrappers/09-loaded-items.graphql new file mode 100644 index 00000000..59304ac9 --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/09-loaded-items.graphql @@ -0,0 +1 @@ +{ loadedItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/10-failed-try-in-list.graphql b/src/test/resources/compat/scenarios/nested-wrappers/10-failed-try-in-list.graphql new file mode 100644 index 00000000..ff1774ab --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/10-failed-try-in-list.graphql @@ -0,0 +1 @@ +{ failedTryInList { data } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/11-failed-future-in-list.graphql b/src/test/resources/compat/scenarios/nested-wrappers/11-failed-future-in-list.graphql new file mode 100644 index 00000000..14db363f --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/11-failed-future-in-list.graphql @@ -0,0 +1 @@ +{ failedFutureInList { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/12-controls.graphql b/src/test/resources/compat/scenarios/nested-wrappers/12-controls.graphql new file mode 100644 index 00000000..e79a12bf --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/12-controls.graphql @@ -0,0 +1 @@ +{ plainItems { id } futureOfItems { id } } diff --git a/src/test/resources/compat/scenarios/nested-wrappers/schema.graphqls b/src/test/resources/compat/scenarios/nested-wrappers/schema.graphqls new file mode 100644 index 00000000..1798ee6e --- /dev/null +++ b/src/test/resources/compat/scenarios/nested-wrappers/schema.graphqls @@ -0,0 +1,23 @@ +type Query { + payload: Payload! + payloads: [Payload!]! + payloadStrings: [String!]! + items: [Item] + itemNames: [String] + futureOfFuture: Item + futureOfTries: [Payload!]! + triesOfFutures: [Item!]! + loadedItems: [Item!]! + failedTryInList: [Payload!] + failedFutureInList: [Item] + plainItems: [Item!]! + futureOfItems: [Item!]! +} + +type Payload { + data: String! +} + +type Item { + id: ID! +} diff --git a/src/test/resources/compat/scenarios/optional-results-list/01-optional-result-list.graphql b/src/test/resources/compat/scenarios/optional-results-list/01-optional-result-list.graphql new file mode 100644 index 00000000..1664acf9 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results-list/01-optional-result-list.graphql @@ -0,0 +1 @@ +{ optionalResultList { data } } diff --git a/src/test/resources/compat/scenarios/optional-results-list/schema.graphqls b/src/test/resources/compat/scenarios/optional-results-list/schema.graphqls new file mode 100644 index 00000000..4d83858a --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results-list/schema.graphqls @@ -0,0 +1,7 @@ +type Query { + optionalResultList: [Payload] +} + +type Payload { + data: String +} diff --git a/src/test/resources/compat/scenarios/optional-results-mixed/01-optional-result.graphql b/src/test/resources/compat/scenarios/optional-results-mixed/01-optional-result.graphql new file mode 100644 index 00000000..c10e6989 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results-mixed/01-optional-result.graphql @@ -0,0 +1 @@ +{ optionalResult { data } } diff --git a/src/test/resources/compat/scenarios/optional-results-mixed/02-result-of-optional.graphql b/src/test/resources/compat/scenarios/optional-results-mixed/02-result-of-optional.graphql new file mode 100644 index 00000000..d441ca28 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results-mixed/02-result-of-optional.graphql @@ -0,0 +1 @@ +{ resultOfOptional { data } } diff --git a/src/test/resources/compat/scenarios/optional-results-mixed/schema.graphqls b/src/test/resources/compat/scenarios/optional-results-mixed/schema.graphqls new file mode 100644 index 00000000..e3d6776d --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results-mixed/schema.graphqls @@ -0,0 +1,8 @@ +type Query { + optionalResult: Payload + resultOfOptional: Payload +} + +type Payload { + data: String +} diff --git a/src/test/resources/compat/scenarios/optional-results-nested/01-optional-result-of-result.graphql b/src/test/resources/compat/scenarios/optional-results-nested/01-optional-result-of-result.graphql new file mode 100644 index 00000000..4faaec18 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results-nested/01-optional-result-of-result.graphql @@ -0,0 +1 @@ +{ optionalResultOfResult { data } } diff --git a/src/test/resources/compat/scenarios/optional-results-nested/schema.graphqls b/src/test/resources/compat/scenarios/optional-results-nested/schema.graphqls new file mode 100644 index 00000000..fdcfe753 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results-nested/schema.graphqls @@ -0,0 +1,7 @@ +type Query { + optionalResultOfResult: Payload +} + +type Payload { + data: String +} diff --git a/src/test/resources/compat/scenarios/optional-results/01-optional-result.graphql b/src/test/resources/compat/scenarios/optional-results/01-optional-result.graphql new file mode 100644 index 00000000..c10e6989 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results/01-optional-result.graphql @@ -0,0 +1 @@ +{ optionalResult { data } } diff --git a/src/test/resources/compat/scenarios/optional-results/02-optional-result-name.graphql b/src/test/resources/compat/scenarios/optional-results/02-optional-result-name.graphql new file mode 100644 index 00000000..82e4e071 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results/02-optional-result-name.graphql @@ -0,0 +1 @@ +{ optionalResultName } diff --git a/src/test/resources/compat/scenarios/optional-results/03-empty-optional-result.graphql b/src/test/resources/compat/scenarios/optional-results/03-empty-optional-result.graphql new file mode 100644 index 00000000..60fd0542 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results/03-empty-optional-result.graphql @@ -0,0 +1 @@ +{ emptyOptionalResult { data } } diff --git a/src/test/resources/compat/scenarios/optional-results/schema.graphqls b/src/test/resources/compat/scenarios/optional-results/schema.graphqls new file mode 100644 index 00000000..e3f18278 --- /dev/null +++ b/src/test/resources/compat/scenarios/optional-results/schema.graphqls @@ -0,0 +1,9 @@ +type Query { + optionalResult: Payload + optionalResultName: String + emptyOptionalResult: Payload +} + +type Payload { + data: String +} diff --git a/src/test/resources/compat/scenarios/options/01-fields.graphql b/src/test/resources/compat/scenarios/options/01-fields.graphql new file mode 100644 index 00000000..49a76a4b --- /dev/null +++ b/src/test/resources/compat/scenarios/options/01-fields.graphql @@ -0,0 +1,5 @@ +query Fields { + name + unimplemented + __typename +} diff --git a/src/test/resources/compat/scenarios/options/02-schema-introspection.graphql b/src/test/resources/compat/scenarios/options/02-schema-introspection.graphql new file mode 100644 index 00000000..c194bf8f --- /dev/null +++ b/src/test/resources/compat/scenarios/options/02-schema-introspection.graphql @@ -0,0 +1,3 @@ +query SchemaIntrospection { + __schema { queryType { name } } +} diff --git a/src/test/resources/compat/scenarios/options/03-type-introspection.graphql b/src/test/resources/compat/scenarios/options/03-type-introspection.graphql new file mode 100644 index 00000000..e4089f34 --- /dev/null +++ b/src/test/resources/compat/scenarios/options/03-type-introspection.graphql @@ -0,0 +1,3 @@ +query TypeIntrospection { + __type(name: "Query") { name } +} diff --git a/src/test/resources/compat/scenarios/options/schema.graphqls b/src/test/resources/compat/scenarios/options/schema.graphqls new file mode 100644 index 00000000..4940232b --- /dev/null +++ b/src/test/resources/compat/scenarios/options/schema.graphqls @@ -0,0 +1,4 @@ +type Query { + name: String! + unimplemented: String! +} diff --git a/src/test/resources/compat/scenarios/polymorphism/01-node.graphql b/src/test/resources/compat/scenarios/polymorphism/01-node.graphql new file mode 100644 index 00000000..8e7ddae2 --- /dev/null +++ b/src/test/resources/compat/scenarios/polymorphism/01-node.graphql @@ -0,0 +1,11 @@ +query Nodes { + novel: node(id: "n1") { + __typename + id + ... on Novel { title } + } + writer: node(id: "w1") { + __typename + ... on Writer { name } + } +} diff --git a/src/test/resources/compat/scenarios/polymorphism/02-union.graphql b/src/test/resources/compat/scenarios/polymorphism/02-union.graphql new file mode 100644 index 00000000..28426ae5 --- /dev/null +++ b/src/test/resources/compat/scenarios/polymorphism/02-union.graphql @@ -0,0 +1,7 @@ +query Search { + search(term: "s") { + __typename + ... on Novel { title } + ... on Writer { name } + } +} diff --git a/src/test/resources/compat/scenarios/polymorphism/schema.graphqls b/src/test/resources/compat/scenarios/polymorphism/schema.graphqls new file mode 100644 index 00000000..64920e7a --- /dev/null +++ b/src/test/resources/compat/scenarios/polymorphism/schema.graphqls @@ -0,0 +1,20 @@ +type Query { + node(id: ID!): Node + search(term: String!): [SearchResult!]! +} + +interface Node { + id: ID! +} + +type Novel implements Node { + id: ID! + title: String! +} + +type Writer implements Node { + id: ID! + name: String! +} + +union SearchResult = Novel | Writer diff --git a/src/test/resources/compat/scenarios/read-only-schema/01-interface.graphql b/src/test/resources/compat/scenarios/read-only-schema/01-interface.graphql new file mode 100644 index 00000000..b7680fb9 --- /dev/null +++ b/src/test/resources/compat/scenarios/read-only-schema/01-interface.graphql @@ -0,0 +1,3 @@ +{ + animal(name: "Tom") { __typename name ... on Cat { lives } } +} diff --git a/src/test/resources/compat/scenarios/read-only-schema/02-union.graphql b/src/test/resources/compat/scenarios/read-only-schema/02-union.graphql new file mode 100644 index 00000000..4b85d0a7 --- /dev/null +++ b/src/test/resources/compat/scenarios/read-only-schema/02-union.graphql @@ -0,0 +1,3 @@ +{ + pets { __typename ... on Dog { name barks } ... on Cat { name lives } } +} diff --git a/src/test/resources/compat/scenarios/read-only-schema/03-no-mutation.graphql b/src/test/resources/compat/scenarios/read-only-schema/03-no-mutation.graphql new file mode 100644 index 00000000..de47fce6 --- /dev/null +++ b/src/test/resources/compat/scenarios/read-only-schema/03-no-mutation.graphql @@ -0,0 +1,3 @@ +{ + __schema { mutationType { name } } +} diff --git a/src/test/resources/compat/scenarios/read-only-schema/schema.graphqls b/src/test/resources/compat/scenarios/read-only-schema/schema.graphqls new file mode 100644 index 00000000..55e0dca1 --- /dev/null +++ b/src/test/resources/compat/scenarios/read-only-schema/schema.graphqls @@ -0,0 +1,29 @@ +directive @tag(name: String!) on FIELD_DEFINITION +directive @contact(name: String!) on SCHEMA + +extend schema @contact(name: "pets-team") + +type Query { + animal(name: String!): Animal + pets: [Pet!]! +} + +type Mutation { + adopt(name: String!): Animal! +} + +interface Animal { + name: String! @tag(name: "public") +} + +type Dog implements Animal { + name: String! @tag(name: "public") + barks: Boolean! +} + +type Cat implements Animal { + name: String! @tag(name: "public") + lives: Int! +} + +union Pet = Dog | Cat diff --git a/src/test/resources/compat/scenarios/recursive-inputs/01-describe.graphql b/src/test/resources/compat/scenarios/recursive-inputs/01-describe.graphql new file mode 100644 index 00000000..c38a92ed --- /dev/null +++ b/src/test/resources/compat/scenarios/recursive-inputs/01-describe.graphql @@ -0,0 +1,5 @@ +query Describe($filter: TreeFilter!) { + describe(filter: $filter) + literal: describe(filter: { name: "x", child: { depth: 1, siblings: [[{ depth: 2 }]] } }) + names(first: 2) +} diff --git a/src/test/resources/compat/scenarios/recursive-inputs/01-describe.variables.json b/src/test/resources/compat/scenarios/recursive-inputs/01-describe.variables.json new file mode 100644 index 00000000..91519580 --- /dev/null +++ b/src/test/resources/compat/scenarios/recursive-inputs/01-describe.variables.json @@ -0,0 +1 @@ +{"filter": {"name": "root", "and": [{"name": "a"}, {"not": {"name": "b"}}], "child": {"depth": 3, "parent": {"name": "up"}, "siblings": [[{"depth": 4}], []]}}} diff --git a/src/test/resources/compat/scenarios/recursive-inputs/02-introspect.graphql b/src/test/resources/compat/scenarios/recursive-inputs/02-introspect.graphql new file mode 100644 index 00000000..7efc5c33 --- /dev/null +++ b/src/test/resources/compat/scenarios/recursive-inputs/02-introspect.graphql @@ -0,0 +1,6 @@ +query Introspect { + __schema { + directives { name args { name defaultValue type { kind name ofType { kind name ofType { kind name } } } } } + types { name inputFields { name type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } + } +} diff --git a/src/test/resources/compat/scenarios/recursive-inputs/schema.graphqls b/src/test/resources/compat/scenarios/recursive-inputs/schema.graphqls new file mode 100644 index 00000000..7f300298 --- /dev/null +++ b/src/test/resources/compat/scenarios/recursive-inputs/schema.graphqls @@ -0,0 +1,29 @@ +directive @limit(range: RangeInput!, unit: LimitUnit = ITEMS, labels: [String!]) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION + +enum LimitUnit { + ITEMS + PAGES +} + +input RangeInput { + min: Int! + max: Int! +} + +type Query { + describe(filter: TreeFilter!): String! @limit(range: {min: 0, max: 5}, labels: ["a", "b"]) + names(first: Int @limit(range: {min: 1, max: 10}, unit: PAGES)): [String!]! +} + +input TreeFilter { + name: String + and: [TreeFilter!] + not: TreeFilter + child: ChildFilter +} + +input ChildFilter { + parent: TreeFilter + siblings: [[ChildFilter!]!] + depth: Int! @limit(range: {min: 1, max: 3}) +} diff --git a/src/test/resources/compat/scenarios/scalar-args/01-custom-scalar.graphql b/src/test/resources/compat/scenarios/scalar-args/01-custom-scalar.graphql new file mode 100644 index 00000000..96f15786 --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/01-custom-scalar.graphql @@ -0,0 +1 @@ +{ tag(tag: "kotlin") tags(tags: ["a", "b"]) } diff --git a/src/test/resources/compat/scenarios/scalar-args/02-id.graphql b/src/test/resources/compat/scenarios/scalar-args/02-id.graphql new file mode 100644 index 00000000..a6cd5e09 --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/02-id.graphql @@ -0,0 +1 @@ +{ id(id: "42") } diff --git a/src/test/resources/compat/scenarios/scalar-args/03-nested-sets.graphql b/src/test/resources/compat/scenarios/scalar-args/03-nested-sets.graphql new file mode 100644 index 00000000..2f6288dd --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/03-nested-sets.graphql @@ -0,0 +1 @@ +{ nestedSets(tags: [["a", "a", "b"], ["c"]]) } diff --git a/src/test/resources/compat/scenarios/scalar-args/04-nested-lists.graphql b/src/test/resources/compat/scenarios/scalar-args/04-nested-lists.graphql new file mode 100644 index 00000000..c51981e1 --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/04-nested-lists.graphql @@ -0,0 +1 @@ +{ nestedLists(tags: [["a", "a", "b"], ["c"]]) } diff --git a/src/test/resources/compat/scenarios/scalar-args/05-empty-kotlin-scalar.graphql b/src/test/resources/compat/scenarios/scalar-args/05-empty-kotlin-scalar.graphql new file mode 100644 index 00000000..8f06720a --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/05-empty-kotlin-scalar.graphql @@ -0,0 +1 @@ +{ tokenInput(input: { token: "input" }) } diff --git a/src/test/resources/compat/scenarios/scalar-args/06-marked-empty-kotlin-scalars.graphql b/src/test/resources/compat/scenarios/scalar-args/06-marked-empty-kotlin-scalars.graphql new file mode 100644 index 00000000..641761cd --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/06-marked-empty-kotlin-scalars.graphql @@ -0,0 +1 @@ +{ markedTokens(input: { typed: "typed", wrapped: "wrapped", ids: ["first", "second"] }) } diff --git a/src/test/resources/compat/scenarios/scalar-args/07-optional-marked-empty-kotlin-scalars.graphql b/src/test/resources/compat/scenarios/scalar-args/07-optional-marked-empty-kotlin-scalars.graphql new file mode 100644 index 00000000..494654aa --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/07-optional-marked-empty-kotlin-scalars.graphql @@ -0,0 +1,4 @@ +{ + optionalTypedToken(token: "optional") + optionalIdToken(token: "optional") +} diff --git a/src/test/resources/compat/scenarios/scalar-args/schema.graphqls b/src/test/resources/compat/scenarios/scalar-args/schema.graphqls new file mode 100644 index 00000000..8f527f56 --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-args/schema.graphqls @@ -0,0 +1,27 @@ +scalar Tag +scalar Token +scalar TypedToken +scalar WrappedToken +scalar IdToken + +type Query { + tag(tag: Tag!): String! + tags(tags: [Tag!]!): String! + id(id: ID!): String! + nestedSets(tags: [[String!]!]!): String! + nestedLists(tags: [[String!]!]!): String! + tokenInput(input: TokenInput!): String! + markedTokens(input: MarkedTokensInput!): String! + optionalTypedToken(token: TypedToken): String! + optionalIdToken(token: IdToken): String! +} + +input TokenInput { + token: Token +} + +input MarkedTokensInput { + typed: TypedToken + wrapped: WrappedToken + ids: [IdToken!] +} diff --git a/src/test/resources/compat/scenarios/scalar-directives/01-introspect-scalars.graphql b/src/test/resources/compat/scenarios/scalar-directives/01-introspect-scalars.graphql new file mode 100644 index 00000000..77098e98 --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-directives/01-introspect-scalars.graphql @@ -0,0 +1,3 @@ +query { + __schema { types { name kind description specifiedByURL } } +} diff --git a/src/test/resources/compat/scenarios/scalar-directives/02-use-scalars.graphql b/src/test/resources/compat/scenarios/scalar-directives/02-use-scalars.graphql new file mode 100644 index 00000000..e0f4fdc3 --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-directives/02-use-scalars.graphql @@ -0,0 +1,6 @@ +query { + today + now + shift(from: "2020-01-01") + price +} diff --git a/src/test/resources/compat/scenarios/scalar-directives/schema.graphqls b/src/test/resources/compat/scenarios/scalar-directives/schema.graphqls new file mode 100644 index 00000000..87ba3a39 --- /dev/null +++ b/src/test/resources/compat/scenarios/scalar-directives/schema.graphqls @@ -0,0 +1,17 @@ +directive @since(date: Date) on SCALAR | FIELD_DEFINITION +directive @unit(name: String!) on SCALAR + +"A calendar date" +scalar Date @specifiedBy(url: "https://example.com/date") +extend scalar Date @since(date: "2020-01-01") @unit(name: "day") + +scalar DateTime + +scalar Money + +type Query { + today: Date @since(date: "2021-01-01") + now: DateTime + shift(from: Date): Date + price: Money +} diff --git a/src/test/resources/compat/scenarios/sourceless-misbound/01-thumbnail.graphql b/src/test/resources/compat/scenarios/sourceless-misbound/01-thumbnail.graphql new file mode 100644 index 00000000..70583e56 --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless-misbound/01-thumbnail.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name thumbnail(size: 64) } } +} diff --git a/src/test/resources/compat/scenarios/sourceless-misbound/schema.graphqls b/src/test/resources/compat/scenarios/sourceless-misbound/schema.graphqls new file mode 100644 index 00000000..82fdf346 --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless-misbound/schema.graphqls @@ -0,0 +1,12 @@ +type Query { + folder: Folder! +} + +type Folder { + images: [Image!]! +} + +type Image { + name: String! + thumbnail(size: Int): String +} diff --git a/src/test/resources/compat/scenarios/sourceless-shadowed/01-shadowed.graphql b/src/test/resources/compat/scenarios/sourceless-shadowed/01-shadowed.graphql new file mode 100644 index 00000000..50b50a22 --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless-shadowed/01-shadowed.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name title } } +} diff --git a/src/test/resources/compat/scenarios/sourceless-shadowed/schema.graphqls b/src/test/resources/compat/scenarios/sourceless-shadowed/schema.graphqls new file mode 100644 index 00000000..e9a28d7c --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless-shadowed/schema.graphqls @@ -0,0 +1,12 @@ +type Query { + folder: Folder! +} + +type Folder { + images: [Image!]! +} + +type Image { + name: String! + title: String! +} diff --git a/src/test/resources/compat/scenarios/sourceless-unimplemented/01-helper.graphql b/src/test/resources/compat/scenarios/sourceless-unimplemented/01-helper.graphql new file mode 100644 index 00000000..50dd7b02 --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless-unimplemented/01-helper.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name imageBlob preview } } +} diff --git a/src/test/resources/compat/scenarios/sourceless-unimplemented/schema.graphqls b/src/test/resources/compat/scenarios/sourceless-unimplemented/schema.graphqls new file mode 100644 index 00000000..ac354e43 --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless-unimplemented/schema.graphqls @@ -0,0 +1,13 @@ +type Query { + folder: Folder! +} + +type Folder { + images: [Image!]! +} + +type Image { + name: String! + imageBlob: String! + preview: String +} diff --git a/src/test/resources/compat/scenarios/sourceless/01-local-context.graphql b/src/test/resources/compat/scenarios/sourceless/01-local-context.graphql new file mode 100644 index 00000000..15559cd9 --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless/01-local-context.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name imageBlob thumbnail(size: 64) caption } } +} diff --git a/src/test/resources/compat/scenarios/sourceless/02-contexts.graphql b/src/test/resources/compat/scenarios/sourceless/02-contexts.graphql new file mode 100644 index 00000000..6a5e7e1e --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless/02-contexts.graphql @@ -0,0 +1,3 @@ +query { + folder { images { name owner locale signature } } +} diff --git a/src/test/resources/compat/scenarios/sourceless/schema.graphqls b/src/test/resources/compat/scenarios/sourceless/schema.graphqls new file mode 100644 index 00000000..21659169 --- /dev/null +++ b/src/test/resources/compat/scenarios/sourceless/schema.graphqls @@ -0,0 +1,18 @@ +type Query { + folder: Folder! +} + +type Folder { + supportedFileTypes: [String!]! + images: [Image!]! +} + +type Image { + name: String! + imageBlob: String! + thumbnail(size: Int!): String! + owner: String + locale: String! + signature: String! + caption: String! +} diff --git a/src/test/resources/compat/scenarios/type-extensions-input-order/01-count.graphql b/src/test/resources/compat/scenarios/type-extensions-input-order/01-count.graphql new file mode 100644 index 00000000..20456a0e --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions-input-order/01-count.graphql @@ -0,0 +1,3 @@ +query { + count(filter: { term: "a", limit: 1, offset: 2 }) +} diff --git a/src/test/resources/compat/scenarios/type-extensions-input-order/schema.graphqls b/src/test/resources/compat/scenarios/type-extensions-input-order/schema.graphqls new file mode 100644 index 00000000..8fb7ff41 --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions-input-order/schema.graphqls @@ -0,0 +1,15 @@ +type Query { + count(filter: Filter): Int! +} + +extend input Filter { + limit: Int +} + +input Filter { + term: String +} + +extend input Filter { + offset: Int +} diff --git a/src/test/resources/compat/scenarios/type-extensions-repeated-fields/01-kept-declarations.graphql b/src/test/resources/compat/scenarios/type-extensions-repeated-fields/01-kept-declarations.graphql new file mode 100644 index 00000000..46ca005e --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions-repeated-fields/01-kept-declarations.graphql @@ -0,0 +1,10 @@ +query { + typeAndExtension { name } + twoExtensions { id name } + oneDefinition { name } + echo( + typeAndExtension: { id: "1" } + twoExtensions: { term: "t", id: "2" } + oneDefinition: { id: "3" } + ) +} diff --git a/src/test/resources/compat/scenarios/type-extensions-repeated-fields/02-introspection.graphql b/src/test/resources/compat/scenarios/type-extensions-repeated-fields/02-introspection.graphql new file mode 100644 index 00000000..2ae3452f --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions-repeated-fields/02-introspection.graphql @@ -0,0 +1,9 @@ +query { + __schema { + types { + name + fields { name description } + inputFields { name description } + } + } +} diff --git a/src/test/resources/compat/scenarios/type-extensions-repeated-fields/schema.graphqls b/src/test/resources/compat/scenarios/type-extensions-repeated-fields/schema.graphqls new file mode 100644 index 00000000..94479c98 --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions-repeated-fields/schema.graphqls @@ -0,0 +1,72 @@ +type Query { + typeAndExtension: TypeAndExtension + twoExtensions: TwoExtensions + oneDefinition: OneDefinition + echo( + typeAndExtension: InputTypeAndExtension + twoExtensions: InputTwoExtensions + oneDefinition: InputOneDefinition + ): String +} + +type TypeAndExtension { + "From the type" + name: String +} + +extend type TypeAndExtension { + "From the extension" + name: String +} + +type TwoExtensions { + id: ID +} + +extend type TwoExtensions { + "From the first extension" + name: String +} + +extend type TwoExtensions { + "From the second extension" + name: String +} + +type OneDefinition { + "The first" + name: String + "The second" + name: String +} + +input InputTypeAndExtension { + "From the type" + id: ID +} + +extend input InputTypeAndExtension { + "From the extension" + id: ID +} + +input InputTwoExtensions { + term: String +} + +extend input InputTwoExtensions { + "From the first extension" + id: ID +} + +extend input InputTwoExtensions { + "From the second extension" + id: ID +} + +input InputOneDefinition { + "The first" + id: ID + "The second" + id: ID +} diff --git a/src/test/resources/compat/scenarios/type-extensions-sealed/01-pets-and-animals.graphql b/src/test/resources/compat/scenarios/type-extensions-sealed/01-pets-and-animals.graphql new file mode 100644 index 00000000..98533be9 --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions-sealed/01-pets-and-animals.graphql @@ -0,0 +1,11 @@ +query { + pets { + __typename + ... on Dog { name } + ... on Cat { lives } + } + animals { + __typename + name + } +} diff --git a/src/test/resources/compat/scenarios/type-extensions-sealed/schema.graphqls b/src/test/resources/compat/scenarios/type-extensions-sealed/schema.graphqls new file mode 100644 index 00000000..bdac91b3 --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions-sealed/schema.graphqls @@ -0,0 +1,30 @@ +type Query { + pets: [Pet!]! + animals: [Animal!]! +} + +union Pet = Dog + +extend union Pet = Cat + +type Dog { + name: String +} + +type Cat { + lives: Int +} + +interface Animal { + name: String +} + +type Cow implements Animal { + name: String +} + +type Horse { + name: String +} + +extend type Horse implements Animal diff --git a/src/test/resources/compat/scenarios/type-extensions/01-node.graphql b/src/test/resources/compat/scenarios/type-extensions/01-node.graphql new file mode 100644 index 00000000..07289dca --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions/01-node.graphql @@ -0,0 +1,16 @@ +query { + article: node(id: "a1") { + __typename + id + createdAt + name + ... on Article { title } + } + video: node(id: "v1") { + __typename + id + createdAt + name + ... on Video { seconds } + } +} diff --git a/src/test/resources/compat/scenarios/type-extensions/02-search-and-enums.graphql b/src/test/resources/compat/scenarios/type-extensions/02-search-and-enums.graphql new file mode 100644 index 00000000..f578be07 --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions/02-search-and-enums.graphql @@ -0,0 +1,10 @@ +query { + search { + __typename + ... on Article { title } + ... on Video { seconds } + } + colors + shades + count(filter: { term: "launched", limit: 5 }) +} diff --git a/src/test/resources/compat/scenarios/type-extensions/03-introspection.graphql b/src/test/resources/compat/scenarios/type-extensions/03-introspection.graphql new file mode 100644 index 00000000..088b57c7 --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions/03-introspection.graphql @@ -0,0 +1,13 @@ +query { + __schema { + types { + name + kind + fields { name description } + interfaces { name } + possibleTypes { name } + enumValues { name description } + inputFields { name } + } + } +} diff --git a/src/test/resources/compat/scenarios/type-extensions/schema.graphqls b/src/test/resources/compat/scenarios/type-extensions/schema.graphqls new file mode 100644 index 00000000..4773779c --- /dev/null +++ b/src/test/resources/compat/scenarios/type-extensions/schema.graphqls @@ -0,0 +1,70 @@ +directive @tag(name: String!) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT +directive @owner(team: String!) on OBJECT + +type Query { + node(id: ID!): Node + search: [SearchResult!]! + colors: [Color!]! + shades: [Shade!]! + count(filter: Filter!): Int! +} + +interface Node @tag(name: "base") { + "The base id" + id: ID! + createdAt: String +} + +extend interface Node @tag(name: "extension") { + name: String +} + +type Article implements Node @owner(team: "content") @tag(name: "base") { + id: ID! + createdAt: String + name: String + title: String +} + +extend type Article @tag(name: "extension") + +type Video { + id: ID! + createdAt: String + name: String + seconds: Int +} + +extend type Video implements Node + +union SearchResult @tag(name: "base") = Article + +extend union SearchResult @tag(name: "extension") = Video + +enum Color @tag(name: "base") { + "The first red" + RED + BLUE +} + +extend enum Color @tag(name: "extension") { + GREEN +} + +extend enum Shade { LIGHT } + +extend enum Shade { DARK } + +input Filter @tag(name: "base") { + term: String +} + +extend input Filter @tag(name: "extension") { + limit: Int +} + +type Note { + text: String +} + +extend union Note = Article diff --git a/src/test/resources/compat/scenarios/unmapped-inputs/01-ignored.graphql b/src/test/resources/compat/scenarios/unmapped-inputs/01-ignored.graphql new file mode 100644 index 00000000..da3a853c --- /dev/null +++ b/src/test/resources/compat/scenarios/unmapped-inputs/01-ignored.graphql @@ -0,0 +1,3 @@ +query { + ignored(input: { inner: { name: "a", legacy: "x" } }) +} diff --git a/src/test/resources/compat/scenarios/unmapped-inputs/02-typo.graphql b/src/test/resources/compat/scenarios/unmapped-inputs/02-typo.graphql new file mode 100644 index 00000000..f6465561 --- /dev/null +++ b/src/test/resources/compat/scenarios/unmapped-inputs/02-typo.graphql @@ -0,0 +1,3 @@ +query { + typo(input: { item: { name: "b" } }) +} diff --git a/src/test/resources/compat/scenarios/unmapped-inputs/schema.graphqls b/src/test/resources/compat/scenarios/unmapped-inputs/schema.graphqls new file mode 100644 index 00000000..b466a9a9 --- /dev/null +++ b/src/test/resources/compat/scenarios/unmapped-inputs/schema.graphqls @@ -0,0 +1,21 @@ +type Query { + ignored(input: IgnoredInput!): String + typo(input: TypoInput!): String +} + +input IgnoredInput { + inner: InnerInput +} + +input InnerInput { + name: String + legacy: String +} + +input TypoInput { + item: ItemInput +} + +input ItemInput { + name: String +} diff --git a/src/test/resources/compat/scenarios/wiring-shapes/01-trees.graphql b/src/test/resources/compat/scenarios/wiring-shapes/01-trees.graphql new file mode 100644 index 00000000..abf0d8fc --- /dev/null +++ b/src/test/resources/compat/scenarios/wiring-shapes/01-trees.graphql @@ -0,0 +1,3 @@ +query { + trees(filter: { name: "a", children: [{ name: "b" }, { name: "c", children: [{ name: "d" }] }] }) +} diff --git a/src/test/resources/compat/scenarios/wiring-shapes/02-person.graphql b/src/test/resources/compat/scenarios/wiring-shapes/02-person.graphql new file mode 100644 index 00000000..9a424c39 --- /dev/null +++ b/src/test/resources/compat/scenarios/wiring-shapes/02-person.graphql @@ -0,0 +1,4 @@ +query { + person { name friend { name } state someone { ... on Person { name } } } + someone { ... on Named { name } } +} diff --git a/src/test/resources/compat/scenarios/wiring-shapes/schema.graphqls b/src/test/resources/compat/scenarios/wiring-shapes/schema.graphqls new file mode 100644 index 00000000..180fe7d6 --- /dev/null +++ b/src/test/resources/compat/scenarios/wiring-shapes/schema.graphqls @@ -0,0 +1,32 @@ +directive @inspect on INPUT_FIELD_DEFINITION +directive @required on FIELD_DEFINITION +directive @described on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT + +type Query { + trees(filter: TreeFilter): Int + person: Person + someone: Someone +} + +input TreeFilter @described { + name: String + children: [TreeFilter!] @inspect +} + +interface Named @described { + name: String +} + +type Person implements Named @described { + name: String + friend: Person @required + state: State @required + someone: Someone +} + +union Someone @described = Person + +enum State @described { + ALIVE + GONE +} diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml new file mode 100644 index 00000000..75ea21c4 --- /dev/null +++ b/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + + %d{HH:mm:ss.SSS} [%thread] %level %logger -%kvp- %msg%n + + + + + + + + + diff --git a/src/test/resources/returnvalue/Check.java b/src/test/resources/returnvalue/Check.java new file mode 100644 index 00000000..ee8fa9ea --- /dev/null +++ b/src/test/resources/returnvalue/Check.java @@ -0,0 +1,872 @@ +package unwrapcheck; + +import graphql.ExecutionInput; +import graphql.ExecutionResult; +import graphql.GraphQL; +import graphql.GraphqlErrorBuilder; +import graphql.execution.DataFetcherResult; +import graphql.kickstart.tools.GraphQLResolver; +import graphql.kickstart.tools.SchemaParser; +import graphql.kickstart.tools.SchemaParserBuilder; +import graphql.kickstart.tools.SchemaParserOptions; +import graphql.kickstart.tools.SchemaParserOptions.GenericWrapper; +import graphql.schema.DataFetcher; +import graphql.schema.FieldCoordinates; +import graphql.schema.GraphQLSchema; +import unwrapcheck.Fixtures.FutureItem; +import unwrapcheck.Fixtures.Later; +import unwrapcheck.Fixtures.Page; +import unwrapcheck.Fixtures.Payload; +import unwrapcheck.Fixtures.Try; + +import javax.tools.DiagnosticCollector; +import javax.tools.FileObject; +import javax.tools.ForwardingJavaFileManager; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.PrintStream; +import java.lang.reflect.Field; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.FutureTask; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.function.Consumer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +public final class Check { + + enum Container { + LIST("java.util.List", Variant.VALUE, Variant.NULL, Variant.EMPTY), + PAGE("unwrapcheck.Fixtures.Page", Variant.VALUE, Variant.NULL, Variant.EMPTY), + COMPLETABLE_FUTURE("java.util.concurrent.CompletableFuture", Variant.VALUE, Variant.NULL, Variant.FAILED), + FUTURE("java.util.concurrent.Future", Variant.VALUE, Variant.NULL, Variant.FUTURE_TASK), + LATER("unwrapcheck.Fixtures.Later", Variant.VALUE, Variant.NULL, Variant.FAILED), + TRY("unwrapcheck.Fixtures.Try", Variant.VALUE, Variant.NULL, Variant.FAILED), + DATA_FETCHER_RESULT("graphql.execution.DataFetcherResult", Variant.VALUE, Variant.NULL, Variant.WITH_ERROR), + OPTIONAL("java.util.Optional", Variant.VALUE, Variant.EMPTY); + + final String javaName; + final List variants; + + Container(String javaName, Variant... variants) { + this.javaName = javaName; + this.variants = List.of(variants); + } + + boolean isList() { + return this == LIST || this == PAGE; + } + + boolean isFuture() { + return this == COMPLETABLE_FUTURE || this == FUTURE || this == LATER; + } + } + + enum Leaf { + PAYLOAD("unwrapcheck.Fixtures.Payload", "Payload", " { data }"), + STRING("java.lang.String", "String", ""), + OBJECT("java.lang.Object", "Item", " { __typename ... on Payload { data } ... on FutureItem { data } }"); + + final String javaName; + final String graphQLName; + final String selection; + + Leaf(String javaName, String graphQLName, String selection) { + this.javaName = javaName; + this.graphQLName = graphQLName; + this.selection = selection; + } + } + + enum Kind { + METHOD("method", "method", "Return a CompletionStage, such as a CompletableFuture, from the method or its generic wrapper transformer instead.", + List.of(Nullability.values()), List.of(Timing.values())), + PROPERTY("property", "field", "Assign a CompletionStage, such as a CompletableFuture, to the field, or return one from its generic wrapper transformer instead.", + List.of(Nullability.NULLABLE), List.of(Timing.DONE, Timing.PENDING_IN_ORDER)), + MAP("map", "map value", "Put a CompletionStage, such as a CompletableFuture, in the map, or return one from its generic wrapper transformer instead.", + List.of(Nullability.NULLABLE), List.of(Timing.DONE, Timing.PENDING_IN_ORDER)); + + final String label; + final String resolverKind; + final String holdCompletionStage; + final List nullabilities; + final List timings; + + Kind(String label, String resolverKind, String holdCompletionStage, List nullabilities, List timings) { + this.label = label; + this.resolverKind = resolverKind; + this.holdCompletionStage = holdCompletionStage; + this.nullabilities = nullabilities; + this.timings = timings; + } + } + + enum Nullability {NULLABLE, NON_NULL} + + enum Variant {VALUE, NULL, EMPTY, FAILED, FUTURE_TASK, WITH_ERROR, FUTURE_ITEM} + + enum Timing { + DONE("before the data fetcher returns"), + PENDING_IN_ORDER("after the data fetcher returns, first created first"), + PENDING_REVERSED("after the data fetcher returns, last created first"); + + final String description; + + Timing(String description) { + this.description = description; + } + } + + static final class Case { + final List shape; + final Leaf leaf; + final Kind kind; + final Nullability nullability; + final String className; + + Case(List shape, Leaf leaf, Kind kind, Nullability nullability, String className) { + this.shape = shape; + this.leaf = leaf; + this.kind = kind; + this.nullability = nullability; + this.className = className; + } + + String javaType() { + String type = leaf.javaName; + for (int i = shape.size() - 1; i >= 0; i--) { + type = shape.get(i).javaName + "<" + type + ">"; + } + return type; + } + + String graphQLType() { + boolean nonNull = nullability == Nullability.NON_NULL; + String type = leaf.graphQLName + (nonNull ? "!" : ""); + long lists = shape.stream().filter(Container::isList).count(); + for (long i = 0; i < lists; i++) { + type = "[" + type + "]" + (nonNull ? "!" : ""); + } + return type; + } + + String shortJavaType() { + return javaType().replace("unwrapcheck.Fixtures.", "").replaceAll("[a-z.]+\\.(?=[A-Z])", ""); + } + + String label() { + return kind.label + " " + shortJavaType(); + } + + String describe() { + switch (kind) { + case METHOD: + return "public " + shortJavaType() + " field() for field: " + graphQLType(); + case PROPERTY: + return "public " + shortJavaType() + " field; for field: " + graphQLType(); + default: + return "extends HashMap for Holder.field: " + graphQLType(); + } + } + + String parentType() { + return kind == Kind.MAP ? "Holder" : "Query"; + } + + String query() { + String field = "field" + leaf.selection; + return "query { " + (kind == Kind.MAP ? "holder { " + field + " }" : field) + " }"; + } + } + + static final class Plan { + final Variant variant; + final List children; + final int cost; + + Plan(Variant variant, List children, int cost) { + this.variant = variant; + this.children = children; + this.cost = cost; + } + } + + static final class Built { + final Object returned; + final Object expected; + final String text; + + Built(Object returned, Object expected, String text) { + this.returned = returned; + this.expected = expected; + this.text = text; + } + } + + static final class Context { + final Timing timing; + final String resolverName; + final List completions = new ArrayList<>(); + final Set failures = new LinkedHashSet<>(); + int nextId = 1; + + Context(Timing timing, String resolverName) { + this.timing = timing; + this.resolverName = resolverName; + } + + CompletableFuture future(Object value, String failure) { + if (timing == Timing.DONE) { + return failure == null ? CompletableFuture.completedFuture(value) : CompletableFuture.failedFuture(new IllegalStateException(failure)); + } + CompletableFuture future = new CompletableFuture<>(); + completions.add(() -> { + if (failure == null) { + future.complete(value); + } else { + future.completeExceptionally(new IllegalStateException(failure)); + } + }); + return future; + } + } + + static final class Violation { + final Case testCase; + final String value; + final Timing timing; + final String expected; + final String actual; + + Violation(Case testCase, String value, Timing timing, String expected, String actual) { + this.testCase = testCase; + this.value = value; + this.timing = timing; + this.expected = expected; + this.actual = actual; + } + } + + static final class KnownFinding { + final int returnTypes; + final Pattern pattern; + final String description; + final Set covered = new LinkedHashSet<>(); + + KnownFinding(int returnTypes, Pattern pattern, String description) { + this.returnTypes = returnTypes; + this.pattern = pattern; + this.description = description; + } + } + + private static final int DEPTH = 3; + private static final int BUDGET = 2; + private static final int PROPERTY_BUDGET = 1; + private static final String KNOWN_FILE = "src/test/resources/returnvalue/known-findings.txt"; + private static final String BLOCKED = "the data fetcher blocked until they completed"; + + private static volatile Object oracleValue; + private static volatile String oracleFailure; + + private static final ExecutorService fetching = Executors.newSingleThreadExecutor(runnable -> { + Thread thread = new Thread(runnable, "fetch"); + thread.setDaemon(true); + return thread; + }); + + private static final SchemaParserOptions options = SchemaParserOptions.newOptions() + .genericWrappers( + GenericWrapper.withTransformer(Try.class, 0, (Try t) -> t.get(), type -> type), + GenericWrapper.listCollectionWithTransformer(Page.class, 0, (Page p) -> p.getContent()), + GenericWrapper.withCompletionStageTransformer(Later.class, 0, (Later l) -> l.toFuture())) + .build(); + + private static final List mustAccept = List.of( + "java.util.List> [Payload]", + "java.util.concurrent.CompletableFuture>> [Payload]", + "graphql.execution.DataFetcherResult>> [String]", + "java.util.Optional>> [Item]", + "java.util.List>> [Item!]!" + ); + + private static final List pinnedCoverage = List.of( + "7020 return types", + "method: 861 rejected, 171693 executions", + "property: 252 rejected, 27292 executions", + "map: 252 rejected, 27292 executions" + ); + + public static boolean check(String[] args, String classpath, PrintStream out) throws Exception { + int depth = intArg(args, "--depth", DEPTH); + int budget = intArg(args, "--budget", BUDGET); + int propertyBudget = intArg(args, "--property-budget", PROPERTY_BUDGET); + int show = intArg(args, "--show", 15); + long started = System.nanoTime(); + + Set built = Arrays.stream(Container.values()).map(it -> it.javaName).collect(Collectors.toSet()); + List unchecked = Arrays.stream(stringArg(args, "--container-kinds").split(",")) + .filter(it -> !built.contains(it)) + .collect(Collectors.toList()); + if (!unchecked.isEmpty()) { + out.println("MODEL ERROR: TypeShape.kt has a ContainerKind for these classes, but no Container in Check.java builds them, so a pass would prove nothing about them:"); + unchecked.forEach(it -> out.println(" " + it)); + out.println("Add a Container for each to Check.java with its value variants, and its plain value in build."); + return false; + } + + Set exercised = Arrays.stream(Kind.values()).map(it -> it.resolverKind).collect(Collectors.toSet()); + List unexercised = Arrays.stream(stringArg(args, "--resolver-kinds").split(",")) + .filter(it -> !exercised.contains(it)) + .collect(Collectors.toList()); + if (!unexercised.isEmpty()) { + out.println("MODEL ERROR: ResolverPlan.kt has a ResolverKind with these nouns, but no Kind in Check.java resolves through them, so a pass would prove nothing about them:"); + unexercised.forEach(it -> out.println(" " + it)); + out.println("Add a Kind for each to Check.java with its holdCompletionStage text, and build its resolver in the switches over Kind."); + return false; + } + + List cases = cases(depth); + Map> resolvers = compile(cases, classpath); + + Map rejectedByKind = new EnumMap<>(Kind.class); + Map runsByKind = new EnumMap<>(Kind.class); + boolean blocked = false; + Set accepted = new LinkedHashSet<>(); + Set acceptedReturnTypes = new LinkedHashSet<>(); + Map> violations = new LinkedHashMap<>(); + for (Case testCase : cases) { + Class generated = resolvers.get(testCase.className); + Object instance = generated.getDeclaredConstructor().newInstance(); + GraphQLSchema schema; + try { + schema = schema(testCase, instance); + } catch (RuntimeException e) { + rejectedByKind.merge(testCase.kind, 1, Integer::sum); + if (flag(args, "--rejected")) { + out.println("rejected " + testCase.describe() + ": " + e.getMessage().lines().findFirst().orElse("")); + } + continue; + } + accepted.add(testCase.kind.label + " " + testCase.javaType() + " " + testCase.graphQLType()); + acceptedReturnTypes.add(testCase.label()); + GraphQL actual = GraphQL.newGraphQL(schema).build(); + GraphQL oracle = GraphQL.newGraphQL(oracleSchema(schema, testCase.parentType())).build(); + Consumer returning = returning(testCase, generated, instance); + List timings = testCase.shape.stream().anyMatch(Container::isFuture) && !blocked ? testCase.kind.timings : List.of(Timing.DONE); + plans: + for (Plan plan : plansWithinBudget(testCase, 0, testCase.kind == Kind.METHOD ? budget : propertyBudget)) { + for (Timing timing : timings) { + runsByKind.merge(testCase.kind, 1, Integer::sum); + Violation violation = run(testCase, plan, timing, actual, oracle, returning); + if (violation != null) { + violations.computeIfAbsent(testCase, c -> new ArrayList<>()).add(violation); + if (violation.actual.equals(BLOCKED)) { + blocked = true; + break plans; + } + } + } + } + } + + List missing = Arrays.stream(Kind.values()) + .flatMap(kind -> mustAccept.stream() + .filter(it -> kind.nullabilities.contains(Nullability.NON_NULL) || !it.endsWith("!")) + .map(it -> kind.label + " " + it)) + .filter(it -> !accepted.contains(it)) + .collect(Collectors.toList()); + int rejected = rejectedByKind.values().stream().mapToInt(Integer::intValue).sum(); + int runs = runsByKind.values().stream().mapToInt(Integer::intValue).sum(); + out.printf("depth %d, budget %d (%d for properties and Maps): %d return types, %d rejected by the schema build, %d accepted, %d executions, %.1fs%n", + depth, budget, propertyBudget, cases.size(), rejected, accepted.size(), runs, (System.nanoTime() - started) / 1e9); + if (blocked) { + out.println("A data fetcher blocked on a pending future, so later return types ran with completed futures only."); + } + + Map> failing = new LinkedHashMap<>(); + violations.forEach((testCase, list) -> failing.computeIfAbsent(testCase.label(), it -> new ArrayList<>()).addAll(list)); + List known = knownFindings(stringArg(args, "--known")); + List> unknown = new ArrayList<>(); + for (String returnType : acceptedReturnTypes) { + Optional finding = known.stream().filter(it -> it.pattern.matcher(returnType).find()).findFirst(); + if (finding.isPresent()) { + finding.get().covered.add(returnType); + } else if (failing.containsKey(returnType)) { + unknown.add(failing.get(returnType)); + } + } + + for (KnownFinding finding : known) { + List stillFailing = finding.covered.stream().filter(failing::containsKey).collect(Collectors.toList()); + if (!stillFailing.isEmpty()) { + out.printf("%nKNOWN (%s): %d return types still fail, e.g.%n", finding.description, stillFailing.size()); + List first = failing.get(stillFailing.get(0)); + print(out, first.get(0), first.size()); + } + } + boolean passed = true; + if (!unknown.isEmpty()) { + int total = unknown.stream().mapToInt(List::size).sum(); + out.printf("%nFAIL: %d executions in %d return types gave graphql-java something other than the value the resolver returned.%n", total, unknown.size()); + unknown.stream().limit(show).forEach(list -> print(out, list.get(0), list.size())); + passed = false; + } + if (!missing.isEmpty() || runs == 0) { + out.println("\nMODEL ERROR: the schema build rejected return types the check must exercise, so a pass would prove nothing:"); + missing.forEach(it -> out.println(" " + it)); + passed = false; + } + if (depth == DEPTH && budget == BUDGET && propertyBudget == PROPERTY_BUDGET) { + List coverage = new ArrayList<>(List.of(cases.size() + " return types")); + for (Kind kind : Kind.values()) { + coverage.add(kind.label + ": " + rejectedByKind.getOrDefault(kind, 0) + " rejected, " + runsByKind.getOrDefault(kind, 0) + " executions"); + } + passed &= coverageIsPinned(coverage, out); + passed &= knownFindingsAreExact(known, failing.keySet(), show, out); + } + if (passed) { + out.println(violations.isEmpty() ? "PASS" : "\nPASS apart from the known findings above"); + } + return passed; + } + + private static boolean coverageIsPinned(List coverage, PrintStream out) { + if (coverage.equals(pinnedCoverage)) { + return true; + } + out.println("\nSTALE: this run's coverage differs from pinnedCoverage in Check.java. More rejected return types or fewer executions " + + "means the check stopped exercising something, which no other line of this report fails on:"); + for (int i = 0; i < coverage.size(); i++) { + if (!coverage.get(i).equals(pinnedCoverage.get(i))) { + out.println(" pinned " + pinnedCoverage.get(i) + ", got " + coverage.get(i)); + } + } + out.println("Diff --rejected output against the last commit to see which return types the build now rejects or accepts, " + + "and confirm the change is intended. Then set pinnedCoverage to these counts in the same diff:"); + coverage.forEach(it -> out.println(" \"" + it + "\"")); + return false; + } + + private static boolean knownFindingsAreExact(List known, Set failing, int show, PrintStream out) { + List stale = new ArrayList<>(); + List added = new ArrayList<>(); + for (KnownFinding finding : known) { + int covered = finding.covered.size(); + List passing = finding.covered.stream().filter(it -> !failing.contains(it)).collect(Collectors.toList()); + if (passing.size() == covered) { + stale.add(" " + finding.description + ": none of the " + covered + " return types it matches fail. Delete the line."); + } else if (!passing.isEmpty()) { + stale.add(" " + finding.description + ": " + passing.size() + " of the " + covered + " return types it matches pass. Narrow the line to the " + + (covered - passing.size()) + " that fail and set its count to that:"); + passing.stream().limit(show).forEach(it -> stale.add(" " + it)); + if (passing.size() > show) { + stale.add(" and " + (passing.size() - show) + " more, rerun with --show " + passing.size()); + } + } + String counts = " " + finding.description + ": the line records " + finding.returnTypes + " return types and matches " + covered + " that the schema build accepts."; + if (covered > finding.returnTypes) { + added.add(counts); + } else if (covered < finding.returnTypes) { + stale.add(counts + " Unless you just narrowed the line, the build now rejects a return type it used to accept. " + + "Find it by diffing --rejected output against the last commit, then set the count to " + covered + "."); + } + } + if (!added.isEmpty()) { + out.println("\nNEW: known findings in " + KNOWN_FILE + " match more return types than they record, so a new failure would print as KNOWN, not FAIL. " + + "Unless you just widened a line, the build now accepts a return type it used to reject, and that return type fails. " + + "Find it by diffing --rejected output against the last commit, and treat it as a FAIL:"); + added.forEach(out::println); + } + if (!stale.isEmpty()) { + out.println("\nSTALE: known findings in " + KNOWN_FILE + " no longer match exactly the return types that fail, so a regression in a fixed one would print as KNOWN, not FAIL:"); + stale.forEach(out::println); + } + return added.isEmpty() && stale.isEmpty(); + } + + private static List knownFindings(String path) throws Exception { + Pattern format = Pattern.compile("(\\d+) (.+?) # (.+)"); + List known = new ArrayList<>(); + for (String line : Files.readAllLines(Path.of(path))) { + if (!line.isBlank() && !line.startsWith("#")) { + Matcher parts = format.matcher(line.trim()); + if (!parts.matches()) { + throw new IllegalArgumentException("A known finding is \" >> # \", not: " + line); + } + known.add(new KnownFinding(Integer.parseInt(parts.group(1)), Pattern.compile(parts.group(2)), parts.group(3))); + } + } + return known; + } + + private static void print(PrintStream out, Violation v, int count) { + out.println(); + out.println(v.testCase.describe() + (count > 1 ? " (" + count + " failing executions, first shown)" : "")); + out.println(" returns: " + v.value); + if (v.testCase.shape.stream().anyMatch(Container::isFuture)) { + out.println(" futures complete " + v.timing.description); + } + out.println(" expected: " + v.expected); + out.println(" got: " + v.actual); + } + + static List cases(int depth) { + List> shapes = new ArrayList<>(); + shapes.add(List.of()); + for (int start = 0, size = 0; size < depth; size++) { + int end = shapes.size(); + for (int i = start; i < end; i++) { + for (Container container : Container.values()) { + List shape = new ArrayList<>(); + shape.add(container); + shape.addAll(shapes.get(i)); + shapes.add(List.copyOf(shape)); + } + } + start = end; + } + List cases = new ArrayList<>(); + for (int i = 0; i < shapes.size(); i++) { + for (Leaf leaf : Leaf.values()) { + for (Kind kind : Kind.values()) { + String className = "unwrapcheck.gen.R" + i + "_" + leaf.ordinal() + "_" + kind.ordinal(); + for (Nullability nullability : kind.nullabilities) { + cases.add(new Case(shapes.get(i), leaf, kind, nullability, className)); + } + } + } + } + return cases; + } + + static List plansWithinBudget(Case testCase, int level, int budget) { + List plans = new ArrayList<>(); + if (level == testCase.shape.size()) { + plans.add(new Plan(Variant.VALUE, List.of(), 0)); + if (budget > 0) { + plans.add(new Plan(Variant.NULL, List.of(), 1)); + if (testCase.leaf == Leaf.OBJECT) { + plans.add(new Plan(Variant.FUTURE_ITEM, List.of(), 1)); + } + } + return plans; + } + Container container = testCase.shape.get(level); + for (Variant variant : container.variants) { + int cost = variant == Variant.VALUE ? 0 : 1; + if (cost > budget) { + continue; + } + boolean hasInner = variant == Variant.VALUE || variant == Variant.WITH_ERROR; + if (!hasInner) { + plans.add(new Plan(variant, List.of(), cost)); + } else if (container.isList()) { + for (Plan first : plansWithinBudget(testCase, level + 1, budget - cost)) { + for (Plan second : plansWithinBudget(testCase, level + 1, budget - cost - first.cost)) { + plans.add(new Plan(variant, List.of(first, second), cost + first.cost + second.cost)); + } + } + } else { + for (Plan inner : plansWithinBudget(testCase, level + 1, budget - cost)) { + plans.add(new Plan(variant, List.of(inner), cost + inner.cost)); + } + } + } + return plans; + } + + static Built build(Case testCase, Plan plan, int level, Context context) { + if (level == testCase.shape.size()) { + if (plan.variant == Variant.NULL) { + return new Built(null, null, "null"); + } + String id = "v" + context.nextId++; + if (plan.variant == Variant.FUTURE_ITEM) { + return new Built(new FutureItem(id), new FutureItem(id), "FutureItem(" + id + ")"); + } + if (testCase.leaf == Leaf.STRING) { + return new Built(id, id, "\"" + id + "\""); + } + return new Built(new Payload(id), new Payload(id), "Payload(" + id + ")"); + } + Container container = testCase.shape.get(level); + switch (plan.variant) { + case NULL: + return new Built(null, null, "null"); + case EMPTY: + switch (container) { + case LIST: + return new Built(List.of(), List.of(), "List[]"); + case PAGE: + return new Built(new Page<>(List.of()), List.of(), "Page[]"); + default: + return new Built(Optional.empty(), null, "Optional.empty()"); + } + case FAILED: { + String failure = "failed " + container.name().toLowerCase() + " v" + context.nextId++; + context.failures.add(failure); + switch (container) { + case TRY: + return new Built(Try.failure(failure), null, "Try.failure(\"" + failure + "\")"); + case LATER: + return new Built(new Later<>(context.future(null, failure)), null, "Later(failed CompletableFuture \"" + failure + "\")"); + default: + return new Built(context.future(null, failure), null, "failed CompletableFuture(\"" + failure + "\")"); + } + } + case FUTURE_TASK: { + context.failures.add("Resolver " + testCase.kind.resolverKind + " '" + context.resolverName + "' resolved to a " + FutureTask.class.getName() + + ", which graphql-java can't wait on. " + testCase.kind.holdCompletionStage); + FutureTask task = new FutureTask<>(() -> null); + task.run(); + return new Built(task, null, "FutureTask"); + } + default: + break; + } + List inner = new ArrayList<>(); + for (Plan child : plan.children) { + inner.add(build(testCase, child, level + 1, context)); + } + Built first = inner.get(0); + switch (container) { + case LIST: + case PAGE: { + List returned = inner.stream().map(it -> it.returned).collect(Collectors.toCollection(ArrayList::new)); + List expected = inner.stream().map(it -> it.expected).collect(Collectors.toCollection(ArrayList::new)); + String text = inner.stream().map(it -> it.text).collect(Collectors.joining(", ", "[", "]")); + return container == Container.LIST ? new Built(returned, expected, "List" + text) : new Built(new Page<>(returned), expected, "Page" + text); + } + case COMPLETABLE_FUTURE: + case FUTURE: + return new Built(context.future(first.returned, null), first.expected, "CompletableFuture(" + first.text + ")"); + case LATER: + return new Built(new Later<>(context.future(first.returned, null)), first.expected, "Later(CompletableFuture(" + first.text + "))"); + case TRY: + return new Built(Try.success(first.returned), first.expected, "Try.success(" + first.text + ")"); + case OPTIONAL: + return new Built(Optional.ofNullable(first.returned), first.expected, "Optional.ofNullable(" + first.text + ")"); + default: { + boolean withError = plan.variant == Variant.WITH_ERROR; + String error = "error beside " + first.text; + return new Built(result(first.returned, withError ? error : null), result(first.expected, withError ? error : null), + "DataFetcherResult(" + first.text + (withError ? ", error)" : ")")); + } + } + } + + private static DataFetcherResult result(Object data, String error) { + DataFetcherResult.Builder builder = DataFetcherResult.newResult().data(data); + if (error != null) { + builder.error(GraphqlErrorBuilder.newError().message(error).build()); + } + return builder.build(); + } + + static Violation run(Case testCase, Plan plan, Timing timing, GraphQL actual, GraphQL oracle, Consumer returning) { + Context context = new Context(timing, testCase.className + ".field"); + Built built = build(testCase, plan, 0, context); + if (timing == Timing.PENDING_REVERSED) { + Collections.reverse(context.completions); + } + + String got; + String query = testCase.query(); + returning.accept(built.returned); + java.util.concurrent.Future> fetch = fetching.submit(() -> actual.executeAsync(ExecutionInput.newExecutionInput().query(query).build())); + CompletableFuture result; + try { + try { + result = fetch.get(1, TimeUnit.SECONDS); + } catch (TimeoutException e) { + context.completions.forEach(Runnable::run); + return new Violation(testCase, built.text, timing, "the data fetcher returns before its futures complete", BLOCKED); + } + context.completions.forEach(Runnable::run); + got = result.get(2, TimeUnit.SECONDS).toSpecification().toString(); + } catch (TimeoutException e) { + return new Violation(testCase, built.text, timing, "a result once every future completed", "no result after 2 seconds"); + } catch (Exception e) { + return new Violation(testCase, built.text, timing, "a result", "execute threw " + e); + } + + List acceptable = new ArrayList<>(); + if (context.failures.isEmpty()) { + oracleValue = built.expected; + oracleFailure = null; + acceptable.add(oracle.execute(query).toSpecification().toString()); + } else { + for (String failure : context.failures) { + oracleValue = null; + oracleFailure = failure; + acceptable.add(oracle.execute(query).toSpecification().toString()); + } + } + return acceptable.contains(got) ? null : new Violation(testCase, built.text, timing, String.join("\n or ", acceptable), got); + } + + static Consumer returning(Case testCase, Class generated, Object instance) throws Exception { + switch (testCase.kind) { + case METHOD: + return value -> Fixtures.nextReturnValue = value; + case PROPERTY: { + Field field = generated.getField("field"); + return value -> { + try { + field.set(instance, value); + } catch (IllegalAccessException e) { + throw new IllegalStateException(e); + } + }; + } + default: + return value -> { + @SuppressWarnings("unchecked") + Map holder = (Map) instance; + holder.put("field", value); + Fixtures.nextReturnValue = holder; + }; + } + } + + static GraphQLSchema schema(Case testCase, Object generated) { + SchemaParserBuilder parser = SchemaParser.newParser().options(options); + String sdl; + if (testCase.kind == Kind.MAP) { + sdl = "type Query { holder: Holder }\ntype Holder { field: " + testCase.graphQLType() + " }\n"; + parser.resolvers(new Fixtures.HolderQuery()).dictionary("Holder", generated.getClass()); + } else { + sdl = "type Query { field: " + testCase.graphQLType() + " }\n"; + parser.resolvers((GraphQLResolver) generated); + } + if (testCase.leaf != Leaf.STRING) { + sdl += "type Payload { data: String }\n"; + } + if (testCase.leaf == Leaf.OBJECT) { + sdl += "type FutureItem { data: String }\nunion Item = Payload | FutureItem\n"; + parser.dictionary(Payload.class, FutureItem.class); + } + return parser.schemaString(sdl).build().makeExecutableSchema(); + } + + static GraphQLSchema oracleSchema(GraphQLSchema schema, String parentType) { + DataFetcher plain = environment -> { + if (oracleFailure != null) { + throw new IllegalStateException(oracleFailure); + } + return oracleValue; + }; + return schema.transform(builder -> builder.codeRegistry( + schema.getCodeRegistry().transform(registry -> registry.dataFetcher(FieldCoordinates.coordinates(parentType, "field"), plain)))); + } + + static Map> compile(List cases, String classpath) throws Exception { + Map sources = new LinkedHashMap<>(); + for (Case testCase : cases) { + String simpleName = testCase.className.substring(testCase.className.lastIndexOf('.') + 1); + String type = testCase.javaType(); + String body; + switch (testCase.kind) { + case METHOD: + body = " implements graphql.kickstart.tools.GraphQLQueryResolver {\n" + + " @SuppressWarnings(\"unchecked\")\n" + + " public " + type + " field() { return (" + type + ") unwrapcheck.Fixtures.nextReturnValue; }\n"; + break; + case PROPERTY: + body = " implements graphql.kickstart.tools.GraphQLQueryResolver {\n" + + " public " + type + " field;\n"; + break; + default: + body = " extends java.util.HashMap {\n"; + break; + } + sources.putIfAbsent(testCase.className, "package unwrapcheck.gen;\npublic class " + simpleName + body + "}\n"); + } + + JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); + Map output = new HashMap<>(); + StandardJavaFileManager files = javac.getStandardFileManager(null, null, null); + ForwardingJavaFileManager memory = new ForwardingJavaFileManager<>(files) { + @Override + public JavaFileObject getJavaFileForOutput(Location location, String className, JavaFileObject.Kind kind, FileObject sibling) { + return new SimpleJavaFileObject(URI.create("mem:///" + className.replace('.', '/') + kind.extension), kind) { + @Override + public OutputStream openOutputStream() { + return output.computeIfAbsent(className, name -> new ByteArrayOutputStream()); + } + }; + } + }; + List units = sources.entrySet().stream().map(source -> + new SimpleJavaFileObject(URI.create("string:///" + source.getKey().replace('.', '/') + ".java"), JavaFileObject.Kind.SOURCE) { + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return source.getValue(); + } + }).collect(Collectors.toList()); + DiagnosticCollector diagnostics = new DiagnosticCollector<>(); + List javacOptions = List.of("-classpath", classpath, "-nowarn", "-proc:none"); + if (!javac.getTask(null, memory, diagnostics, javacOptions, null, units).call()) { + throw new IllegalStateException("generated resolvers don't compile: " + diagnostics.getDiagnostics()); + } + + ClassLoader loader = new ClassLoader(Check.class.getClassLoader()) { + @Override + protected Class findClass(String name) throws ClassNotFoundException { + ByteArrayOutputStream bytes = output.get(name); + if (bytes == null) { + throw new ClassNotFoundException(name); + } + return defineClass(name, bytes.toByteArray(), 0, bytes.size()); + } + }; + Map> classes = new HashMap<>(); + for (String name : sources.keySet()) { + classes.put(name, loader.loadClass(name)); + } + return classes; + } + + private static String stringArg(String[] args, String name) { + int i = List.of(args).indexOf(name); + return i >= 0 && i < args.length - 1 ? args[i + 1] : null; + } + + private static boolean flag(String[] args, String name) { + return List.of(args).contains(name); + } + + private static int intArg(String[] args, String name, int fallback) { + for (int i = 0; i < args.length - 1; i++) { + if (args[i].equals(name)) { + return Integer.parseInt(args[i + 1]); + } + } + return fallback; + } +} diff --git a/src/test/resources/returnvalue/Fixtures.java b/src/test/resources/returnvalue/Fixtures.java new file mode 100644 index 00000000..2584abde --- /dev/null +++ b/src/test/resources/returnvalue/Fixtures.java @@ -0,0 +1,121 @@ +package unwrapcheck; + +import graphql.kickstart.tools.GraphQLQueryResolver; + +import java.util.List; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +public final class Fixtures { + + public static volatile Object nextReturnValue; + + private Fixtures() { + } + + public static final class HolderQuery implements GraphQLQueryResolver { + public Object holder() { + return nextReturnValue; + } + } + + public static final class Payload { + private final String data; + + public Payload(String data) { + this.data = data; + } + + public String getData() { + return data; + } + } + + public static final class FutureItem implements Future { + private final String data; + + public FutureItem(String data) { + this.data = data; + } + + public String getData() { + return data; + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + return false; + } + + @Override + public boolean isCancelled() { + return false; + } + + @Override + public boolean isDone() { + return true; + } + + @Override + public String get() { + return data; + } + + @Override + public String get(long timeout, TimeUnit unit) { + return data; + } + } + + public static final class Try { + private final T value; + private final String failure; + + private Try(T value, String failure) { + this.value = value; + this.failure = failure; + } + + public static Try success(T value) { + return new Try<>(value, null); + } + + public static Try failure(String message) { + return new Try<>(null, Objects.requireNonNull(message)); + } + + public T get() { + if (failure != null) { + throw new IllegalStateException(failure); + } + return value; + } + } + + public static final class Page { + private final List content; + + public Page(List content) { + this.content = content; + } + + public List getContent() { + return content; + } + } + + public static final class Later { + private final CompletableFuture future; + + public Later(CompletableFuture future) { + this.future = future; + } + + public CompletableFuture toFuture() { + return future; + } + } +} diff --git a/src/test/resources/returnvalue/known-findings.txt b/src/test/resources/returnvalue/known-findings.txt new file mode 100644 index 00000000..e69de29b