File tree 1 file changed +41
-1
lines changed
1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -262,12 +262,18 @@ impl CodeGenCtx {
262
262
ident. sym. as_ref( )
263
263
) ) ;
264
264
}
265
- None | Some ( _) => (
265
+ Some ( _) => (
266
266
Type_ :: NamedType {
267
267
name : ident. sym . to_string ( ) ,
268
268
} ,
269
269
None ,
270
270
) ,
271
+ None => {
272
+ return Err ( anyhow:: anyhow!(
273
+ "Undefined type: {}" ,
274
+ ident. sym. as_ref( )
275
+ ) )
276
+ }
271
277
}
272
278
} else {
273
279
match type_params {
@@ -1161,6 +1167,40 @@ mod tests {
1161
1167
( "Query" , GraphQLKind :: Object ) ,
1162
1168
] ,
1163
1169
) ;
1170
+
1171
+ // let src = "
1172
+ // type User = { id: string; name: string; karma: number; }
1173
+ // type GetUserInput = { id?: string; name?: string; karma?: number; }
1174
+ // type Foo = { id: string; name: string; karma: number; }
1175
+ // type Query = { getUser: (input: { user?: GetUserInput; karma?: number;}) => Promise<{ id: string; name: string; karma: number;}[] | null>; }
1176
+ // type Mutation = {
1177
+ // createUser: (input: { name?: string; karma?: number;}) => Promise<{ name: string;}>;
1178
+ // updateUser: (input: { user: { id?: string; name?: string; };}) => Promise<{ id: string; name: string; karma: number;} | null>;
1179
+ // }
1180
+ // ";
1181
+ // test(
1182
+ // src,
1183
+ // indoc! { r#"
1184
+ // type User {
1185
+ // id: String!
1186
+ // name: String!
1187
+ // karma: Int!
1188
+ // }
1189
+ // type FindUserOutput {
1190
+ // user: User!
1191
+ // success: Boolean!
1192
+ // }
1193
+ // type Query {
1194
+ // findUser(id: String!): FindUserOutput
1195
+ // }
1196
+ // "# },
1197
+ // vec![
1198
+ // ("User", GraphQLKind::Object),
1199
+ // ("GetUserInput", GraphQLKind::Input),
1200
+ // ("Query", GraphQLKind::Object),
1201
+ // ("Mutation", GraphQLKind::Object),
1202
+ // ],
1203
+ // );
1164
1204
}
1165
1205
}
1166
1206
}
You can’t perform that action at this time.
0 commit comments