addUsedInputObjectsAndEnums method

void addUsedInputObjectsAndEnums(
  1. InputObjectTypeDefinitionNode node
)

Implementation

void addUsedInputObjectsAndEnums(InputObjectTypeDefinitionNode node) {
  if (context.usedInputObjects.contains(ClassName(name: node.name.value))) {
    return;
  }
  context.usedInputObjects.add(ClassName(name: node.name.value));

  for (final field in node.fields) {
    final type =
        gql.getTypeByName(context.typeDefinitionNodeVisitor, field.type);

    if (type is InputObjectTypeDefinitionNode) {
      addUsedInputObjectsAndEnums(type);
    } else if (type is EnumTypeDefinitionNode) {
      context.usedEnums.add(EnumName(name: type.name.value));
    }
  }
}