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

Allow uploading a package with something else then *os.File #6

Open
advdv opened this issue Oct 25, 2023 · 1 comment
Open

Allow uploading a package with something else then *os.File #6

advdv opened this issue Oct 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@advdv
Copy link

advdv commented Oct 25, 2023

Version

v1.0.0-beta.22

What happened

I'm trying to upload a package, but the method ComputePackage() only accepts an os.File. This means it requires a physical file to upload anything. Instead it should be possible to upload bytes straight from memory, e.g to upload something from an S3 bucket for example. Or to upload something from an embedded file (embed.FS).

For the latter to work the *os.File argument can just be turned into a fs.File (it covers both). For the first it probably requires a new method that just accepts bytes.

If ReadAt() is required, then the method should specify io.ReaderAt as the argument type. In that case the library user can determine how to implement this.

@advdv advdv added the bug Something isn't working label Oct 25, 2023
@Integralist
Copy link
Collaborator

👋🏻 Hi Adam

Thanks for opening this issue!

I completely agree that the interface (no pun intended) should be more flexible, as per the classic Go guidance Accept Interfaces, Return Concrete Types.

I'll create an internal ticket to track this work but I won't be able to provide an ETA for when this will be done.

This API client is generated from OpenAPI schemas (see blog post). We'll need to dig into the existing templates (that are from the open-source project OpenAPI Generator) and see what modifications we can make.

Thanks again.

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

No branches or pull requests

2 participants