protoc-gen-grafbase-subgraph: fix panics when pushing packages out of order#144
Merged
Conversation
tomhoule
force-pushed
the
tomhoule-oupyztyowuuz
branch
from
August 1, 2025 11:58
d8cbcda to
ca6dfc0
Compare
fbjork
approved these changes
Aug 1, 2025
tomhoule
marked this pull request as ready for review
August 1, 2025 14:28
tomhoule
force-pushed
the
tomhoule-oupyztyowuuz
branch
from
August 1, 2025 14:28
ca6dfc0 to
134873a
Compare
tomhoule
added a commit
that referenced
this pull request
Aug 13, 2025
### Added - **Multiple subgraphs support** added. Support for generating multiple GraphQL files based on service annotations: - Services can now have a `subgraph_name` option that maps them to different subgraph files - When any service has a `subgraph_name`, the tool automatically switches to multi-file mode - Generated files are named `<subgraph_name>.graphql` instead of the default `schema.graphql` - Each subgraph file only includes the services and types relevant to that specific subgraph - Multiple services can map to the same subgraph - Services without `subgraph_name` in multi-file mode are ignored without warning - **Proto3 optional field support** added. The generator now properly handles proto3 optional fields: - Non-optional scalar and enum fields in proto3 are rendered as non-nullable (`Type!`) in GraphQL output types - Optional scalar and enum fields are rendered as nullable (`Type`) in GraphQL output types - Message type fields are always nullable regardless of the optional flag - Input types remain nullable for all fields - The generator now declares support for `FEATURE_PROTO3_OPTIONAL` to work with proto3 files containing optional fields - **Composite schemas shortcuts** added. New protobuf options for simplified composite schemas directives: - `grafbase.graphql.key` option generates `@key` directives on types - `grafbase.graphql.lookup` option generates `@lookup` directive on RPC methods - `grafbase.graphql.argument_is` option on RPC methods generates `@is` directive on the input argument - a shortcut for `grafbase.graphql.argument_directives = "@is(field: \"...\")"` - `grafbase.graphql.join_field` option generates fields with `@require` and `@grpcMethod` directives, with proper type resolution - **Input argument directives** added. You can now add GraphQL directives to RPC method input argument, that corresponds to the input of the RPC method, using the `grafbase.graphql.argument_directives` option on methods. - **Composite schema entity references with @derive** added. You can now create federation-style entity references using the `grafbase.graphql.derive_field` option on messages: - Use `option (grafbase.graphql.derive_field) = {entity: "User", is: "{ id: user_id }"};` on fields - Automatically generates reference fields with `@derive` and `@is` directives - Creates stub entity types with `@key` directives if the type is not already defined - Supports custom relation field names with the `name` parameter - The `@is` directive uses the value from the `is` parameter directly - Enables cross-subgraph entity references in federated schemas - **Input argument directives support** added. You can now add GraphQL directives to RPC method input arguments using the `grafbase.graphql.argument_directives` option: - Use `option (grafbase.graphql.argument_directives) = "@constraint(minLength: 1)";` in method options - Supports multiple directives in a single string, separated by spaces - Works with both Query and Mutation fields - Can be combined with existing method directives ### Fixed - In some scenarios, the plugin would panic because packages were not provided in alphabetical order. This is fixed. (#144) closes GB-9518
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.
No description provided.