Skip to content

Change the behavior of default parameter values #1258

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
webron opened this issue May 9, 2015 · 6 comments
Closed

Change the behavior of default parameter values #1258

webron opened this issue May 9, 2015 · 6 comments
Milestone

Comments

@webron
Copy link
Contributor

webron commented May 9, 2015

Currently the UI displays and sends the default values of the parameters.
The default values are there for documentation purposes and should not be sent to the server.

We should add as flag that allows setting whether default values are sent or displayed only (should always be displayed for documentation), where I believe the default should be they are not sent. This would make the UI a better (even though basic) testing tool.

The challenge may be with non-text input such as drop downs and multi-selects, but even there we can check if it's the default value, just not send it.

@webron webron added this to the future milestone May 9, 2015
@bherila
Copy link

bherila commented May 25, 2015

How do you set default values, by the way?

@wing328
Copy link

wing328 commented May 25, 2015

If you're referring to the spec, then here is an example (default value of "" for the api_key header parameter):

      "delete": {
        "tags": [
          "pet"
        ],
        "summary": "Deletes a pet",
        "description": "",
        "operationId": "deletePet",
        "produces": [
          "application/json",
          "application/xml"
        ],
        "parameters": [
          {
            "name": "api_key",
            "in": "header",
            "description": "",
            "required": false,
            "type": "string"
            "default": ""
          },
          {
            "name": "petId",
            "in": "path",
            "description": "Pet id to delete",
            "required": true,
            "type": "integer",
            "format": "int64"
          }

Please refer to https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#parameter-object for more information

@bherila
Copy link

bherila commented May 27, 2015

Thanks, sorry for the OT post by the way.

@webron webron modified the milestones: v2.1.2, future Jul 21, 2015
@webron webron modified the milestones: v2.1.2, v2.1.3 Jul 31, 2015
@webron webron modified the milestones: v2.1.3, v2.1.4 Sep 2, 2015
@thinkerbot
Copy link

Is there any discussion to add an example field to parameter objects in swagger itself? That might solve the issue... you could display the server-side default for documentation, then use the example kinda like you use the body parameter schema example... ie as a shortcut to fill in the form.

Note - the behavior you described above about not sending when the default value is selected seems erroneous to me, in that if I happen to specify the default value from a dropdown then I think it should send with the value I intentionally selected. Is it better stated that the parameter shouldn't be sent by default with the default value, but rather by default it should not be sent at all?

@webron
Copy link
Contributor Author

webron commented May 3, 2016

@webron
Copy link
Contributor Author

webron commented Mar 2, 2018

Closing as for an older version of the UI.

@webron webron closed this as completed Mar 2, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants