.meshrc.yaml
variable interpolation injection points
#614
-
Hi there! I was so happy to have been away from graphql for about a year and - upon coming back to it - realizing that schema-stitching is not only back, but with a fury with I'm working through some of the guides, but have a pretty specific need and haven't been able to find docs that go over the various ways we can securely (given git) set up our What are the various strategies for setting these so they don't get committed to git? Great work and the best of luck to the project! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Thank you for your kind words :) |
Beta Was this translation helpful? Give feedback.
-
aha! Thanks! I just realized there's this new thing called Github Discussions. I thought my issue got deleted. QQ, so in this example: sources:
- name: Covid
handler:
graphql:
endpoint: https://covid-19.dava.engineer/api/graphql
- name: WorldPop
handler:
jsonSchema:
baseUrl: https://datasource.kapsarc.org/api/records/1.0/search
operations:
- type: Query
field: population
path: /?dataset=world-population&q={args.country}&rows=1&sort=year&facet=year&facet=country_name
method: GET
responseSchema: ./src/json-schemas/worldPop.json the |
Beta Was this translation helpful? Give feedback.
-
Let me explain from scratch. There are two types of dynamic variables in GraphQL Mesh;
someparameterorvalue${YOUR_ENVIRONMENTAL_VARIABLE}someothervalue
YOUR_ENVIRONMENTAL_VARIABLE=MYVALUE yarn start So interpolated config file will be processed like below; someparameterorvalueMYVALUEsomeothervalue
So you can use those in Mesh configuration ;
Mesh will detect a dynamic argument in here. If you do a query like below; {
population(country: "Italy") {
...
}
} Mesh will replace passed value in
|
Beta Was this translation helpful? Give feedback.
Let me explain from scratch. There are two types of dynamic variables in GraphQL Mesh;
someparameterorvalue${YOUR_ENVIRONMENTAL_VARIABLE}someothervalue
${YOUR_ENVIRONMENTAL_VARIABLE}
will be replaced by the actual value. For example if you run your project like below;So interpolated config file will be processed like below;
someparameterorvalueMYVALUEsomeothervalue
In GraphQL, resolver functions will take 4 parameters; (If you don't know much about those, you can learn more in GraphQL Official Documentation)
root
-> Parent Valueargs
-> Arguments of the fieldc…