Replace `BiMap` with plain maps
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Refactoring
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- backend-api-design
Rechercherichtung
Start by tracing how SchemaClassScanner builds TypeClassDictionary and how SchemaParser uses it in both directions, including resolver return types. Then review SchemaParserDictionary.getDictionary() and the graphql-spring-boot call to builder.dictionary(); done means duplicate classes produce a SchemaClassScannerError naming the class and types, the new map-returning method is used without breaking the old API, and BiMap can be removed in a later major release.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
graphql.kickstart.tools.util.BiMap is a copy of Guava's BiMap we added when we dropped Guava (661769e). Neither Java nor Kotlin has a bidirectional map, so it stuck around. After #851 it doesn't really pull its weight anymore.
Where it's used:
SchemaClassScannerbuilds aBiMap<TypeDefinition, JavaType>(TypeClassDictionary).SchemaParserreads it both ways:dictionary[definition]for enum classes anddictionary.inverse()forInterfaceTypeResolverandUnionTypeResolver.BiMap#putthrowingvalue already presentis the only thing that enforces one class per output type. It shows up asError creating bimap of type => class, which isn't a very helpful message. It also catches classes found through resolver return types, not just dictionary entries, so a replacement needs an explicit check.SchemaParserDictionarystores a plain map since #851.getDictionary()still returns aBiMapfor backwards compatibility (graphql-spring-boot callsbuilder.dictionary(dictionary.getDictionary())), but itsinverse()only keeps the first name when several input types share a class.
Proposal:
- Internally, use two plain maps plus an explicit duplicate check that throws a
SchemaClassScannerErrornaming the class and the types. No API change.
typeToClass.entries.groupBy({ it.value }, { it.key })
.filterValues { it.size > 1 }
.forEach { (clazz, types) -> throw SchemaClassScannerError("...") }
val classToType = typeToClass.entries.associate { (type, clazz) -> clazz to type }
- Add a replacement for
getDictionary()that returnsMap<String, Class<*>>under a new name, and deprecategetDictionary(). Changing the return type in place would break binary compatibility. - Switch graphql-spring-boot to the new method.
- Remove
BiMapin the next major.
- 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
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 74/100
graphql-java-kickstart/graphql-java-tools#896 ·
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
Alle Issues in graphql-java-kickstart/graphql-java-tools
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
commons-app/apps-android-commons#7072 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug ci good first issue help wanted severity: medium
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
dhananjay-nautiyal/music#17 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Watch Next: last engagement time is in seconds for played items and in milliseconds for the othersOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 79/100
damontecres/Wholphin#2112 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
beppe2880/opencode-mobile#60 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100