-
Notifications
You must be signed in to change notification settings - Fork 574
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
[wip] Add support for unsettable fields #1956
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comment. What does this change look like in VSCode and other IDE for .NET? How confusing/clear are the docstrings/helper?
|
||
[JsonProperty("default_source")] | ||
public string DefaultSource { get; set; } | ||
public AnyOf<string, EmptyParam> DefaultSource { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fairly sure you can never unset a default source. If the openapi spec says otherwise, the spec is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this from stripe-java, so the spec is likely wrong.
|
||
[JsonProperty("email")] | ||
public string Email { get; set; } | ||
public AnyOf<string, EmptyParam> Email { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to support this on string since you can simply pass an empty string today and it just works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's certainly debatable. Is this:
var options = new CustomerUpdateOptions { Email = EmptyParam.Empty };
better/clearer than this:
var options = new CustomerUpdateOptions { Email = "" };
// or even
var options = new CustomerUpdateOptions { Email = string.Empty };
?
In stripe-java we do define an overload with EmptyParam
even for strings, but we disallow empty strings, which we don't do in stripe-dotnet.
Let's discuss this with @cjavilla-stripe and @richardm-stripe next week.
Will this fix #1954 and allow setting fields to null? Wouldn't What do you think? |
As long as the field can be unset on the API's side, yes. That's not the case for all fields.
Technically there isn't really a difference. Because Stripe's API uses form-encoding for requests, there isn't an explicit notion of "null" -- if you unset a field named That said that's more of an implementation detail and I agree that |
Indeed that sounds like an implementation detail. Consider the fact that if you set foo= and load foo back from the API, the API would return null and not "". If I understand correctly... |
Closing due to staleness. |
No description provided.