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

Compatibility: Does the client include a property that has a null value? #4929

Open
msfcolombo opened this issue Mar 25, 2024 · 3 comments
Open
Labels
needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@msfcolombo
Copy link

msfcolombo commented Mar 25, 2024

If I add a new foo property with type integer and x-nullable: true in the Swagger definition, will the generated client send "foo": null in the request payload? Or will foo be absent from the payload?

The reason I'm asking is that I'm not sure if existing server versions will tolerate an extraneous property with an explicit null in the payload.

@msfcolombo msfcolombo added the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Mar 25, 2024
@timotheeguerin
Copy link
Member

Do you want to describe optional properties or nullable? x-nullable will technically mean you can set it to null over the wire. For optional properties they should just not be part of teh required: [] array

@timotheeguerin timotheeguerin added the needs-author-feedback More information is needed from author to address the issue. label Mar 26, 2024
@msfcolombo
Copy link
Author

Do you want to describe optional properties or nullable? x-nullable will technically mean you can set it to null over the wire. For optional properties they should just not be part of teh required: [] array

The property is both optional and nullable.

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Mar 26, 2024
@timotheeguerin
Copy link
Member

By that you mean in your backend or over the wire? From your original message you said you are not sure if null would be accepted over the wire.

If you are doing a CSharp server that use null to represent optionality then what you want is to define the property as optional. Nullable properties should be extremely rare and only used in case like json merge patch for Microsoft services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants