Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic Validation Rules #819

Open
dselman opened this issue Mar 15, 2024 · 0 comments
Open

Semantic Validation Rules #819

dselman opened this issue Mar 15, 2024 · 0 comments

Comments

@dselman
Copy link
Sponsor Contributor

dselman commented Mar 15, 2024

Feature Request 🛍️

Document the semantic validation rules for the Concerto AST.

Use Case

Allows alternate implementation of semantic validation to be developed, perhaps outside of core.

Rules (from v4)

  • CLASS_DECLARATION_001: No property name should be a system property: ModelUtil.isSystemProperty(thing.name)
  • CLASS_DECLARATION_002: Property $class should be a property type from the metamodel
  • CLASS_DECLARATION_003: Name of declaration should not be duplicated within the same model file
  • CLASS_DECLARATION_004: If declaration has a super type it must exist
  • CLASS_DECLARATION_005: If declaration has an identifying field it must have a corresponding String or String scalar property
  • CLASS_DECLARATION_006: Identifying fields cannot be optional
  • CLASS_DECLARATION_007: If system identified then the super type must also be system identified
  • CLASS_DECLARATION_008: Check that property does not already exist in super types
  • DECLARATION_001: Check name are unique within model file
  • DECLARATION_002: Check declared name is not also an imported type
  • DECORATED_001: Check decorator is not applied more than once
  • MAP_DECLARATION_001: Must contain key and value properties // doesn't sound like semantic validation!
  • MAP_KEY_TYPE_001: Key type must be a String or DateTime, or a scalar thereof
  • MAP_VALUE_TYPE_001: Value type must exist
  • MODEL_ELEMENT_001: Must have a $class attribute that is in the metamodel namespace
  • MODEL_ELEMENT_002: name must be a valid identifier ModelUtil.isValidIdentifier(this.ast.name)
  • MODEL_FILE_001: All imports must reference types that exist
  • MODEL_FILE_002: Cannot import two versions of the same namespace
  • NUMBER_VALIDATOR_001: Cannot have no upper bound and no lower bound
  • NUMBER_VALIDATOR_002: Lower bound must not be greater than upper bound
  • PROPERTY_001: Property must have a name // not semantic validation?
  • PROPERTY_002: The type of a non-primitive property must exist
  • PROPERTY_003: Property meta type must exist in the metamodel // new!
  • RELATIONSHIP_001: Relationships cannot be to primitive types
  • RELATIONSHIP_002: Relationship type must exist
  • RELATIONSHIP_003: Relationship must be to an identified type
  • STRING_VALIDATOR_001: Cannot have no upper and no lower bound
  • STRING_VALIDATOR_002: Upper and lower bound must be positive integers
  • STRING_VALIDATOR_003: Lower bound cannot be greater than upper bound
  • STRING_VALIDATOR_004: If regex defined it must be valid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant