swagger-api / swagger-js

Javascript library to connect to swagger-enabled APIs via browser or nodejs
http://swagger.io
Apache License 2.0
2.6k stars 755 forks source link

OpenAPI 2.x: make execute parameter builders for query and formData consistent with each other #3436

Closed glowcloud closed 4 months ago

glowcloud commented 4 months ago

The logic for query and formData parameter builders should be the same.

The current form data builder processes truthy values differently than query, adding allowEmptyValue to it. It also adds an empty string as parameter value if the value is undefined and allowEmptyValue is true.

Form data builder:

https://github.com/swagger-api/swagger-js/blob/7e1cf7b4af0545eb296f4bde3bddabfd6280352e/src/execute/swagger2/parameter-builders.js#L18-L35

Query builder: https://github.com/swagger-api/swagger-js/blob/7e1cf7b4af0545eb296f4bde3bddabfd6280352e/src/execute/swagger2/parameter-builders.js#L51-L72

char0n commented 4 months ago

Addressed in https://github.com/swagger-api/swagger-js/pull/3437