Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[http-client-java] In toJson, we should skip writeUntypedField if value is null for optional properties #6508

Open
4 tasks done
XiaofeiCao opened this issue Mar 18, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@XiaofeiCao
Copy link
Member

Describe the bug

Azure/azure-sdk-for-java#44686 (comment)

This should happen for both branded/unbranded, dpg and mpg.

Reproduction

See above.

Checklist

@XiaofeiCao XiaofeiCao added the bug Something isn't working label Mar 18, 2025
@XiaofeiCao XiaofeiCao self-assigned this Mar 18, 2025
@weidongxu-microsoft
Copy link
Contributor

weidongxu-microsoft commented Mar 18, 2025

We may first check with core whether writeUntypedField would skip null in its internal impl, as other types like writeStringField would skip the field, if value is null.

@XiaofeiCao
Copy link
Member Author

It'll not skip and seems by design:
https://github.com/Azure/azure-sdk-for-java/blob/282a1cc1910eb40a79e81aa0ce5f3fbd064203d5/sdk/serialization/azure-json/src/main/java/com/azure/json/JsonWriter.java#L1060

@XiaofeiCao XiaofeiCao changed the title [http-client-java] In toJson, we should skip writeUntypedField if value is null [http-client-java] In toJson, we should skip writeUntypedField if value is null for optional properties Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants