Add simple type components (Enum, Scalar, Union) with component tests#79
Draft
FionaBronwen wants to merge 2 commits intofionabronwen/graphql-foundation-skeletonfrom
Draft
Conversation
c664ca3 to
9d65cbe
Compare
d5eb811 to
9ce5acc
Compare
9d65cbe to
48403d0
Compare
9ce5acc to
e8903e3
Compare
48403d0 to
806adc8
Compare
f379460 to
c9c7af2
Compare
ce78164 to
5c566f6
Compare
c9c7af2 to
4178df3
Compare
5c566f6 to
c6906db
Compare
4178df3 to
5195591
Compare
Add the first set of Alloy JSX components for GraphQL type emission: - EnumType: renders GraphQL enum definitions with member descriptions and deprecation - ScalarType: renders custom scalar definitions with @specifiedBy support - UnionType: renders union type definitions with model and scalar variant members - GraphQLSchema: root context wrapper providing TspContext and GraphQLSchemaContext Add component-level tests using renderSchema + printSchema to exercise the real Alloy rendering pipeline. Each component is tested in isolation with a lightweight test helper (renderComponentToSDL) that provides minimal context. 14 new tests covering: basic rendering, doc comments, deprecation, name sanitization, @specifiedBy, union member registration, and scalar wrappers.
- Extract isScalarLikeType() to type-utils.ts shared utility, replacing duplicated inline check in union-type.tsx - Replace unsafe `as Union` casts in union-type tests with assertUnionResult() helper that provides a clear error if the mutation returns a Model
5195591 to
c288111
Compare
193c59a to
95f3757
Compare
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.
Summary
Adds the first set of Alloy JSX type components and establishes the component testing pattern.
EnumType,ScalarType,UnionType— these are self-contained (noFieldchildren), making them the simplest starting point.GraphQLSchemawrapper: Root component that providesTspContextandGraphQLSchemaContextto all child components.renderComponentToSDL()helper renders components through the real Alloy pipeline (renderSchema→printSchema) without file I/O or the full emitter orchestration.@specifiedBy, union member types, and scalar wrapper variants.Test plan
npm run buildsucceedsnpm test— 148 tests pass (134 existing + 14 new)