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

File support #145

Merged
merged 29 commits into from
Oct 14, 2020
Merged

File support #145

merged 29 commits into from
Oct 14, 2020

Conversation

leszekhanusz
Copy link
Collaborator

Continuation of PR #126

Regarding this issue
Following this spec
A bunch of code ripped from this repo

leahein and others added 24 commits July 11, 2020 21:57
* chore: generate docs with sphinx

* chore: avoid documenting private members

* chore: add docs to manifiest

* chore: manually document every class on transport

* Write docs in sphinx rst format

* fix manifest

* Improve classes reference documentation

Co-authored-by: Hanusz Leszek <leszek.hanusz@gmail.com>
…raphql-python#141)

Replace travis badge by a GitHub action badge
Replace coveralls badge by a codecov badge
Add link to the documentation and leave only basic example in the README.md file
Remove last coveralls and travis references
@leszekhanusz leszekhanusz added type: feature A new feature type: documentation An issue or pull request for improving or updating the documentation labels Oct 6, 2020
@leszekhanusz leszekhanusz mentioned this pull request Oct 6, 2020
@KingDarBoja
Copy link
Contributor

The tests will fail on Windows because the EOL character is different:

ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "d:\anaconda3\envs\gql-dev\lib\site-packages\aiohttp\web_protocol.py", line 418, in start
    resp = await task
  File "d:\anaconda3\envs\gql-dev\lib\site-packages\aiohttp\web_app.py", line 458, in _handle
    resp = await handler(request)
  File "D:\Programming\py_projects\graphql-python-repos\gql\tests\test_aiohttp.py", line 574, in handler
    assert field_2_text == file_1_content
AssertionError: assert '\r\nThis is a test file\r\nThis file will be sent in the GraphQL mutation\r\n' == '\nThis is a test file\nThis file will be sent in the GraphQL mutation\n'
  -
  +
  - This is a test file
  + This is a test file
  ?                    +
  - This file will be sent in the GraphQL mutation
  + This file will be sent in the GraphQL mutation
  ?                                               +
INFO:aiohttp.access:127.0.0.1 [09/Oct/2020:00:30:40 +0000] "POST / HTTP/1.1" 500 244 "-" "Python/3.8 aiohttp/3.6.2"

Everything else looks good to me.

@codecov-io
Copy link

codecov-io commented Oct 10, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@d7ad2a5). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             master      #145   +/-   ##
==========================================
  Coverage          ?   100.00%           
==========================================
  Files             ?        13           
  Lines             ?       827           
  Branches          ?         0           
==========================================
  Hits              ?       827           
  Misses            ?         0           
  Partials          ?         0           
Impacted Files Coverage Δ
gql/transport/aiohttp.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7ad2a5...e92eee2. Read the comment docs.

@leszekhanusz
Copy link
Collaborator Author

The tests should be OK now under windows.
@KingDarBoja Could you please test it ? Thanks

@leszekhanusz leszekhanusz merged commit 92c8d70 into graphql-python:master Oct 14, 2020
@leszekhanusz
Copy link
Collaborator Author

@leahein @quasimik @KingDarBoja
Thanks again for your help with this feature.

@leszekhanusz leszekhanusz deleted the file-support branch October 24, 2020 07:20
@quasimik
Copy link

quasimik commented Oct 27, 2020

I just checked this, apologies for not responding quickly (I didn't set up proper notifications). Anyway, glad to see that it's merged! I can finally switch to this repo again 😃

@g-londhe
Copy link

g-londhe commented Apr 8, 2022

Hi,
Guys I'm trying to upload file with
{'operationName':"ProductMediaCreate",'variables':{"alt":"","image":"null","product":"product_id"},'query':"fragment ProductErrorFragment on ProductError { code message field __typename}fragment ProductMediaFragment on ProductMedia { id alt sortOrder url type oembedData __typename}mutation ProductMediaCreate($product: ID!, $image: Upload, $alt: String, $mediaUrl: String) { productMediaCreate( input: {alt: $alt, image: $image, product: $product, mediaUrl: $mediaUrl} ) { errors { ...ProductErrorFragment __typename } product { id media { ...ProductMediaFragment __typename } __typename } __typename }}"}

to saleor and I'm getting unable to parse the query

even for working(POSTMAN) query "{"operationName":"FileUpload","variables":{"file":null},"query":"fragment FileFragment on File { url contentType __typename}fragment UploadErrorFragment on UploadError { code field __typename}mutation FileUpload($file: Upload!) { fileUpload(file: $file) { uploadedFile { ...FileFragment __typename } errors { ...UploadErrorFragment __typename } __typename }}"}"

Could you guys share/update the documentation for the same?

@leszekhanusz
Copy link
Collaborator Author

@g-londhe Please open another issue for your question, with as much information as you can provide (which backend, the code you used, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating the documentation type: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants