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

OAS 3.0 Form Data Try-It-Out object serialization #3788

Closed
shockey opened this issue Oct 19, 2017 · 5 comments · Fixed by swagger-api/swagger-js#1187
Closed

OAS 3.0 Form Data Try-It-Out object serialization #3788

shockey opened this issue Oct 19, 2017 · 5 comments · Fixed by swagger-api/swagger-js#1187

Comments

@shockey
Copy link
Contributor

shockey commented Oct 19, 2017

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 3.0.0
Which Swagger-UI version? 3.3.2
Which browser & version? Chrome 61
Which operating system? macOS High Sierra

Demonstration API definition

openapi: '3.0.0'
info:
  version: 1.0.0
  title: blah
servers:
- url: /
paths:
  /:
    post:
      description: asdf
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                id:
                  type: string
                  format: uuid
                address:
                  # complex types are stringified to support RFC 1866
                  type: object
                  properties: {}
      responses:
        200:
          description: OK

Expected Behavior

I expect my request body value, shown below, to be serialized correctly.

{
  "id": "string",
  "address": {}
}

Current Behavior

The address object is not properly serialized before the request is sent:

messages image 4135647482

Possible Solution

Non-primitive values should be serialized correctly, here: https://github.com/swagger-api/swagger-js/blob/2a3f113c1c219ec3756a73ffc35e366987ff6f5c/src/execute/oas3/build-request.js#L47

@banders
Copy link
Contributor

banders commented Nov 3, 2017

I am also having a problem with form data in Try It Out.

Using swagger-ui 3.4.2
OAS3 spec: https://raw.githubusercontent.com/banders/api-specs/upgrade-to-openapi3/jobposting/jobposting.json
(See the POST /jobs operation)

Clicking the execute button using the default request body results in a Javascript error on the page.

@shockey
Copy link
Contributor Author

shockey commented Nov 4, 2017

@banders this seems closely related, so I'll look into that as well. Sorry for the inconvenience!

@banders
Copy link
Contributor

banders commented Dec 6, 2017

@shockey I'm still seeing the same problem I reported in the Nov 3 post.

Using swagger-ui 3.6.0
OAS3 spec: https://raw.githubusercontent.com/banders/api-specs/upgrade-to-openapi3/jobposting/jobposting.json
(See the POST /jobs operation)

"Try it Out" then "execute" results in a jvascript error.

If you think this is unrelated to the original issue, I can write it up as new issue.

@shockey
Copy link
Contributor Author

shockey commented Dec 6, 2017

@banders, I think you're having a slightly different problem (my original issue was a serialization inaccuracy, not a thrown error), but I'll take a look. If I can reproduce the problem, no need for a ticket.

I'll circle back on this later today 😄

@banders
Copy link
Contributor

banders commented Dec 6, 2017

@shockey I appreciate it. Thanks!

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

Successfully merging a pull request may close this issue.

2 participants