-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
API sample requests send params as empty string #200
Comments
+1 I submitted a PR #193 that will hopefully deal with this issue (params and headers too). Thanks Vincent |
I don't think your pull request fixes this issue, since it does not prevent sending empty strings for optional params. Moreover, it makes it impossible to provide user-defined values for required fields, since you are overriding the values to the default, when it exists, without verifying if the used supplied a custom value. I also don't think apidoc should send a default value for any param. IMO, when you document an API param with a default value, you are describing what the API call will assume for that value when you do not provide one. The client should not send that value, it will be implied. |
Sorry I missed something in your issue, and I do not fix your issue. That's right, my apologies... |
Hi, is any advance on this?, i'm trying to define a PUT request and don't want to update fields with empty string, is there a way to tell Apidoc to only send parameters filled? |
+1 Can definitely use this fix. |
I've created a pull request for this feature here #647, although I personally think that we should include a checkbox of some kind next to optional parameters that indicate a blank string should be sent for sample requests in the case that you actually want to send a blank string. |
+1 |
When using
sampleUrl
to generate forms to test API methods, apidoc pages send all parameters of the currently selected parameter group to API endpoints, even if the user did not fill in any value.For example, if I have a method with 3 parameters,
a
,b
andc
, all optional, and I only fill a value intoa
, upon clickingSend
apidoc sends a request with the value I entered fora
and empty strings as values forb
andc
.This is not desirable and breaks APIs that do not accept empty strings as values for those parameters. These sample forms should only send params that the user specificaly provided.
The text was updated successfully, but these errors were encountered: