Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Boolean parameter in body causes Swagger page to not render that controller, and all controllers alphabetically after #2190

Closed
Thunderforge opened this issue Jun 2, 2016 · 1 comment
Milestone

Comments

@Thunderforge
Copy link

Thunderforge commented Jun 2, 2016

I have an endpoint that includes a boolean in the body of the request. The generated schema looks like this:

"parameters": [

    {
        "in": "body",
        "name": "someBoolean",
        "description": "someBoolean",
        "required": false,
        "schema": {
            "type": "boolean"
        }
    }

],

This is a valid endpoint, and I can use it just fine. However, when I try to render this in Swagger UI, I get the following:

swagger failure edited

Note that the top of the page has the message "Finished Loading Resource Information. Rendering Swagger UI..." and there is an error in the console. The full error is as follows:

swagger-ui.min.js:10 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
(anonymous function) @ swagger-ui.min.js:10
Handlebars.templates.param_list.Handlebars.template.main @ swagger-ui.min.js:1
e @ handlebars-2.0.0.js:27
SwaggerUi.Views.ParameterView.Backbone.View.extend.render @ swagger-ui.min.js:10
SwaggerUi.Views.OperationView.Backbone.View.extend.addParameter @ swagger-ui.min.js:10
SwaggerUi.Views.OperationView.Backbone.View.extend.render @ swagger-ui.min.js:10
SwaggerUi.Views.ResourceView.Backbone.View.extend.addOperation @ swagger-ui.min.js:11
SwaggerUi.Views.ResourceView.Backbone.View.extend.render @ swagger-ui.min.js:11
SwaggerUi.Views.MainView.Backbone.View.extend.addResource @ swagger-ui.min.js:10
SwaggerUi.Views.MainView.Backbone.View.extend.render @ swagger-ui.min.js:10
window.SwaggerUi.Backbone.Router.extend.render @ swagger-ui.min.js:10
options.success @ swagger-ui.min.js:10
y.buildFromSpec @ swagger-ui.min.js:2
a.finish @ swagger-ui.min.js:3
(anonymous function) @ swagger-ui.min.js:2
a.resolve @ swagger-ui.min.js:2
a.finish @ swagger-ui.min.js:3
(anonymous function) @ swagger-ui.min.js:2
a.resolve @ swagger-ui.min.js:2
a.finish @ swagger-ui.min.js:3
(anonymous function) @ swagger-ui.min.js:2
a.resolve @ swagger-ui.min.js:2
a.finish @ swagger-ui.min.js:3
(anonymous function) @ swagger-ui.min.js:2
a.resolve @ swagger-ui.min.js:2
a.finish @ swagger-ui.min.js:3
(anonymous function) @ swagger-ui.min.js:2
a.resolve @ swagger-ui.min.js:2
a.finish @ swagger-ui.min.js:3
(anonymous function) @ swagger-ui.min.js:2
a.resolve @ swagger-ui.min.js:2
a.finish @ swagger-ui.min.js:3
(anonymous function) @ swagger-ui.min.js:2
a.resolve @ swagger-ui.min.js:2
n.on.response @ swagger-ui.min.js:2
l @ swagger-ui.min.js:2
e.on.response @ swagger-ui.min.js:2
(anonymous function) @ swagger-ui.min.js:2
f.callback @ swagger-ui.min.js:10
(anonymous function) @ swagger-ui.min.js:9
r.emit @ swagger-ui.min.js:10
n.onreadystatechange @ swagger-ui.min.js:10

Also in this particular example, there are four controllers: cluster-controller, message-controller, status-controller, and test-controller. The endpoint above is inside of status-controller and it does not appear on the page. However, the next controller alphabetically, test-controller, also does not appear, with no indication about the source of the problem or that other controllers are prevented from displaying.

This bug was originally reported to Springfox, an implementation of Swagger with the Java Spring library, but I was told that it was in fact an issue with Swagger UI and its lack of support for a boolean parameter in the body, as shown above.

We are using Swagger UI 2.1.4.

@webron
Copy link
Contributor

webron commented Jun 3, 2016

This is resolved in master already, please use that branch.

@webron webron closed this as completed Jun 3, 2016
@fehguy fehguy added this to the v2.2.1 milestone Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants