CloudEventAttribute should implement equality operators

Abierto
#229 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
csharp
Área
api

Línea de trabajo

Comienza localizando CloudEventAttribute, CloudEvent.GetPopulatedAttributes() y el método existente que recupera un atributo. Revisa las pruebas cercanas y la documentación de los atributos de extensión; después, define el comportamiento esperado de búsqueda o igualdad a partir del issue. Se considera terminado cuando los llamadores pueden identificar de forma fiable un atributo opcional sin tener que gestionar KVP de manera incómoda, y cuando hay cobertura para nombres ausentes y repetidos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

CloudEvent.GetPopulatedAttributes() returns an IEnumerable<KeyValuePair<CloudEventAttribute, object>> which is actually a bit odd. You'd think it would be usable as a dictionary, but I'm guessing there might be a cause where the same attribute names appear more than once, but in my case, I know they won't, so I tried to create a dictionary from it, but unfortunately, since the Key is CloudEventAttribute, indexing it requires equality operators. Even if I simply search the list of KVPs, it makes it awkward to find an attribute that may or may not exist (SingleOrDefault for example, because default is a KVP with null values), so I think I have to loop on it the old fashioned way.

I find the interface in general to be very awkward, but I think some comparison operators would be helpful, or even a helper method that can grab the attribute and/or value by name. There's already a method to get the attribute, there's just no value in it; it's only the name. Maybe there's some other incantation I'm not seeing; the documentation on extension attributes is lacking in general.

Lenguaje dominante
C#
Estrellas
334
Forks
88
Merge medio
22 min
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cloudevents/sdk-csharp

Todos los issues de cloudevents/sdk-csharp

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.