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

Response Messages's Response Model not shown #671

Closed
sosoxuc opened this issue Oct 18, 2014 · 18 comments
Closed

Response Messages's Response Model not shown #671

sosoxuc opened this issue Oct 18, 2014 · 18 comments
Assignees
Milestone

Comments

@sosoxuc
Copy link

sosoxuc commented Oct 18, 2014

Response Messages's Response Model not shown in case if primitive types e.g for string

@fehguy
Copy link
Contributor

fehguy commented Oct 19, 2014

more info, please :)

@sosoxuc
Copy link
Author

sosoxuc commented Oct 19, 2014

untitled

Have tried both

"responses": {
                    "200": {
                        "description": "Result of operation.",
                        "type": "string"
                    }
                }

"responses": {
                    "200": {
                        "description": "Result of operation.",
                        "schema": {
                            "type": "string"
                        }
                    }
                }

@webron
Copy link
Contributor

webron commented Oct 19, 2014

FYI, only the second option is valid:

"responses": {
                    "200": {
                        "description": "Result of operation.",
                        "schema": {
                            "type": "string"
                        }
                    }
                }

@sosoxuc
Copy link
Author

sosoxuc commented Oct 19, 2014

But nothing is shown in marked area :(

@webron
Copy link
Contributor

webron commented Oct 19, 2014

I didn't say it solves the issue, just wanted you to be aware the first option is a malformed Swagger spec.

@sosoxuc
Copy link
Author

sosoxuc commented Oct 19, 2014

Thanks

@lucianomedina
Copy link

Hello, I have the same problem. Someone could solve it?

@webron
Copy link
Contributor

webron commented Oct 31, 2014

Let's make sure it's the same issue. Can you share your own responses definition?

@lucianomedina
Copy link

swagger_response

"responses": {
    "500": {
        "description": "Unexpected error",
        "schema": {"$ref": "#/definitions/500"}
    }
}
"definitions": {
    "500": {
        "schema": {
            "type": "array",
            "items": {
                "50002": {
                    "code": 50002,
                    "message": "error ex"
                },
                "50003": {
                    "code": 50003,
                    "message": "error ex 2"
                }
            }
        }
    }
},

The swagger version is 2.0.24.
Thanks!

@webron
Copy link
Contributor

webron commented Oct 31, 2014

That's not a valid definition. "items" cannot contain multiple entries.

Also, the definitions should have been something along the lines of:

"definitions": {
    "500": {
        "type": "array",
        "items": { ... }
    }
},

@avishaan
Copy link

avishaan commented Dec 6, 2014

I'm having the same problem as @sosoxuc

        "responses": {
          "200": {
            "description": "A-Ok",
            "schema": {
              "type": "string"
            }
          }
        }

screen region 2014-12-06 at 21 33 32

It may look like the screenshot cut it off but I assure you it isn't there.

@fehguy fehguy added this to the v2.1.0-M1 milestone Dec 29, 2014
@gregzuro
Copy link

gregzuro commented Jan 6, 2015

I am also, I think, seeing this issue.

The models that are array[...] do not appear while the non-array one does.

This json was 'auto-created' by go-restful, FWIW.

https://gist.github.com/gregzuro/519e97958d386b2f50c4

@fehguy
Copy link
Contributor

fehguy commented Feb 1, 2015

OK I've confirmed the case I was aware of is fixed in develop_2.0. Please reopen if you see issues after you test with 2.1.0-M1

@fehguy fehguy closed this as completed Feb 1, 2015
@j3kz
Copy link

j3kz commented Apr 10, 2015

I'm seeing this issue in 2.1.8-M1

@fehguy fehguy reopened this Apr 14, 2015
@fehguy fehguy modified the milestones: v2.1, v2.1-M1 Apr 14, 2015
@ponelat
Copy link
Member

ponelat commented Apr 29, 2015

I've been investigating the issue, and there is a "fork in the road", when it comes to the fix.

We're dealing with the operation's responses:
For starters, we pick out a success response (2XX) and promote it to the top of the UI's operation view.
Then we leave the rest of the responses pretty much untouched from the spec, as plain objects.

This means when we want a "rendered" JSON and Model view, when need to build it from the response object.
For response objects with a schema->$ref, we deference them from the list of model definitions.
Sounds about right... but its done from inside the -UI.

To solve the above, we must either add more logic to the -UI regarding response objects. Such as "create an inline model instance" and "determine if its an object or primitive"

The other alternative, is to process the response objects inside -JS, creating model instances where we need to. I don't know if anything(anyone) else depends on response objects schema's being plain objects. And whether they would be affected by this little refactor.

In the end, it'll take maybe two hours to patch the code to work as everyone expects, but do we want to patch this or refactor it and simplify?

@fehguy, @whitlockjc, @mohsen1 - thoughts?

@rutchkiwi
Copy link

got the same problem over here!

@dariusz
Copy link

dariusz commented May 6, 2015

Hey @ponelat -- not sure if it helps your decision to generate within -ui or -js, ... but honestly, even something as simple as listing the name of the ResponseModel (without rendering it) would be a great first step.

@fehguy
Copy link
Contributor

fehguy commented May 8, 2015

There is a meta-issue to support schemas differently and not render in the swagger-js client. I'm going to add tasks to that meta issue, reference this and other related issues, and close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants