You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file upload functionality of gql allows the user to provide as a file variable either:
an opened file
a StreamReader instance (for streaming from a download)
an async generator (for streaming a local file for example)
but then we added the possibility to
change the optional filename property to the name property of the provided object
change the content_type property by setting that property on the provided object
The problem is that you cannot set a name to an async generator or change the name property of a file without resorting to hacks.
I propose to change the current interface to require the user to provide as a file variable a new FileVar dataclass which can contain any optional argument we want.
We could then:
open files ourselves and close them afterwards
add a streaming bool to create the streaming async generator ourselves
add filename and content_type optional attributes to change those parameters for any provided
The file upload functionality of gql allows the user to provide as a file variable either:
but then we added the possibility to
filename
property to the name property of the provided objectcontent_type
property by setting that property on the provided objectThe problem is that you cannot set a name to an async generator or change the name property of a file without resorting to hacks.
I propose to change the current interface to require the user to provide as a file variable a new
FileVar
dataclass which can contain any optional argument we want.We could then:
streaming
bool to create the streaming async generator ourselvesfilename
andcontent_type
optional attributes to change those parameters for any providedInstead of:
we would have simply:
and changing the
filename
property would be as simple as:Also instead of:
we could have:
(while still allowing custom async generators of course for more advanced streaming options)
the
FileVar
dataclass would look something like this:This would be a breaking change but we could still allow the old classes (but add a deprecated warning).
The text was updated successfully, but these errors were encountered: