Comments (3)
Thanks @yuki24 & @dblock, fragments is indeed the way to go -- I was able to test on my end.
Solution (reusing previous example):
- we create a fragment such as
FRAGMENT_TEST = <<-GRAPHQL.freeze
fragment fragmentTest on PersonType {
name
age
}
GRAPHQL
- add it to our query
first one:
<<-GRAPHQL.freeze
query(
$id: Int!
) {
queryName(
id: $id
) {
person {
...fragmentTest
}
}
}
#{FRAGMENT_TEST}
GRAPHQL
second one:
<<-GRAPHQL.freeze
query(
$id: Int!
) {
queryName(
id: $id
) {
person {
...fragmentTest
relationshipStatus
networth
}
}
}
#{FRAGMENT_TEST}
GRAPHQL
from graphlient.
I think what you are looking for is Fragments. I'm not sure if this is already baked into graphlient but @dblock or @ashkan18 may be able to give you answers.
from graphlient.
Right on @yuki24, it's baked in and the linked doc has an example that should work out of the box. I'll close this, but feel free to ask more questions/reopen @karmingc. Also copy/paste what you come up with here for the next person.
from graphlient.
Related Issues (20)
- cannot stub request anymore HOT 11
- Unable to pass literal values / constants in Ruby HOT 3
- Getting error - After upgrading rails from 5.2.8 to 6.1.7 HOT 3
- [FEATURE] Expose underlying HTTP response HOT 1
- Custom type name lookup not working HOT 2
- How to pass context in query? HOT 14
- Dynamically change headers HOT 2
- Don't know how to pass custom input types HOT 2
- Mutation HOT 11
- disable schema dump HOT 3
- How to stub with webmock HOT 12
- Faraday Timeouts no longer coming through as instance of Graphlient::Errors::FaradayServerError HOT 6
- Latest version incompatible with faraday 1.0.0 HOT 8
- Camelcasing => ClientError between 0.3.3 & 0.3.7 HOT 4
- Cache Faraday::Connection and use Faraday::Adapter::NetHttpPersistent
- How to query without a schema? HOT 2
- Are union types supported using block syntax? HOT 1
- Docs incorrectly state that Graphlient::Errors::TimeoutError does not inherit from Graphlient::Errors::ServerError HOT 3
- Enable the use of FragmentDefinition constants within blocks HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphlient.