Skip to content

fix(json): remove redundant guard in get_child_node#560

Merged
baywet merged 2 commits into
microsoft:mainfrom
i4energy:fix/get-child-node-empty-input
May 28, 2026
Merged

fix(json): remove redundant guard in get_child_node#560
baywet merged 2 commits into
microsoft:mainfrom
i4energy:fix/get-child-node-empty-input

Conversation

@gntikos
Copy link
Copy Markdown
Contributor

@gntikos gntikos commented May 28, 2026

Overview

Removes an identified guard in get_child_node. The guard does not really protect from anything, but breaks generated code, for example in cases of oneOf without discriminator (see microsoft/kiota#6868).

The method now returns None, which is allowed since the return type is Optional[ParseNode].

Related Issue

Fixes #559

@gntikos gntikos requested a review from a team as a code owner May 28, 2026 03:54
Remove early guard rasing ValueError on an empty identifier.
The lookup is performed as usual allowing the method to return None.

Fixes microsoft#559

Signed-off-by: Giorgos Siantikos <gsiantikos@i4.energy>
@gntikos gntikos force-pushed the fix/get-child-node-empty-input branch from 01f2298 to 1230131 Compare May 28, 2026 04:06
@gntikos
Copy link
Copy Markdown
Contributor Author

gntikos commented May 28, 2026

@microsoft-github-policy-service agree company="i4energy"

Copy link
Copy Markdown
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gntikos
Thanks for the contribution!

A few minor remarks and we should be good to go.

Let me know if you have any additional comments or questions.

Comment thread packages/serialization/json/tests/unit/test_json_parse_node.py Outdated
Comment thread packages/serialization/json/tests/unit/test_json_parse_node.py Outdated
Comment thread packages/serialization/json/tests/unit/test_json_parse_node.py Outdated
@github-project-automation github-project-automation Bot moved this to In Progress 🚧 in Kiota May 28, 2026
Signed-off-by: Giorgos Siantikos <gsiantikos@i4.energy>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

@baywet baywet enabled auto-merge (squash) May 28, 2026 12:59
@baywet baywet disabled auto-merge May 28, 2026 12:59
@baywet baywet enabled auto-merge May 28, 2026 13:00
@baywet baywet merged commit b07b151 into microsoft:main May 28, 2026
53 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

[Bug] JsonParseNode.get_child_node raises ValueError for empty or None input

2 participants