JSON numeric getters accept booleans as integers and floats
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 78/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- python
- Domínio
- backend-api-design
Direção de pesquisa
Comece com JsonParseNode.get_int_value() e get_float_value() na implementação do nó de análise JSON e, em seguida, acompanhe como as coleções primitivas tipadas convertem cada elemento. Adicione regressões para valores diretos, filhos analisados por JsonParseNodeFactory e coleções tipadas explicitamente; preserve os getters booleanos, as conversões numéricas válidas e as coleções booleanas inferidas. O trabalho estará concluído quando os booleanos retornarem None dos getters numéricos e as regressões focadas e os controles existentes passarem.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 31
- Forks
- 48
- Merge médio
- 16h 36min
- PRs com merge (30d)
- 73
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
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 microsoft/kiota-python
-
Backing store enumeration returns internal tracking tuples instead of stored listsTalvez já em andamento @pradeep-ramola assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
microsoft/kiota-python#938 ·
Mantenedores costumam responder em até 1 dia
-
ensure 304 response code does not throwTalvez livre de novo @nightcityblade assumiu há 92 dias e não há nenhum pull request aberto. Abertahelp wanted type:bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
microsoft/kiota-python#477 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
microsoft/kiota-python#901 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 18/100
microsoft/kiota-python#898 ·
Mantenedores costumam responder em até 1 dia
-
type:breaking-change
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 12/100
microsoft/kiota-python#777 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de microsoft/kiota-python
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"Talvez já em andamento @cestercian assumiu hoje. Abertacomp/cli P2 type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
NousResearch/hermes-agent#162259 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug enhancement
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
AOSSIE-Org/PictoPy#1802 · 2 comentários ·
Mantenedores costumam responder em até 3 dias
-
community-request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
NVIDIA-NeMo/Run#727 ·
Mantenedores costumam responder em até 1 dia
-
bot-triaged module: higher order operators module: pickle module: pt2-dispatcher oncall: pt2 triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
pytorch/pytorch#207247 · 1 comentário ·
Mantenedores costumam responder em até 1 dia