-
Notifications
You must be signed in to change notification settings - Fork 55
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
fix: 👽 Added support for nodes query #217
base: main
Are you sure you want to change the base?
Conversation
Ent (sometimes?) generates a "nodes" query to fetch multiple nodes in batch in the latest version . This was not compatible with Bramble so I fixed that Maybe related to movio#96, not sure
Hi @karatekaneen is this the ent you mean? Can you post an example of generating the graphql The support for the Relay Node interface is relatively unused at the moment, it's left over from an initial prototype design of how our federation model would work. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #217 +/- ##
==========================================
+ Coverage 72.36% 72.43% +0.07%
==========================================
Files 27 27
Lines 2790 2848 +58
==========================================
+ Hits 2019 2063 +44
- Misses 630 644 +14
Partials 141 141 ☔ View full report in Codecov by Sentry. |
@pkqk Yes, it's Ent with My Ent schema is currently something of a kitchensink but it looks like this: package schema
import (
"entgo.io/contrib/entgql"
"entgo.io/contrib/entproto"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
)
type FormData struct {
ent.Schema
}
func (FormData) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "data"},
entgql.RelayConnection(),
entgql.Directives(entgql.Directive{Name: "boundary"}),
entgql.QueryField(),
entproto.Message(),
entproto.Service(entproto.Methods(entproto.MethodGet)),
}
}
// Fields of the FormData.
func (FormData) Fields() []ent.Field {
return []ent.Field{
field.Int("object_id").
StorageKey("obj_id").
Annotations(entproto.Field(2)),
field.String("module").
StorageKey("data_mod").
Annotations(entproto.Field(3)),
field.Int("type").
StorageKey("data_type").
Annotations(entproto.Field(4)),
}
}
// Edges of the FormData.
func (FormData) Edges() []ent.Edge {
return []ent.Edge{}
} And the relevant parts of GraphQL that gets generated looks like this: type FormData implements Node @boundary {
id: ID!
objectID: Int!
module: String!
type: Int!
}
interface Node @goModel(model: "bitbucket.org/company/entdemo/ent.Noder") {
id: ID!
}
type Query {
node(id: ID!): Node
nodes(ids: [ID!]!): [Node]!
formDataSlice(
after: Cursor
first: Int
before: Cursor
last: Int
where: FormDataWhereInput
): FormDataConnection!
} So, just to be clear. I don't mind the Relay Node interface to be unused. It's just that I wanted to be able to hook up my projects to Bramble without having to filter out the incompatible query from every schema in the |
@pkqk Had any chance to take a look at this? |
Hi @karatekaneen I haven't had a chance to review it yet, though your use case makes more sense now. I might be able to find time end of next week. Are you ok running your fork in the mean time? |
@pkqk It's ok to run the fork for now. Just wanted to avoid syncing it when you are doing updates. |
We are using mTLS with custom certificates and need to override the default http transport. It looked like it was working by overwriting the `QueryHTTPClient` field on the config but noticed that it wasnt being respected when new services was instantiated.
@pkqk Found a small bug where the custom http.Client wasn't being respected. Fixed that on this branch as well |
Thanks @karatekaneen, would you be able to pull it out into it's own PR? I can merge and test that more quickly. We haven't had a chance to test with Ent yet. |
Ent (sometimes?) generates a "nodes" query to fetch multiple nodes in batch in the latest version . This was not compatible with Bramble so I fixed that.
The queries that I get generated in my project looks like this:
Maybe related to #96, not sure