insomnia
insomnia copied to clipboard
[Feature Request] Shared Fragments
Details
Would like a way to use common fragments in my queries without duplicating them in each request.
Related Issues
https://github.com/getinsomnia/insomnia/issues/1674 https://github.com/getinsomnia/insomnia/issues/1401
👋 Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. If you're requesting a feature 🎁, please provide real use cases that would benefit. 👪
To help make this a smooth process, please be sure you have first read the contributing guidelines.
Theres a pending open PR that solves this
@elemanhillary Has that PR been merged? Thanks
@elemanhillary any update on this?
@elemanhillary What PR were you referring to? This would be a great feature to have!
Could not find the pull request mentioned by @elemanhillary. This feature would make Insomnia so much more useful with GraphQL. It's terrible to keep fragments in sync when evolving an API.
I am getting to a point I have to copy 2-4 fragment for each query. Adding shared fragments would really help
Any chance of this in 2021? :D
Would be very helpful 🙏🏻
please save us from fragments-hell 😈
Give me a detailed example of this issue and i promise you in 2-3 weeks i will raise a PR for this issue @sa9sha9 @hannahmkim
@elemanhillary
We want to be able to define a fragment in one place, but then use them on multiple requests.
Like environment variables for GraphQL queries.
Define this in a shared/central location
fragment taxFragment on Tax {
taxId
country
region
appliesToDigital
taxAmount
}
Then allow it to be reused in multiple different requests
query utils_insomnia__taxes_app {
taxes {
...taxFragment
}
}
Because right now what I have to do is copy/paste the same fragments to the end of a zillion requests and if there is a change I have to go and update them all. Because graphql throws an error you can't just pass them all in, so Insomnia would have to have some level of intelligence. In my application code, I solve this by using templating language and I generate the queries. You could do something similar with supporting
query utils_insomnia__taxes_app {
taxes {
...taxFragment
}
}
${taxFragment}
@elemanhillary I will send you cookies if you make this happen and tell me where to send them!
We really need this feature
Hey @elemanhillary! Any progress on this PR? We would love to be able to use this feature!
Anybody figure out a good workaround?
Any updates on this?
I would also like this. Shared fragments is fundamental to clean and maintainable Graphql queries.
Super hacky but usable plugin for anyone else who finds this thread -> https://github.com/MartinBeuriot/insomnia-plugin-gql-fragments
4 years later :(
Insomnia actually says on their homepage that you should be able to use fragments, but then no documentation anywhere ...
This issue is on my radar. We will look into it in January after the holidays.
Any updates on this? (@subnetmarco) This feature would be really useful!