Nested enum types have no name
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Empieza inspeccionando las definiciones del protocolo JSON y el enum inline de emulateTouchFromMouseEvent, y compáralo después con dispatchMouseEvent. Determina si las formas de enum repetidas representan un único tipo con nombre o tipos independientes; se considera terminado cuando los enums inline tienen definiciones de dominio con nombre y las propiedades o los parámetros usan referencias.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.6k
- Forks
- 279
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ChromeDevTools/devtools-protocol
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
ChromeDevTools/devtools-protocol#311 · 1 comentario ·
-
Reconsider versioning schemeAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
ChromeDevTools/devtools-protocol#298 · 4 reacciones ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
ChromeDevTools/devtools-protocol#233 · 4 comentarios ·
-
Keep track of URL changesQuizá libre de nuevo @hashseed la tomó hace 2199 días y no hay ningún pull request abierto. Abierto
ChromeDevTools/devtools-protocol#224 · 4 comentarios · 1 reacción · 1 asignado ·
Todos los issues de ChromeDevTools/devtools-protocol
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
diegosouzapw/OmniRoute#14869 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
Los mantenedores suelen responder en 1 día
-
status: waiting triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
freeCodeCamp/freeCodeCamp#70412 ·
Los mantenedores suelen responder en 1 día
-
Mend: dependency security vulnerability untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
opensearch-project/OpenSearch-Dashboards#12816 ·
Los mantenedores suelen responder en 1 día