Skip to content

Commit a14329e

Browse files
fix: Removes empty definition checks
Extensions mean that definitions may initially be empty and extended later.
1 parent a8bca06 commit a14329e

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

Sources/GraphQL/Type/Definition.swift

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -440,24 +440,6 @@ func defineInterfaces(
440440
hasTypeOf: Bool,
441441
interfaces: [GraphQLInterfaceType]
442442
) throws -> [GraphQLInterfaceType] {
443-
guard !interfaces.isEmpty else {
444-
return []
445-
}
446-
447-
if !hasTypeOf {
448-
for interface in interfaces {
449-
guard interface.resolveType != nil else {
450-
throw GraphQLError(
451-
message:
452-
"Interface Type \(interface.name) does not provide a \"resolveType\" " +
453-
"function and implementing Type \(name) does not provide a " +
454-
"\"isTypeOf\" function. There is no way to resolve this implementing " +
455-
"type during execution."
456-
)
457-
}
458-
}
459-
}
460-
461443
return interfaces
462444
}
463445

@@ -1200,12 +1182,6 @@ func defineEnumValues(
12001182
name: String,
12011183
valueMap: GraphQLEnumValueMap
12021184
) throws -> [GraphQLEnumValueDefinition] {
1203-
guard !valueMap.isEmpty else {
1204-
throw GraphQLError(
1205-
message: "\(name) values must be an object with value names as keys."
1206-
)
1207-
}
1208-
12091185
var definitions: [GraphQLEnumValueDefinition] = []
12101186

12111187
for (valueName, value) in valueMap {
@@ -1405,14 +1381,6 @@ func defineInputObjectFieldMap(
14051381
name: String,
14061382
fields: InputObjectFieldMap
14071383
) throws -> InputObjectFieldDefinitionMap {
1408-
guard !fields.isEmpty else {
1409-
throw GraphQLError(
1410-
message:
1411-
"\(name) fields must be an object with field names as " +
1412-
"keys or a function which returns such an object."
1413-
)
1414-
}
1415-
14161384
var definitionMap = InputObjectFieldDefinitionMap()
14171385

14181386
for (name, field) in fields {

0 commit comments

Comments
 (0)