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 Paramaters #116

Open
rscole opened this issue Oct 7, 2016 · 5 comments
Open

Optional Paramaters #116

rscole opened this issue Oct 7, 2016 · 5 comments

Comments

@rscole
Copy link

rscole commented Oct 7, 2016

I have created a method on an ApiController with optional parameters:

Public void getInformation(int? id1 = null, int? id2 = null){
}

When generating the proxy code, the method in WebApiProxy.generated.cs is:

Void getInformation(Nullable<Int32> id1, Nullable<int32>id2);

I would like to call this method with any of the following:

getInformation(1,2);
getInformation(1);
getInformation();

Currently I have to call this method with nulls for it to work:

getInformation(1,null);
getInformation(null,null);

Is there something I can do or can be changed so I can call this method without passing it null values?

@swethapavan
Copy link

How about creating overloaded methods in the controller and these overloaded methods in turn call a single private method having the optional parameters.

@Korporal
Copy link

@swethapavan @faniereynders @rscole - This strikes me as a an obvious no-brainer, the proxy signature is clearly wrong and there should be no need for the client to do any hacking/fiddling with overloads. This issue also seems to be rather old so I wonder - why should we consider using WebApiProxy if issues like these are being simply ignored?

I'm considering using this (or something like it) but all too often these open source projects become a burden because users end up self-maintaining their fork versions because the base repo simply falls behind.

I'd expect an issue like this to be treated more quickly and I suspect (without looking at the code) that it isn't a huge change - so why has it been ignored for 9 months?

@faniereynders
Copy link
Member

faniereynders commented Jun 10, 2017 via email

@Korporal
Copy link

Korporal commented Jun 10, 2017

@faniereynders - I'd consider forking etc but then I see old PRs like this:

#117

Which seem like a basic and simple improvement but there's no comment from you, this give me the feeling that if I did get involved and go to the trouble of creating some pull requests, they'd sit there for months, apparently ignored by you.

@faniereynders
Copy link
Member

faniereynders commented Jun 10, 2017 via email

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

4 participants