Skip to content

Commit 9de781d

Browse files
committed
Simplify comments and tests in type components
- 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)
1 parent d77053c commit 9de781d

3 files changed

Lines changed: 1 addition & 33 deletions

File tree

packages/graphql/src/components/types/input-type.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ export interface InputTypeProps {
99
}
1010

1111
/**
12-
* Renders a GraphQL input type declaration
13-
*
14-
* The mutation engine handles naming: input models are already suffixed
15-
* with "Input" when they need to be distinguished from output types.
12+
* Renders a GraphQL input type declaration.
1613
*/
1714
export function InputType(props: InputTypeProps) {
1815
const { $ } = useTsp();

packages/graphql/src/components/types/object-type.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ export function ObjectType(props: ObjectTypeProps) {
2525
const implementations = getComposition(program, props.type);
2626
const operationFields = getOperationFields(program, props.type);
2727

28-
// Convert interface implementations to string references.
29-
// Note: getComposition returns original (pre-mutation) models from decorator state.
30-
// This works because the mutation engine doesn't rename models, so iface.name
31-
// matches the name used by InterfaceType for the same model.
3228
const implementsRefs = implementations?.map((iface) => iface.name) || [];
3329

3430
return (

packages/graphql/test/components/input-type.test.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,6 @@ describe("InputType component", () => {
4949
expect(sdl).toContain("bio: String!");
5050
});
5151

52-
it("renders mutated input model with Input suffix from mutation engine", async () => {
53-
// The mutation engine adds the Input suffix when a model is used as input.
54-
// This test simulates that by using a model already named with Input suffix.
55-
const { PetInput } = await tester.compile(
56-
t.code`model ${t.model("PetInput")} { name: string; }`,
57-
);
58-
59-
const sdl = renderComponentToSDL(tester.program, <InputType type={PetInput} />);
60-
61-
expect(sdl).toContain("input PetInput {");
62-
});
63-
64-
it("renders input-only model without suffix", async () => {
65-
// Models used only as inputs (never as outputs) don't need the Input suffix.
66-
// The mutation engine handles this - it only adds suffix when needed.
67-
const { CreatePet } = await tester.compile(
68-
t.code`model ${t.model("CreatePet")} { name: string; }`,
69-
);
70-
71-
const sdl = renderComponentToSDL(tester.program, <InputType type={CreatePet} />);
72-
73-
expect(sdl).toContain("input CreatePet {");
74-
expect(sdl).not.toContain("CreatePetInput");
75-
});
76-
7752
it("renders array fields as list types", async () => {
7853
const { TagInput } = await tester.compile(
7954
t.code`model ${t.model("TagInput")} { values: string[]; }`,

0 commit comments

Comments
 (0)