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

Add GraphQL support #1023

Merged
merged 1 commit into from
Nov 27, 2022
Merged

Add GraphQL support #1023

merged 1 commit into from
Nov 27, 2022

Conversation

jcamiel
Copy link
Collaborator

@jcamiel jcamiel commented Nov 25, 2022

This PR closes #504 : we support now GraphQL queries, with/without variables.

The syntax choosen is:

  • Unnamed query:
POST http://localhost:8000/graphql
```graphql
{
  allFilms {
    films {
      title
      director
      releaseDate
    }
  }
}
```

Any GraphQL queries should be supported without issues.

  • Query with variables:
POST http://localhost:8000/graphql
```graphql
query Person($id: ID!) {
  person(id: $id) {
    name
  }
}

variables {
  "id": "cGVvcGxlOjQ="
}
```

Variables is a JSON object, that can also be templatized with Hurl variables (à la Inception):

POST http://localhost:8000/graphql
[Options]
variable: id=cGVvcGxlOjQ=
```graphql
query Person($id: ID!) {
  person(id: $id) {
    name
  }
}

variables {
  "id": "{{id}}"
}
```

For the moment, we haven't yet addressed injecting GraphQL queries from files but we have a syntax in mind that will be elegant and simple without introducing new concept!

@jcamiel jcamiel marked this pull request as ready for review November 25, 2022 15:10
@fabricereix
Copy link
Collaborator

/accept

@hurl-bot
Copy link
Collaborator

🕗 /accept is running, please wait for completion.

@hurl-bot
Copy link
Collaborator

✅ Pull request accepted and closed by fabricereix with fast forward merge..

# List of commits merged from Orange-OpenSource/hurl/feature/graphql-variables branch into Orange-OpenSource/hurl/master branch:

  • ed3217c Add support for GraphQL variables.

@github-actions github-actions bot merged commit ed3217c into master Nov 27, 2022
@github-actions github-actions bot deleted the feature/graphql-variables branch November 27, 2022 10:19
@jcamiel jcamiel changed the title Add support for GraphQL variables. Add GraphQL support Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GraphQL body type
3 participants