swagger-js icon indicating copy to clipboard operation
swagger-js copied to clipboard

OpenApi v3 parameter default value not handled

Open emerikool opened this issue 3 years ago • 0 comments

  • OS: mac
  • Environment: Chrome 105
  • Method of installation: npm
  • Swagger-Client version: 3.18.5
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Swagger/OpenAPI definition: PetstoreV3.yaml with default: 'whatever' property added to /user/login-get-parameters-username-schema

Swagger-Client usage:

SwaggerClient.execute({
    "spec": {...PetsoreV3JsonDescribedAbove}
    "method": "get",
    "pathName": "/user/login",
    "parameters": {},
    "requestContentType": "application/json",
    "responseContentType": "application/json",
})

Describe the bug you're encountering

On openApi v3, not supplied parameters with a default value are not sent when exucuting the corresponding action

To reproduce...

Steps to reproduce the behavior:

  1. In an openApi v3 spec action, add a default value to a non required parameter
  2. Execute the action without supplying the parameter which have a default value

Expected behavior

Not supplied parameter with a default value should be sent like in V2: https://github.com/swagger-api/swagger-js/blob/master/src/execute/index.js#L215

emerikool avatar Oct 05 '22 08:10 emerikool