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

Sample request body for binary string uses "raw" instead of "binary" #382

Closed
elazar opened this issue Jun 29, 2021 · 3 comments · Fixed by #412
Closed

Sample request body for binary string uses "raw" instead of "binary" #382

elazar opened this issue Jun 29, 2021 · 3 comments · Fixed by #412
Assignees
Labels
bug Something isn't working request-body

Comments

@elazar
Copy link

elazar commented Jun 29, 2021

When importing an OpenAPI spec with this request boy specification...

"requestBody": {
  "content": {
    "image/*": {
      "schema": {
        "type": "string",
        "format": "binary"
      }
    }
  },
  "description": "Upload of image file"
}

... the result is that "raw" is selected for the request body type instead of "binary" and a Lorem Ipsum-style string is supplied as the sample request body.

@VShingala
Copy link
Member

@elazar Got the issue. Are there any other media types that can show the same behavior? OpenAPI specification only mentions the image as one. (https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#considerations-for-file-uploads)

@VShingala VShingala added bug Something isn't working request-body labels Jul 22, 2021
@elazar
Copy link
Author

elazar commented Jul 22, 2021

@VShingala In the context of this issue, images are admittedly the only type I've dealt with.

If your thought is to handle this by content type, I'm not sure there's a reliable way to do so. You can potentially exclude text/* types, but there are others (e.g. application/json) to which I would assume you would not want to apply this new behavior.

Offhand, my suggestion would be to limit the change I'm suggesting to cases where the request body schema contains only a type of string and a format of binary. This can always be expanded later if other use cases surface.

@VShingala
Copy link
Member

@elazar This issue is now fixed with latest postman app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working request-body
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants