Swaggeratr
Swaggeratr copied to clipboard
"Try it out!" feature fails if required query params are shown in header
"Try it out!" feature fails if required query params are shown in header, since Swagger-UI's javascript appends query params upon submission.
This was introduced by implementing issue #60. To fix this issue, in Swagger.js, add the following method and edit "SwaggerOperation.protorype.urlify".
SwaggerOperation.prototype.pathWithoutQuery = function () {
if (!this.path.contains("?")) { return this.path; }
var queryPosition = this.path.indexOf("?");
return this.path.substring(0, queryPosition);
};
and replace "this.pathJson()" in "urlfity" with "this.pathWithoutQuery()"
Realized that #60 should've been implemented in Swagger-UI layer since it is not a problem with models but is a presentation change. Will ask Swagger-UI project to see how difficult it may be to do it and still have "Try it out!" to work.
I started a discussion with Swagger UI team but they closed the issue and claimed that it is a spec issue. Hmm.
https://github.com/wordnik/swagger-ui/issues/506