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

optional values of type number are send even when not set #26

Open
svatal opened this issue Nov 9, 2017 · 2 comments
Open

optional values of type number are send even when not set #26

svatal opened this issue Nov 9, 2017 · 2 comments

Comments

@svatal
Copy link
Contributor

svatal commented Nov 9, 2017

example: I'm unable to set session cookie.
protocol.json:
{ "name": "setCookie", "parameters": [ ..... { "name": "expirationDate", "$ref": "Timestamp", "optional": true, "description": "If omitted, the cookie becomes a session cookie." } ]...
(Timestamp is typedef for number)

resulting SetCookieCommand:
/// <summary> /// Gets or sets If omitted, the cookie becomes a session cookie. /// </summary> [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public double ExpirationDate { get; set; }
^ double is not nullable thus the zero is sent instead of ommiting

@qmfrederik
Copy link
Contributor

This may work if we can get the type of ExpirationDate to be double? instead of double.

It's been a while since I looked at the code, but since we already are capable of creating bool? I guess there's already some infrastructure in the generator which should help you fix this.

@qmfrederik
Copy link
Contributor

Ah - here you go: take a look at #12, you'd need to add support for double as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants