-
Notifications
You must be signed in to change notification settings - Fork 51
CA-345342: Made the query parameters of the http actions optional #179
Conversation
Signed-off-by: Konstantina Chremmou <[email protected]>
Can you actually omit the parameters from the HTTP action, rather than filling in arbitrary defaults? I know that the C# bindings do this for RPCs as well, and it was hard to do it differently. However, in this case, it seems to be avoidable. I read something about adding the |
csharp/gen_csharp_binding.ml
Outdated
| | String_query_arg s | ||
| | Int64_query_arg s | ||
| | Bool_query_arg s -> "\"" ^ s ^ "\", " ^ (escaped s) (* "s", s *) | ||
| | Bool_query_arg s -> sprintf "\"%s\", %s" s (escaped s) |
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.
| | Bool_query_arg s -> sprintf "\"%s\", %s" s (escaped s) | |
| | Bool_query_arg s -> sprintf {|"%s", %s|} s (escaped s) |
It can be written without escaping the quotation marks, making it more readable.
|
The default values provided are not arbitrary, they are the defaults for the specific type. If one replaces the explicit declaration with the |
|
The defaults are well-defined for C#, but unrelated to the defaults applies by xapi. We may well define one of the Boolean args to have a default of |
… nullable. Note that some of them are not optional, however, the current definition does not allow for distinguishing them from the mandatory ones, and as a consequence it is easier to mark them all as optional than provide method overloads manually. Also: - Fixed issue where the parameters set to false were ignored. - Exposed manually in the SDK http actions removed from the API. Signed-off-by: Konstantina Chremmou <[email protected]>
robhoes
left a comment
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 think this looks good now.
CA-345342: Made the query parameters of the http actions optional using as default value the type default.
Note that some of them are not optional, however, the current definition does not allow for distinguishing them from the mandatory ones, and as a consequence it is easier to mark them all as optional than provide method overloads manually.
Also, exposed manually in the SDK http actions removed from the API.
Use a mustache template to generate the HTTP actions.