-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Changing placeholder in file upload map #2459
Comments
@ThirVondukr is what you are describing something that is supported by the GraphQL multipart request spec? Assuming we added this placeholder approach to Altair, let's consider how it would work: Single mode means there is a single named file variable involved (i.e. it is not a list, so no Multiple mode means there is a list of files assigned to one named file variable, which means each individual file is referenced by a Using the example you have above for the placeholder, While this will be a quality-of-life improvement over what we have today, it doesn't enable any new use cases. Does that summarize this properly? |
Honestly I'm not sure if multipart spec explicitly supports that, but you can add/pass files into nested inputs. response = await authenticated_graphql_client.query(
QUERY,
variables={"input": input},
files={
"input.arts.$.image": [
GraphQLFile(
name=f"{i}.png",
buffer=create_dummy_image(),
content_type="image/png",
)
for i in range(arts_count)
],
},
) internally it just unwraps it into a list of inputs with names such as for i, file in enumerate(file_list):
id_ = str(uuid.uuid4())
if placeholder in key:
file_key = f"variables.{key.replace(placeholder, str(i))}"
else:
file_key = f"variables.{key}.{i}" |
Looks like it should be supported by the spec: https://github.com/jaydenseric/graphql-multipart-request-spec?tab=readme-ov-file#curl-request-2 |
Currently with multi file upload file number is always added at the eng (e.g.
file.0
,file.
), and I have an input for a mutation like this:Which would require me to have keys
input.files.{Placeholder Here}.file
, which doesn't seem currently possible or simply isn't documented.It works if I construct that string myself, but then I obviously can't use multi file upload with altair client
Describe the solution you'd like
I think some sort of placeholder could be added, like
{}
or$
which would be replaced by the file numberAdditional context
![image](https://private-user-images.githubusercontent.com/50728601/313072977-70d3648a-adae-4f1c-a399-d1bc8db529e6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwMjIxNDYsIm5iZiI6MTcyMDAyMTg0NiwicGF0aCI6Ii81MDcyODYwMS8zMTMwNzI5NzctNzBkMzY0OGEtYWRhZS00ZjFjLWEzOTktZDFiYzhkYjUyOWU2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDE1NTA0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY4MzRhZjExYTM1MTM1OGEyZDcxZDFkNjIxMWFkMTkxYWI4NDczNjI4MTAxMTViNzFkYTlmNWFmMmEwMjEzZjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.q1-1lnon-xLUQUOGwpzdLztlJJeBSgyidOZNWHm2hE8)
Example with manually mapping files:
The text was updated successfully, but these errors were encountered: