Repository navigation
Join GraphQL handlers on one field and declare GraphQL type names - #25
Merged
Merged
Conversation
Handlers that call the same field with other arguments or returns no longer stop generate: each distinct schema is written once, as a list when there are several (`returns: [PetWithName, PetWithStatus]`, `arguments: [~, PetArgs]`). #[BidirektSchema(graphqlType: 'Pet')] and `@bidirekt schema graphqlType=Pet` write `name: Pet` on an object or enum schema, and `scalar: 'ID'` is the way to send a built-in GraphQL scalar by its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changes for the developer:
Several handlers on one field. Two handlers that call
petwith otherargumentsorreturnsused to stopgenerate("declare the same returns in every handler"). Now they are joined, the way the broker joins the same declarations from two files:Names are de-duplicated and byte-sorted,
~first for a handler without arguments (arguments: [~, PetArgs]), one distinct schema stays a plain value.graphqlType.#[BidirektSchema(graphqlType: 'Pet')]or@bidirekt schema graphqlType=Peton a class or enum writesname: Peton its schema, so the check breaks when the provider's type has another name. Without it, a same-shape rename still doesn't break.Built-in scalars.
scalar: 'ID'/scalar:IDwrites{type: scalar, name: ID}, which broker 0.6.0 now accepts; the hint forreturns: 'ID'points to it.Files:
src/Model/Protocols/Graphql/BlocksToMerged.php,Operation.php,src/Reader/Protocols/Graphql/ConsumedOperation.php,src/Protocols/GraphqlProtocol.php: operations carry lists and are joined instead of refusedsrc/Writer/Protocols/Graphql/BlockToYaml.php,src/Writer/YamlSequence.php,YamlMap.php,ContractToYaml.php,StringToYaml.php: write a flow list of namessrc/BidirektSchema.php,src/Reader/SchemaClasses.php,ClassesToSchemas.php,FunctionsToSchemas.php,SchemaAnnotation.php,FieldOptions.php,TagArgumentsToOptions.php,src/Model/Protocols/Graphql/GraphqlExtra.php,src/Writer/Protocols/Graphql/FieldExtraToYaml.php:graphqlTypetests/:rejects-graphql-conflicting-handlersbecamegraphql-consumer-joins-handlers; newgraphql-consumer-joins-reads-of-one-field,graphql-type-names(-tags),rejects-malformed-graphql-type; unit tests and updated messagestests/e2e/run.sh: the joined consumer publishes and breaks only on the field the provider lacksREADME.md: joining,graphqlType, built-in scalars🤖 Generated with Claude Code