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

How to specify binary-type params #878

Open
natotthomer opened this issue May 24, 2023 · 3 comments
Open

How to specify binary-type params #878

natotthomer opened this issue May 24, 2023 · 3 comments

Comments

@natotthomer
Copy link

I have a POST request that I'm documenting that accepts a number of parameters, including one called images which is an array of binary files (image files). If I was documenting a param that's an array of a basic type, I'd write something like param :abc, Array, of: String, desc: "abc param description", required: true. I'm not even sure how to annotate a binary on its own let alone an array of binaries.

TLDR: How does one annotate binaries as an incoming param to a POST or PATCH request?

@mathieujobin
Copy link
Collaborator

Do you have a ruby class that you could specify there? like Image or something?

@natotthomer
Copy link
Author

Hmmm, that's a thought. But it's coming in as a binary string, I would not think that would map well onto the Image class. It's just a pure blob. Eventually those objects get saved in the DB as ActiveRecord attachments.

@mathieujobin
Copy link
Collaborator

it's a "pure blob" but it's still transferred via HTTP as a string, I still think it should be defined as a ruby class not in the API gem. Say it's a JPEG blog, then you create IncomingJpegBlob or something that would digest it.

I'm sorry, I can't think of anything else.

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

2 participants