[Feature Request] Support base 64-encoded image in the generated Swagger

Hi @emmanuel and the @Bubble team here is a feature request.

I will like to request that the generated swagger for a bubble app should have support for base 64-enconded images.

According to thebubble reference manual on sending data to bubble,

Unfortunately currently in the generated swagger only allows sending a string (url) of the image.
It doesn’t generate the spec for sending images as a bases64-encoded string.
So if one wants to do this they have to manually edit the swagger and this leaves room to make mess up the swagger.

So i’m suggesting you provide both options in the swagger or maybe in the settings let a user select which version (url or base64 enconded image) they want the generated swagger to have.

This feature together with returning objects from api workflow (instead of ids) will free users from editing the swagger spec when using bubble as backend for dropsource or any similar platform that may use the swagger.

Thanks

1 Like

@seanhoots Please share an example to show this limitation in swagger with images

Hi @neerja,
Here is an example of a swagger with an image field (photo) in the User table

https://useremailbug.bubbleapps.io/version-test/api/1.1/meta/swagger.json

And here is a snapshot showing that only the string option for posting an image is generated by the swagger

@seanhoots We need a little more information, so please send support an email with more context

Please can you be specific with the information or context you require.
I thought my initial post explained exactly what the issue is and the context.
If there is something specific you want to see please let me know

@seanhoots We get a lot of feature requests, the context would help us understand your use case and the urgency of this request.

Yes I understand, but I thought my original post clearly states the context.
That is, I want to send an image from dropsource app to my bubble database using a base64-encoded image string .
The swagger generated currently only supports sending an image url.
Thanks

@seanhoots Understood, thanks. We will review this request but cannot guarantee a timeline.

Hey,
Please use the following information from the link to be able to save files from dropsource:

Hey @lottemint.md, yes I’m aware of what you shared. If you read my original post I already referenced this.
The feature request here is for bubble to make the swagger file support this out of the box without the user having to edit the swagger file.

Oh, sorry. I haven’t noticed your attachment.

@seanhoots To make sure we understand, are you looking for string format modifier to be exposed in Swagger for your app because defining file as base64 in Bubble is already supported. Here is Swagger documentation.

HI @neerja, please can you show me where in the swagger is this supported.
Again take a look at the swagger snapshot below, I dont see anywhere in the swagger that the following fields are exposed to be able to post a base64 image to bubble

    {
         filename: String
         contents: Base64-encoded binary data
         private: Boolean
         attach_to: String
    }

As you can see from the image above the swagger only exposes a string field so you can only post an image url not an image in base64.
Unless you manually edit the swagger.
This is what all dropsource users have to do when they want to send an image from their app to bubble .
They have to manually edit bubble’s generated swagger to expose the fields (filename, contents, private, attach_to).
So my request is for bubble to expose these fields so that bubble developers doesn’t have to manually edit the swagger that bubble generates.

So in dropsource when i import this swagger i only see a single string field for an image.
Example in the swagger above this is how it shows up in dropsource. Only the string field that allows posting an image url is shown.

image

I need to at least see the fields filename and content to be able to post a base64 image.
Unless i manually edit the generated swagger these fields are not exposed.

Hi @neerja,
Looks like you’re not understanding me.
Bubble automatically generates a swagger specification for any bubble app.
Bubbble supports sending an image to the database as url or base64 enconded string.
But in the swagger that bubble generates, only the option to send an image as a url is exposed.
So what i’m asking is to expose the fields that allow sending an image as a base64 string just as you’ve done for the url.
In bubble’s documentation it states that you can post an image as base64 by supplying values for the following fields:

 {
         filename: String
         contents: Base64-encoded binary data
         private: Boolean
         attach_to: String
    }

But these fields are not exposed in the swagger file that bubble generates.

The answer to your question above is that this is not a swagger requirement but bubble’s own requirement as stated in bubble’s manual here.

Basically bubble is saying you can send an image using method A or B.
Then bubble generates a file that allows users to send images.
But bubble only expose method A.
And all i’m asking is for bubble to expose method B too.
So this is not a swagger requirement but bubble’s own requirement.

This issue is not perculiar to Dropsource.
Any application that wants to integrate with bubble using Bubble’s own generated swagger will face this issue.

Hello,

We’ll look into this, but as swagger doesn’t let you specify alerternate ways to send data for the same call, we may need some time to fix this. In the meantime, I recommend sending the file as a URL.

2 Likes

Thanks @emmanuel for responding to this.
I can understand the issue of swagger not supporting alternative parameters.

Maybe one way of getting around this will be to allow users to specify in the settings which option they will want to send their images/files so you base your swagger generation on their choice.

Thanks

1 Like