graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

transforms: show header transforms in UI

Open Code-Divine opened this issue 2 years ago • 3 comments

I have created an action query like this

type Query {
  """ Institutions by Specialty """ mt_institutions_by_specialty(
    specialty_id: String!
  ): Institutions
}

Now I need to use that speciality_id input as a value in the Headers section bellow. But {{$body.input.speciality_id}} does not convert. It works only in the "Change Request Options" section.

Code-Divine avatar Mar 07 '22 13:03 Code-Divine

Hi @Code-Divine

The headers transform is not exposed in the UI yet. The headers section that you see is actually the "static" headers that you set for your action. If you want to transform it per request, then you will have to use the API for now: https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#id72

tirumaraiselvan avatar Mar 07 '22 14:03 tirumaraiselvan

Hi @tirumaraiselvan

Thanks, I am using the api and it works prefectly. In my case it was ideal if I can send the data as header so keep it in mind for possibly allowing dynamic headers.

Code-Divine avatar Mar 07 '22 14:03 Code-Divine

Just want to add a small note:

We haven't finished stabilizing the Request Transformation HTTP API just yet, so it's subject to breaking changes as we continue to develop the feature.

That isn't to say that you shouldn't feel comfortable using it if it solves a problem for you! Just that we may have to change the request or response body schemata associated with these API endpoints without bumping the major or minor versions of HGE.

jkachmar avatar Mar 07 '22 22:03 jkachmar