Comments (17)
Fragments are supported. There is a test in test/graphql_test.rb named test_post_fragment
.
I can look into why you example doesn't work though. It might take a couple of days before I can get to it though.
from agoo.
Started looking at this today. I am not able to reproduce the issue so I suspect there is something different about the request. Can you tell me what the HTTP POST request looks like or what the content type of the request is? Is it application/graphql
?
from agoo.
Good afternoon,
We are working to provide you a reproducible example.
Meanwhile, this is the request that we are sending:
Request URL: http://localhost:6464/phrases
Request Method: POST
Status Code: 200 OK
Remote Address: 127.0.0.1:6464
Referrer Policy: strict-origin-when-cross-origin
accept: application/json, multipart/mixed
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 269\n
content-type: application/json
Host: localhost:6464
Origin: http://localhost:6464
Referer: http://localhost:6464/iql.html
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Sec-GPC: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
{"query":"\nfragment Phrase on Phrase {\n code\n usages\n starting_english_phrase\n is_system\n rank\n}\n\nquery getPhrases($filters: PhrasesInput) {\n phrases(filters: $filters) {\n ...Phrase\n }\n}\n","variables":{"filters":{}},"operationName":"getPhrases"}
and this is the response that comes:
{"data":{"phrases":[{},{},{},{},{},{}]}}
I checked the test that you mention, on the example with fragments you are using application/json, but in any cases we tried with application/graphql and it doesn't really help.
I'm attaching some postman requests to demonstrate the issue:
A valid graphql call
Same but with fragment instead
from agoo.
That helps. I'll try testing with JSON instead of GraphQL content.
from agoo.
That helped a lot although I would have expected to see an error on the fragment calls. There is a bug in the JSON parser which I will fix. Please try the json-parser-fix branch.
from agoo.
Thank you for your time for having a look on this issue.
Regarding content-type: application/graphql
, I think there's another bug to it:
The first image with "name not provided"
"parse error"
is the outcome of trying to send a request with application/graphql
.
And secondly, when I try to introspect the schema with this library graphqurl
and execute the following command gq <url> --introspect > schema.json
it fails with unsupported content type
.
Noticeably, if I modify the command to export json rather than schema, it works, but then again I have to explicitly indicate the content-type:
gq <url> -H 'content-type: application/json' --introspect --format json > schema.json
from agoo.
I'm not familiar with the gq tool so I'm not sure what the --introspect does but I will check it out and run some tests to get it all working.
I can't tell from the first image what the content was of the call. With that I could probably figure out what is going on.
from agoo.
ah, the content was the same as on other images, with or without fragment usage the error will be the same.
--introspect basically runs an IntrospectionQuery that downloads a schema.
from agoo.
I assume you mean the the same but in graphql format and not JSON, right?
from agoo.
yes indeed. it should download a SDL schema, instead of JSON
from agoo.
To nights homework for me will be to try out gq and see what is sent.
from agoo.
The following command:
gq https://graphqlzero.almansi.me/api --introspect > schema.graphql
downloads a schema. This is useful for generating typescript types to use in frontend frameworks - more automation
and then this schema is feed to graphql-codegen that will generate the types we need
from agoo.
BTW, with Agoo you can also download the schema with http://localhost:3000/graphql/schema
if the GraphQL endpoint is http://localhost:3000/graphql
.
Can graphql-codegen be configured to generate ruby code as well?
from agoo.
The reason for the error in the first block is that just changing the header with gq does not change the content. The content is still JSON but the header claims to be graphql so Agoo attempts to parse as graphql and fails. Digging in to more but want to give you some preliminary feedback.
I'll have to try something else beside gq for introspect. Agoo is returning the expected result but gq is refusing to read it for some reason. I'll try curl with the same query and see what happens but that will be tomorrow.
from agoo.
I haven't been able to reproduce the gq introspect issue. Curl works fine with the same query as does graphiql. I did uncover another issue with graphiql. A comment only request caused a crash which has been fixed. Just refresh the branch.
from agoo.
I plan on releasing these changes if I don't hear back from you by tomorrow.
from agoo.
Released and closing.
from agoo.
Related Issues (20)
- CORS issues HOT 8
- Agoo dumps core on malformed SDL HOT 5
- fails to launch in clustered mode HOT 17
- Agoo Fragment Cycle Security Vulnerability HOT 2
- Disabling introspection for GraphQL HOT 12
- Changes on args or req does not get fowarded to the other calls HOT 9
- Static asset with space in filename HOT 4
- gem install agoo fails on MacOS Ventura 13.2.1 HOT 9
- Static .txt files are not served with utf-8 encoding HOT 8
- Agoo crash and exit HOT 7
- CLI options for SSL/TLS HOT 3
- localhost is crashing as bind address HOT 4
- 502 via nginx proxy_pass HOT 3
- TypeError: no implicit conversion of Array into String HOT 2
- rackup -r agoo -s agoo Doesn't Work HOT 8
- Out of curiousity would anything have been lost or gained by using ABI, or FFI, or *.SO over the current API method of directly calling in the Ruby C file headers? HOT 3
- Configuring worker count and thread count when used with Rails HOT 5
- Port cleanup on shutdown? HOT 3
- REMOTE_ADDR not set on ENV HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agoo.