Replace `BiMap` with plain maps
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 45/100
- Tipo de issue
- Refatoração
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Domínio
- backend-api-design
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Kotlin
- Estrelas
- 824
- Forks
- 175
- Merge médio
- 2d 5h
- PRs com merge (30d)
- 52
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de graphql-java-kickstart/graphql-java-tools
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
graphql-java-kickstart/graphql-java-tools#893 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
graphql-java-kickstart/graphql-java-tools#889 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
graphql-java-kickstart/graphql-java-tools#886 ·
Mantenedores costumam responder em até 1 dia
-
Reject directives applied at the wrong location, without a required argument or twice in 15.0.0Abertaenhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
graphql-java-kickstart/graphql-java-tools#884 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
graphql-java-kickstart/graphql-java-tools#881 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de graphql-java-kickstart/graphql-java-tools
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
navikt/mock-oauth2-server#1129 ·
Mantenedores costumam responder em até 1 dia
-
Expose `close` on SsrEngineAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
world-federation-of-advertisers/cross-media-measurement#4709 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
mikepenz/AboutLibraries#1488 · 2 comentários ·
Mantenedores costumam responder em até 1 dia