Nested enum types have no name
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece inspecionando as definições do protocolo JSON e o enum inline em emulateTouchFromMouseEvent e, em seguida, compare-o com dispatchMouseEvent. Determine se as formas repetidas de enum representam um único tipo nomeado ou tipos independentes; está concluído quando os enums inline tiverem definições de domínio nomeadas e as propriedades ou os parâmetros usarem referências.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Some domain types/commands/events in the JSON protocol definitions have properties/parameters of enum types that are not references to a top-level domain enum type, but that are instead inlined on the spot. For instance here is one:
...
{
"name": "emulateTouchFromMouseEvent",
"description": "Emulates touch event from the mouse event parameters.",
"experimental": true,
"parameters": [
{
"name": "type",
"description": "Type of the mouse event.",
"type": "string",
"enum": [
"mousePressed",
"mouseReleased",
"mouseMoved",
"mouseWheel"
]
...
I'm generating code from the JSON definitions, but I'm facing 2 problems with this at the moment:
- because these types are not defined at the top level as "domain types", they have no name so I have to either use a plain
Stringtype (which defeats the purpose of the enum) or generate a name (which might not be user-friendly). In the example above, a good name might beMouseEventType. This problem would affect any language that doesn't support string union types (in my case, Kotlin). - some of these enums are implicitily reused across multiple commands/events (the example above appears in
dispatchMouseEventandemulateTouchFromMouseEvent), but there is no way to tell whether they are different types and just happen to have the same enum values (and thus might change independently), or whether they are a single reused type (and thus will evolve together and always stay in sync). This means I cannot choose systematically between declaring different enum types or just one. This problem would affect the same set of languages I believe, basically all those who have to declare enums as a named type.
I haven't found any inlined object type like this (these are only refs), I only found enums suffering from this problem.
It would be great if all enums were extracted into the domain types list and only references appeared in the properties and parameters. Some enums already are defined at the top level, just not all of them.
- Linguagem predominante
- JavaScript
- Estrelas
- 1.6k
- Forks
- 281
- Merge médio
- 1d 19h
- PRs com merge (30d)
- 1
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 ChromeDevTools/devtools-protocol
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
ChromeDevTools/devtools-protocol#311 · 1 comentário ·
-
Reconsider versioning schemeAberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
ChromeDevTools/devtools-protocol#298 · 4 reações ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
ChromeDevTools/devtools-protocol#233 · 4 comentários ·
-
Keep track of URL changesTalvez livre de novo @hashseed assumiu há 2224 dias e não há nenhum pull request aberto. Aberta
ChromeDevTools/devtools-protocol#224 · 4 comentários · 1 reação · 1 responsável ·
Todas as issues de ChromeDevTools/devtools-protocol
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
andromarces/agent-loops#976 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
openstreetmap/iD#13019 ·
Mantenedores costumam responder em até 2 dias
-
bug main ui
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
openhab/openhab-webui#4600 ·
Mantenedores costumam responder em até 4 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia