Swaggeratr icon indicating copy to clipboard operation
Swaggeratr copied to clipboard

"Try it out!" feature fails if required query params are shown in header

Open makotogitdev opened this issue 10 years ago • 3 comments

"Try it out!" feature fails if required query params are shown in header, since Swagger-UI's javascript appends query params upon submission.

makotogitdev avatar Jul 29 '14 20:07 makotogitdev

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()"

makotogitdev avatar Jul 29 '14 21:07 makotogitdev

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.

makotogitdev avatar Jul 29 '14 22:07 makotogitdev

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

makotogitdev avatar Aug 04 '14 15:08 makotogitdev