danielgtaylor / danielgtaylor/python-betterproto

[Enhancement] Add a Clear method to the Message class for compatibility.

Abierto
#511 0 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement low priority
Lenguaje dominante
Python
Estrellas
1.8k
Forks
234
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

When converting existing code to use this module over standard protobuf, one issue raised was the lack of `ParseFromString`. This has already been mentioned at #323, with a PR in the works at #336. However, this is blocked because it does not perform the same calls as the standard, namely, `Clear`. In my use of this module, i have worked around this issue by simply creating a new instance (which is always the default) instead of using an existing one, at which point just calling `parse` works fine.

Ideally, we'd need a `clear` function (preferably lowercase to match python syntax, but might want TitleCase for compatibility) on the abstract Message class and an implementation that resets all fields to their default values. We'd need to confirm that our implementation matches standard protobuf when it comes to user-defined default values.

to be clear, this isn't a bug, and it doesn't prevent the use of this module.
I'd look into addressing this myself but the logic used to set default values eludes me, at least at first glance.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la clase abstracta Message y la lógica existente de parseo y valores predeterminados; compara su comportamiento con protobuf estándar, incluidos los valores predeterminados definidos por el usuario. Se considera completado cuando un método clear restablece todos los campos a sus valores predeterminados y admite el trabajo de compatibilidad descrito en #323 y #336.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.