validateSchema method

void validateSchema()

Validates the schema for consistency and completeness

Implementation

void validateSchema() {
  // Basic schema validation - check if schema has any non-default type definitions
  final nonDefaultTypes = typeVisitor.types.values.where((type) {
    // Filter out default scalar types
    final defaultScalars = {'Boolean', 'Float', 'ID', 'Int', 'String'};
    return !defaultScalars.contains(type.name.value);
  });

  if (nonDefaultTypes.isEmpty) {
    throw Exception('Schema is empty or contains no type definitions');
  }

  // Validate that all referenced types exist
  nonDefaultTypes.forEach(_validateTypeReferences);
}