Add @schema decorator to mark namespaces as GraphQL schemas - #5159
Merged
Conversation
Using the `TypeSpec.GraphQL.@schema` decorator on a namespace indicates that the decorated namespace represents a GraphQL schema that should be generated by the GraphQL emitter. Because this allows for multiple schemas to be specified in a TypeSpec source, our test host is reworked to provide a `GraphQLTestResult` corresponding to each schema produced. This commit does not actually implement any emitter functionality, but populates a state map that will be used by the emitter in the future.
steverice
force-pushed
the
schema-decorator
branch
from
November 20, 2024 22:54
f87595e to
5ef2ace
Compare
steverice
commented
Nov 21, 2024
Comment on lines
+67
to
+73
| /** | ||
| * There doesn't appear to be a good way to hook into the emit process and get the GraphQLSchema | ||
| * that's produced by the emitter. So we're going to read the file that was emitted and parse it. | ||
| * | ||
| * This is the same way it's done in @typespec/openapi3: | ||
| * https://github.com/microsoft/typespec/blame/1cf8601d0f65f707926d58d56566fb0cb4d4f4ff/packages/openapi3/test/test-host.ts#L105 | ||
| */ |
Contributor
Author
There was a problem hiding this comment.
@bterlson do you have any other ideas here?
Member
There was a problem hiding this comment.
This is the way, but open to implementing a better way if you have ideas!
bterlson
marked this pull request as ready for review
November 26, 2024 02:25
bterlson
requested review from
allenjzhang,
bterlson,
markcowl and
timotheeguerin
as code owners
November 26, 2024 02:25
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.
Using the
TypeSpec.GraphQL.@schemadecorator on a namespace indicates that the decorated namespace represents a GraphQL schema that should be generated by the GraphQL emitter.Because this allows for multiple schemas to be specified in a TypeSpec source, our test host is reworked to provide a
GraphQLTestResultcorresponding to each schema produced.This commit does not actually implement any emitter functionality, but populates a state map that will be used by the emitter in the future.