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

Support for GraphQL #14

Open
lauevrar77 opened this issue Mar 9, 2021 · 3 comments
Open

Support for GraphQL #14

lauevrar77 opened this issue Mar 9, 2021 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@lauevrar77
Copy link

Do you plan to support GraphQL queries in HTTP action ? This would be nice to support that type of APIs.

I could send GraphQL queries in raw string format but it would need to escape every '"' symbol in the query (impractical).

@ivancorrales
Copy link
Member

Completely @lauevrar77! To be honest I thought about it for future releases. On the other hand, this could be considered for initial release v0.1.0 if help is provided...

It would be nice to use this thread, that you open, to discussing how it should be,

Thanks!

@lauevrar77
Copy link
Author

The sooner the better ! It is, I think the only thing that blocks me and my company to use it. I will see if I can work on this feature.

About what it should look like, I was thinking about something like this :

http post {
    ...
    request {
        baseUrl = "http://api.hostname.com"
        path = "/graphql"
        payload graphql {
            kind = query or mutation
            actionName = getUsers
            parameters {
                isActive=false
            }
            select {
                user {
                    posts {
                        title
                        ....
                    }
                }
            }
        }
    }
}

So graphql would contain base informations like :

  • Is it a query or a mutation
  • What is the query or mutation actionName ? (A better name would be appropriate)
  • What are the parameters for the query or the mutation
  • A selection of the response fields and subfields

However, I am currently not aware of exact syntax of HCL (haven't looked yet). So some changes would be needed to conform to the syntax.

What's you opinion ? Does it seem sound and complete ?

@ivancorrales ivancorrales added the help wanted Extra attention is needed label Mar 11, 2021
@ivancorrales
Copy link
Member

I like it but I would gof or something like this

http post {
  request {
    baseUrl = "http://api.hostname.com"
    path = "/graphql"
    payload graphql {
      query countries {
          _params {
            filter { currency { eq: "EUR" } }
          }
          countryName: name,
          languages {
            name,
             rtl
          }
        }
      }
      query languages {
        select {
          name,
          rtl
        }
      }
  }
  response {
  }
}

The above code is not valid at all,.. I purpose that because we could send more than a query or mutation in the same request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants