Skip to content

ZModel Schema Validation: Missing Datasource Should Be Rejected #102

@ymc9

Description

@ymc9

Current Problem:

  • ✅ Multiple datasources are correctly rejected
  • ❌ Missing datasource is incorrectly allowed (should fail)

Root Cause: The validation in /packages/language/src/validators/schema-validator.ts only checks for multiple datasources but doesn't validate the presence of
at least one datasource.

Proposed Solution:
if (dataSources.length === 0) {
accept('error', 'A datasource declaration is required', { node: model });
} else if (dataSources.length > 1) {
accept('error', 'Multiple datasource declarations are not allowed', { node: dataSources[1]! });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions