toReadOnlySchema() fails on schemas with interfaces, unions or custom directives
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- graphql, kotlin
- Ambito
- backend-api-design
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Kotlin
- Stelle
- 824
- Fork
- 175
- Merge medio
- 2g 5h
- PR unite (30g)
- 52
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di graphql-java-kickstart/graphql-java-tools
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
graphql-java-kickstart/graphql-java-tools#893 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
graphql-java-kickstart/graphql-java-tools#889 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
graphql-java-kickstart/graphql-java-tools#886 ·
I maintainer di solito rispondono entro 1 giorno
-
Reject directives applied at the wrong location, without a required argument or twice in 15.0.0Apertaenhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
graphql-java-kickstart/graphql-java-tools#884 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
graphql-java-kickstart/graphql-java-tools#881 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di graphql-java-kickstart/graphql-java-tools
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
beppe2880/opencode-mobile#60 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
auth0/Auth0.Android#1101 ·
I maintainer di solito rispondono entro 1 giorno
-
LiquidGlass / LiquidGlassContainer (iOS): padded content measured at the outer width and overflows by the paddingForse già presa @aleclarson l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
NativeScript/NativeScript#11561 ·
I maintainer di solito rispondono entro 1 giorno
-
Imported configuration's @Bean methods record the configuration class instead of the return typeApertain:spring-core
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
explyt/spring-plugin#787 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
IacobIonut01/ReFra#1335 ·
I maintainer di solito rispondono entro 4 giorni