Add Object, Interface, and Input type components with tests#80
Open
FionaBronwen wants to merge 6 commits into
Open
Add Object, Interface, and Input type components with tests#80FionaBronwen wants to merge 6 commits into
FionaBronwen wants to merge 6 commits into
Conversation
d5eb811 to
9ce5acc
Compare
aa5f67f to
915dfa1
Compare
9ce5acc to
e8903e3
Compare
915dfa1 to
292ff4b
Compare
e8903e3 to
46bd2fe
Compare
292ff4b to
e647811
Compare
f379460 to
c9c7af2
Compare
e647811 to
79f53c2
Compare
2 tasks
c9c7af2 to
4178df3
Compare
41fbefb to
8a187c4
Compare
5195591 to
c288111
Compare
ffa9c95 to
fe7da60
Compare
cc17a78 to
97fd892
Compare
618e444 to
1f7438a
Compare
2ef9793 to
db9b099
Compare
6266724 to
b0a8480
Compare
db9b099 to
6cd9324
Compare
b0a8480 to
dac5789
Compare
7ec6f27 to
255e13b
Compare
Add field-bearing type components that use the Field infrastructure (already present from the parent branch): - ObjectType: renders object types with fields, @compose interfaces, and @operationFields support - InterfaceType: renders interface type definitions with fields - InputType: renders input types with automatic Input suffix when a model appears in both input and output positions 17 new component tests covering: basic field rendering, doc comments, optional/nullable fields, array/list types, deprecated fields, interface implementation via @compose, and Input suffix logic.
…ed imports - Add explanatory comment on getComposition/iface.name in object-type.tsx clarifying that pre-mutation names match post-mutation names (mutation engine doesn't rename models) - Remove unused `type Model` import from all G2 test files
- Add @operationFields test to ObjectType (verifies operation field rendering) - Add nested model reference test to ObjectType (verifies type references) - Add empty model tests to ObjectType, InputType, InterfaceType (documents that GraphQL requires at least one field per type)
The mutation engine now handles all input/output type naming, so components can use type.name directly without looking up whether a model has both input and output variants.
- Remove implementation detail comments about mutation engine - Remove redundant tests that were testing non-responsibility of the component (InputType doesn't add suffixes - that's not its job)
Replace fragile .toContain() assertions with inline snapshots to match TSP ecosystem best practices. This makes test output more readable and maintainable by showing the complete expected SDL in one place.
dac5789 to
1efbf90
Compare
255e13b to
15743c4
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
Add Object, Interface, and Input type components for rendering GraphQL type declarations.
ObjectType- Renders GraphQL object types with fields, interface implementations, and operation fieldsInterfaceType- Renders GraphQL interface types (models marked with@Interface)InputType- Renders GraphQL input object typesThis PR builds on #86 (mutation engine fixes) which ensures all type naming is handled during mutation, so components can simply use
type.namedirectly.Changes
New Components
ObjectType (
src/components/types/object-type.tsx)@composedecorator@operationFieldsdecoratorInterfaceType (
src/components/types/interface-type.tsx)@Interfaceas GraphQL interface typesInputType (
src/components/types/input-type.tsx)Simplification
Removed the
modelVariantslookup fromInputTypeandGraphQLTypeExpressionsince the mutation engine now handles all input/output type naming. Components usetype.namedirectly.Test plan
error