JSON numeric getters accept booleans as integers and floats
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend-api-design
Línea de trabajo
Empieza con JsonParseNode.get_int_value() y get_float_value() en la implementación del nodo de análisis JSON; luego sigue cómo las colecciones primitivas tipadas convierten cada elemento. Añade regresiones para valores directos, hijos analizados por JsonParseNodeFactory y colecciones tipadas explícitamente; conserva los getters booleanos, las conversiones numéricas válidas y las colecciones booleanas inferidas. El trabajo estará terminado cuando los booleanos devuelvan None desde los getters numéricos y pasen las regresiones específicas y los controles existentes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
JsonParseNode.get_int_value() accepts JSON booleans as integers, and get_float_value() converts them to 1.0/0.0. This also occurs through child nodes parsed from JSON bytes and in explicitly typed numeric collections.
The implementation uses isinstance(value, int) / isinstance(value, (float, int)). In Python, bool is a subclass of int, but JSON booleans are not numeric tokens. Other non-number values already return None from these getters.
Reproduction
from kiota_serialization_json.json_parse_node import JsonParseNode
from kiota_serialization_json.json_parse_node_factory import JsonParseNodeFactory
print(JsonParseNode(True).get_int_value()) # True
print(JsonParseNode(False).get_float_value()) # 0.0
root = JsonParseNodeFactory().get_root_parse_node(
"application/json", b'{"count": true}'
)
print(root.get_child_node("count").get_int_value()) # True
print(JsonParseNode([1, True, False, 0]).get_collection_of_primitive_values(float))
# [1.0, 1.0, 0.0, 0.0]
Expected behavior
Boolean inputs should follow the existing non-number path and return None from integer/float getters, rather than silently becoming numbers. Numeric collection conversion should use the same element conversion behavior it already uses for other non-numeric values. The actual boolean getter, valid integers/floats, integer-to-float conversion, and inferred boolean collections should remain unchanged.
This is not a request to redesign primitive collection nullability (#777), change public signatures, or change JSON writer behavior.
Environment and validation
- Current main: ee58dcf.
- Python 3.14.5, Windows; editable local JSON/abstractions packages.
- Added scalar, real JSON factory/child, and typed collection regressions: 12 failures on unchanged source; focused run also has 20 passing controls/existing tests.
- No production traffic or external API credentials involved.
Discovered through source review and reproduced locally with AI assistance. I can provide the focused parser fix and regression tests.
- Lenguaje dominante
- Python
- Estrellas
- 31
- Forks
- 48
- Merge medio
- 16 h 36 min
- PR fusionados (30 d)
- 73
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
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 microsoft/kiota-python
-
Backing store enumeration returns internal tracking tuples instead of stored listsPosiblemente ocupada @pradeep-ramola la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
microsoft/kiota-python#938 ·
Los mantenedores suelen responder en 1 día
-
ensure 304 response code does not throwQuizá libre de nuevo @nightcityblade la tomó hace 92 días y no hay ningún pull request abierto. Abiertohelp wanted type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/kiota-python#477 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
microsoft/kiota-python#901 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 18/100
microsoft/kiota-python#898 ·
Los mantenedores suelen responder en 1 día
-
type:breaking-change
Dificultad 5/5 Más de una semana Aptitud para principiantes 12/100
microsoft/kiota-python#777 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/kiota-python
Issues similares
-
backend: claude chore dependencies
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
briandconnelly/amicus#606 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
semantica-agi/semantica#2320 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
vllm-project/vllm-omni#11465 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
jxxghp/MoviePilot#7699 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
vllm-project/vllm-ascend#24010 ·
Los mantenedores suelen responder en 1 día