Open collegeimprovements opened 4 years ago
@collegeimprovements currently not possible, sadly.
I’d definitely like to look into some form of native GraphQL support — what other GraphQL-related features would you like to see in HTTPie?
tldr; Example:
http query.graphql --schema schema.json
☝🏼Extension can be anything like: http
or gql
or graphql
or post
etc. The idea is user should be able to directly copy-paste the query from graphiql or graphql-client. He should not be worried about json conversion.
👉🏼 --schema
file is optional. When provided the query is parsed & validated against it first. [might be out of scope]
graphql
request. dev
and `prod.I think with this two features we can compose many powerful apps.
I don't know if the following falls into httpie
's scope.
E.g. We can download graphql's schema.json
file and then we can have autocomplete
and validation
support.
With this two - Vim, VSCode, IDEs can implement: validation, autocomplete and response features for any graphql schema even with offline support. I was trying to send "graphql" queries from vim to terminal, but could not find a tool that can do that.
Hey there! I'm thinking about working on this one if that's ok.
I guess this can be broke down to three ideas/PRs:
http httpbin.org/post < graphql.schema
)--save
or --download
)Obs: I think introspection would be in scope but as far as I understand (correct me if I'm wrong) it comes down to just a regular query, so I guess you'll end up having to write that yourself as a user (i.e. wouldn't be an actual httpie feature).
Am I either misunderstanding the issue, or has this been added?
http POST https://api.spacex.land/graphql/ query="{ launchesPast(limit: 1) { mission_name id } }"
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 77
Content-Type: application/json; charset=utf-8
Date: Sun, 06 Dec 2020 23:36:39 GMT
Etag: W/"4d-gZOMzXfj+ItRDOmYGjTauITd5rQ"
Server: Cowboy
Via: 1.1 vegur
X-Powered-By: Express
{
"data": {
"launchesPast": [
{
"id": "109",
"mission_name": "Starlink-15 (v1.0)"
}
]
}
}
And it works with 'messy' whitespace too (directly ctrl-a + ctrl-c'd from graphiql)
http POST https://api.spacex.land/graphql/ query="{
launchesPast(limit: 1) {
mission_name
id
}
}
"
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 77
Content-Type: application/json; charset=utf-8
Date: Sun, 06 Dec 2020 23:40:20 GMT
Etag: W/"4d-gZOMzXfj+ItRDOmYGjTauITd5rQ"
Server: Cowboy
Via: 1.1 vegur
X-Powered-By: Express
{
"data": {
"launchesPast": [
{
"id": "109",
"mission_name": "Starlink-15 (v1.0)"
}
]
}
}
@schmidlidev GraphQL requests are regular HTTP requests so they have always been supported. This issue is about deeper GraphQL-specific features.
It would be nice to get GraphQL pagination supported natively. To fetch more than 100 results from GitLab API https://docs.gitlab.com/ee/api/graphql/getting_started.html#pagination on one go.
Currently to hit any Graphql
query
ormutation
, we need to convert them first to json. It would be really great if we can copy the query directly fromgraphiql
and then pass it tohttpie
.Is it possible with httpie natively ? One of the vs-code extension is already doing it. Is the same/similar thing possible with
httpie
?