toReadOnlySchema() fails on schemas with interfaces, unions or custom directives
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 74/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- graphql, kotlin
- Bereich
- backend-api-design
Rechercherichtung
Start by comparing SchemaObjects#toReadOnlySchema() with toSchema(), which the issue identifies as passing the code registry and directives. Check for existing tests around parseSchemaObjects() and add coverage for interfaces, unions, and applied custom directives. Done means toReadOnlySchema() builds those schemas successfully without mutation or subscription support.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
SchemaObjects#toReadOnlySchema() throws for any schema with an interface, a union or an applied custom directive. Same on graphql-java 26.1 and 25.1:
| Schema | parseSchemaObjects().toReadOnlySchema() |
|---|---|
scalar fields only, or @deprecated |
builds |
interface Animal |
AssertException: There must be a type resolver for interface Animal |
union Pet = Dog |
AssertException: There must be a type resolver for union Pet |
name: String @tag with directive @tag on FIELD_DEFINITION |
InvalidSchemaException: invalid schema: A definition for directive 'tag' could not be found |
It only passes the query type and the dictionary to GraphQLSchema.newSchema(), and toSchema() got the extra parts it needed over time but toReadOnlySchema() never did:
- Since 5.6.1 (e6f6f4d, the move to graphql-java 13) the type resolvers live in the code registry instead of on the interface and union types.
toSchema()started passingcodeRegistryBuilder.build(),toReadOnlySchema()doesn't pass a code registry at all. - graphql-java 18.0 started rejecting applied directives without a definition in the schema (graphql-java/graphql-java#2576). 71b9752 added
additionalDirectives(directives)totoSchema()for that in 12.1.0, but not totoReadOnlySchema().
So it's been broken for interfaces and unions since 2019, and for custom directives since 12.1.0. I couldn't find a caller in this org, there's no test for it and nobody reported it, so probably nobody uses it.
Fix would be to pass the same code registry, directives and schema applied directives as toSchema(), just without mutation and subscription. Or deprecate it.
- Vorherrschende Sprache
- Kotlin
- Sterne
- 824
- Forks
- 175
- Ø Merge
- 2 T. 5 Std.
- Gemergte PRs (30 T.)
- 52
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus graphql-java-kickstart/graphql-java-tools
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
graphql-java-kickstart/graphql-java-tools#893 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
graphql-java-kickstart/graphql-java-tools#889 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
graphql-java-kickstart/graphql-java-tools#886 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Reject directives applied at the wrong location, without a required argument or twice in 15.0.0Offenenhancement
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
graphql-java-kickstart/graphql-java-tools#884 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
graphql-java-kickstart/graphql-java-tools#881 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in graphql-java-kickstart/graphql-java-tools
Ähnliche Issues
-
enhancement impact:U1 P3 reach:R2 size:S
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
ankidroid/Anki-Android#22677 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Type Pick Request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
reactwg/react-native-releases#1456 · 1 Kommentar ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
yschimke/homeassistant-remotecompose#1038 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:data-quality importer size:S
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
enorm-labs/event-junkie#3707 ·
Maintainer antworten meist innerhalb von 1 Tag