-
Notifications
You must be signed in to change notification settings - Fork 211
Open
Conversation
simon-wenmouth
commented
Jul 16, 2024
Author
It looks like I should regenerate the opts.pb.go using protoc-gen-go@v1.28.0 and protoc@v3.19.4. I'll update the PR in case this introduces a breaking change for others.
simon-wenmouth
force-pushed
the
feature/protoc-gen-entgql
branch
from
July 16, 2024 04:40
fcc8576 to
06342a4
Compare
simon-wenmouth
commented
Jul 16, 2024
Author
I've updated the version of protoc to match the previous generated version (only a comment changed).
Added support for `entgql.Annotation` to the `protoc-gen-ent` plugin. It should now be possible to generate an Ent schema and its GraphQL configuration from a Protocol Buffer file. The `opts.proto` was updated adding `GQL` child MessageTypes to the existing MessageTypes (`Schema`, `Field`, `Edge`). The associated generated code (`opts.pb.go`) was regenerated using `protoc-gen-go`. The AST generation code in `schemaast/annotation.go` was updated to know about the `entgql` annotations. The new method attempts to generate code similar to that in the documentation. The main package was updated to map the configuration settings in the updated `opts.proto` to the corresponding annotations for the schema, fields, and edges.
simon-wenmouth
force-pushed
the
feature/protoc-gen-entgql
branch
from
July 16, 2024 05:12
06342a4 to
d82c1b6
Compare
When a GraphQL type extends a definition in another sub-graph the names
of the pagination types clash, in particular the where-inputs. Rather
than taking the union of the properties when creating the supergraph, it
takes the common properties. This is true whether your input types are
declared with `type` or `extend type` (or so it seems). It doesn't make
sense to copy-paste the where-input types between projects, since Ent
cannot use them (would mean joining across databases).
This commit allows the rename of the pagination types, avoiding the
clash described above. The feature is used as follows:
entgql.PaginationNameOverrides = map[string]string{
"Domain1_EntityA": "DomainN_Domain1_EntityA",
"Domain2_EntityA": "DomainN_Domain2_EntityB",
}
In this example, our sub-graph (DomainN) is providing type extensions
for entities in two different sub-graphs (Domain1, Domain2). In this
manner, we will not get collisions when multiple sub-graphs extend a
particular type.
This is combined with a `entgql.WithOutputWriter` that uses a fork of
`github.com/vektah/gqlparser/v2@v2.5.20/formatter/formatter.go` that
overrides `FormatSchema` to accept a set of extension types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added support for
entgql.Annotationto theprotoc-gen-entplugin. It should now be possible to generate an Ent schema and its GraphQL configuration from a Protocol Buffer file.The
opts.protowas updated addingGQLchild MessageTypes to the existing MessageTypes (Schema,Field,Edge). The associated generated code (opts.pb.go) was regenerated usingprotoc-gen-go.The AST generation code in
schemaast/annotation.gowas updated to know about theentgqlannotations. The new method attempts to generate code similar to that in the documentation.The main package was updated to map the configuration settings in the updated
opts.prototo the corresponding annotations for the schema, fields, and edges.