Simple Domain Modeling Language
Language Error Codes
Table of Contents
- 1. Bugs
- 2. Errors
- 2.1. E0100: Module Not Found
- 2.2. E0101: Imported Module Not Found
- 2.3. E0102: Module Version Not Found
- 2.4. E0103: Module Version Mismatch
- 2.5. E0104: Duplicate Definition Name
- 2.6. E0105: Duplicate Member Name
- 2.7. E0106: Duplicate Variant Name
- 2.8. E0107: Invalid Identifier
- 2.9. E0108: Invalid Language Tag
- 2.10. E0109: Invalid Value For Type
- 2.11. E0110: Invalid Module Base Url
- 2.12. E0112: Invalid Module Version Url
- 2.13. E0113: Definition Not Found
- 2.14. E0114: Type Definition Not Found
- 2.15. E0115: Datatype Invalid Base
- 2.16. E0116: Type Class Incompatible
- 2.17. E0117: Property Incompatible
- 2.18. E0118: RDF Definition Incompatible
- 2.19. E0119: Feature Set Not a Union
- 2.20. E0120: Property Reference Not a Property
- 3. Warnings
- 4. Informational
This page provides a reference to the errors, warnings, and informational messages defined in the sdml_error
crate and
output by the sdml
command-line tool.
1. Bugs
This category represents bugs in the command-line tool where it’s parser receives unexpected nodes from the underlying tree-sitter parser.
1.1. B0001: Tree-Sitter Error Node
If the tree-sitter parser itself cannot parse some content it inserts an error
node in the tree. When the SDML parser
encounters such a node it is clearly a defect in the underlying source, but we don’t yet know what.
The Diagnostic
for this error will attempt to record the file ID, location, and the name of any rule the parser was
processing when the error node was found.
1.1.1. Example
module example <https://example.com/api> version "" is ; missing the version URI, error here ----------^ end
bug[B0001]: tree-sitter parse error encountered ┌─ examples/errors/b0002.sdm:1:1 │ 1 │ ╭ module example <https://example.com/api> version "" is 2 │ │ ; missing the version URI, error here ----------^ 3 │ │ end 4 │ │ │ ╰^ here │ = in grammar rule: `module` = help: encountered a tree-sitter ERROR node in the parse tree = help: for more details, see <https://sdml.io/errors/#B0002> bug: parser generated 1 bugs.
1.2. B0002: Tree-Sitter Unexpected Node
The Diagnostic
for this error will attempt to record the file ID, location, and the name of any expected nodes along
with the name of the node found.
1.2.1. Example
1.3. B0003: Tree-Sitter Missing Node
The Diagnostic
for this error will attempt to record the file ID, location, and the name of any expected nodes along
with the name of any variable that might have contained the expected node.
1.3.1. Example
1.4. B0004: Tree-Sitter Missing Variable
The Diagnostic
for this error will attempt to record the file ID, location, and the name of the expected variable along
with the name of the node kind that should have contained the expected variable.
1.4.1. Example
2. Errors
This category represents errors in module loading, in parsing a complete tree-sitter tree, or in module validation.
2.1. E0100: Module Not Found
An attempt to load a module failed, specifically a module that was loaded directly, not from another module’s import statements.
2.1.1. Example
$ sdml validate orl error[E0101]: module not found = module name `orl` = for more details, see <https://sdml.io/errors/#E0101>
2.2. E0101: Imported Module Not Found
An attempt to load a module listed in another module’s import statement failed.
2.2.1. Example
module example <https://example.com/api> is import other end
error[E0101]: module named in import statement not found ┌─ examples/errors/e0101.sdm:3:10 │ 3 │ import other │ ^^^^^ this import │ = help: for more details, see <https://sdml.io/errors/#E0101> error: parser generated 1 errors.
2.3. E0102: Module Version Not Found
A client module has asked to import a provider module at a specific version. However, the resolver found the provider module but it does not contain a version URI.
2.3.1. Example
module example <https://example.com/api> is import nonversioned_other <https://example.com/api/v2> end
module nonversioned_other <https://example.com/api> is end
error[E0102]: imported module has no version URI ┌─ examples/errors/e0102.sdm:3:10 │ 3 │ import nonversioned_other <https://example.com/api/v2> │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this import │ ┌─ ./examples/errors/nonversioned_other.sdm:1:1 │ 1 │ ╭ module nonversioned_other <https://example.com/api> is 2 │ │ end 3 │ │ │ ╰' this module │ = help: for more details, see <https://sdml.io/errors/#E0102> error: module `example` generated 1 errors.
2.4. E0103: Module Version Mismatch
A client module has asked to import a provider module at a specific version. However, the resolver found the provider module but it’s version URI does not match the client’s expected value.
2.4.1. Example
module example <https://example.com/api> is import versioned_other <https://example.com/api/v3> end
module versioned_other <https://example.com/api> version "v2" <https://example.com/api/v2> is end
error[E0103]: actual module URI does not match import requirement ┌─ examples/errors/e0103.sdm:3:26 │ 3 │ import versioned_other <https://example.com/api/v3> │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected this version URI │ ┌─ ./examples/errors/versioned_other.sdm:2:21 │ 2 │ version "v2" <https://example.com/api/v2> is │ ---------------------------- module contained this version URI │ = help: for more details, see <https://sdml.io/errors/#E0103> error: module `example` generated 1 errors.
2.5. E0104: Duplicate Definition Name
A module contains multiple definitions with the same name. A module is a namespace meaning that all definitions within it must have unique names (identifiers).
2.5.1. Example
module example <https://example.com/api> is structure Foo structure Bar structure Foo end
error[E0104]: a definition with this name already exists in this module ┌─ examples/errors/e0104.sdm:3:13 │ 3 │ structure Foo │ ^^^ this definition name · 7 │ structure Foo │ --- was previously defined here │ = help: for more details, see <https://sdml.io/errors/#E0104> error: module `example` generated 1 errors.
2.6. E0105: Duplicate Member Name
An entity, event, or structure definition contains multiple members with the same name. A definition is a namespace meaning that all members within it must have unique names (identifiers).
2.6.1. Example
module example <https://example.com/api> is structure Foo is foo -> string bar -> integer foo -> boolean end end
error[E0105]: a member with this name already exists in this definition ┌─ examples/errors/e0105.sdm:6:5 │ 4 │ foo -> string │ --- was previously defined here 5 │ bar -> integer 6 │ foo -> boolean │ ^^^ this member name │ = help: for more details, see <https://sdml.io/errors/#E0105> error: module `example` generated 1 errors.
2.7. E0106: Duplicate Variant Name
An enum or union definition contains multiple variants with the same name. A definition is a namespace meaning that all variants within it must have unique names (identifiers).
2.7.1. Example Value Variant
module example <https://example.com/api> is enum EnumFoo of Foo Bar Foo end end
error[E0106]: a variant with this name already exists in this definition ┌─ examples/errors/e0106-enum.sdm:6:5 │ 4 │ Foo │ --- was previously defined here 5 │ Bar 6 │ Foo │ ^^^ this variant name │ = help: for more details, see <https://sdml.io/errors/#E0106> error: module `example` generated 1 errors.
2.7.2. Example Type Variant
module example <https://example.com/api> is union UnionFoo of Foo Bar Foo end end
error[E0106]: a variant with this name already exists in this definition ┌─ examples/errors/e0106-union.sdm:6:5 │ 4 │ Foo │ --- was previously defined here 5 │ Bar 6 │ Foo │ ^^^ this variant name │ = help: for more details, see <https://sdml.io/errors/#E0106> error: module `example` generated 1 errors.
2.7.3. Example Type Variant Rename
module example <https://example.com/api> is union UnionFoo of Foo Bar Boo as Foo end end
error[E0106]: a variant with this name already exists in this definition ┌─ examples/errors/e0106-rename.sdm:6:12 │ 4 │ Foo │ --- was previously defined here 5 │ Bar 6 │ Boo as Foo │ ^^^ this variant name │ = help: for more details, see <https://sdml.io/errors/#E0106> error: module `example` generated 1 errors.
2.8. E0107: Invalid Identifier
API only.
2.8.1. Example
2.9. E0108: Invalid Language Tag
API only.
2.9.1. Example
2.10. E0109: Invalid Value For Type
TBD
2.10.1. Example
2.11. E0110: Invalid Module Base Url
API only.
2.11.1. Example
2.12. E0112: Invalid Module Version Url
API only.
2.12.1. Example
2.13. E0113: Definition Not Found
TBD
2.13.1. Example
module example <https://example.com/api> is import [ skos:Unknown ] end
error[E0113]: definition not found in module ┌─ examples/errors/e0113.sdm:3:12 │ 3 │ import [ skos:Unknown ] │ ^^^^^^^^^^^^ this reference │ = help: for more details, see <https://sdml.io/errors/#E0113> error: module `example` generated 1 errors
2.14. E0114: Type Definition Not Found
A type name, qualified or unqualified, cannot be resolved to a type definition.
2.14.1. Example
error[E0114]: type definition not found in module ┌─ examples/errors/e0114.sdm:4:13 │ 4 │ name -> Bar │ ^^^ this reference │ = help: did you forget to add an import for this type, or qualify it's name = help: for more details, see <https://sdml.io/errors/#E0114> error: module `example` generated 1 errors
2.15. E0115: Datatype Invalid Base
The base type for a datatype definition must itself be a datatype definition.
2.15.1. Example
module example <https://example.com/api> is structure Foo datatype bar <- Foo end
error[E0115]: invalid type for datatype base, not a datatype ┌─ examples/errors/e0115.sdm:5:19 │ 5 │ datatype bar <- Foo │ ^^^ this reference │ = help: A type reference in this position must refer to a datatype definition = help: for more details, see <https://sdml.io/errors/#E0115>
2.16. E0116: Type Class Incompatible
TBD
2.17. E0117: Property Incompatible
TBD
2.17.1. Example
error[E0117]: a property definition is not compatible in this location ┌─ examples/errors/e0117.sdm:6:13 │ 6 │ name -> Foo │ ^^^ this usage │ = help: for more details, see <https://sdml.io/errors/#E0117> error: module `example` generated 1 errors
2.18. E0118: RDF Definition Incompatible
TBD
2.18.1. Example
module example <https://example.com/api> is import rdf rdf Foo is @rdf:type = rdf:Resource end structure Bar is name -> Foo end end
error[E0118]: an RDF definition is not compatible in this location ┌─ examples/errors/e0118.sdm:10:13 │ 10 │ name -> Foo │ ^^^ this usage │ = help: for more details, see <https://sdml.io/errors/#E0118> error: module `example` generated 1 errors
2.19. E0119: Feature Set Not a Union
When defining a member as a feature extension point, the name after the keyword features
must be a union definition.
2.19.1. Example
module example <https://example.com/api> is structure Foo structure Bar is name -> features Foo end end
error[E0119]: invalid type for feature set, not a union ┌─ examples/errors/e0119.sdm:6:22 │ 6 │ name -> features Foo │ ^^^ this reference │ = help: A type reference in this position must refer to a union definition = help: for more details, see <https://sdml.io/errors/#E0119>
2.20. E0120: Property Reference Not a Property
When defining a member using a property role, the name after the keyword in
must be a property definition.
2.20.1. Example
module example <https://example.com/api> is structure Foo structure Bar is name in Foo end end
error[E0120]: member references a non-property as a property ┌─ examples/errors/e0120.sdm:6:13 │ 6 │ name in Foo │ ^^^ this reference │ = help: A type reference in this position must refer to a property definition = help: for more details, see <https://sdml.io/errors/#E0120>
3. Warnings
3.1. W0301: Module Already Imported
An import statement includes a module already imported. This is a warning because the loader will not attempt to re-parse the same module, but it’s more than just bad style.
3.1.1. Example
module example <https://example.com/api> is import owl import [ dc xsd owl owl ] end
warning[W0301]: duplicate import of module ┌─ examples/errors/W0301.sdm:5:19 │ 3 │ import owl │ --- was previously imported here 4 │ 5 │ import [ dc xsd owl owl ] │ ^^^ this module │ = for more details, see <https://sdml.io/errors/#W0301> warning[W0301]: duplicate import of module ┌─ examples/errors/W0301.sdm:5:23 │ 3 │ import owl │ --- was previously imported here 4 │ 5 │ import [ dc xsd owl owl ] │ ^^^ this module │ = for more details, see <https://sdml.io/errors/#W0301> warning: module `example` generated 2 warnings.
3.2. W0302: Member Already Imported
An import statement includes a member already imported. This is a warning because the loader will not attempt to re-parse the same module to access the same member, but it’s more than just bad style.
3.2.1. Example
module example <https://example.com/api> is import owl:Class import [ dc xsd owl:Class ] end
warning[W0302]: duplicate import of member ┌─ examples/errors/W0302.sdm:5:19 │ 3 │ import owl:Class │ --------- was previously imported here 4 │ 5 │ import [ dc xsd owl:Class ] │ ^^^^^^^^^ this member │ = for more details, see <https://sdml.io/errors/#W0302> warning: module `example` generated 1 warnings.
3.3. W0303: Validation Incomplete
TBD
3.3.1. Example
3.4. W0304: Module Version Info Empty
The version information string in the module header is empty. This is suspicious as it’s not clear what ""
means as a
version identifier.
3.4.1. Example
module example <https://example.com/api> version "" <https://example.com/api/v2> is end
warning[W0304]: module's version info string is empty ┌─ examples/errors/w0304.sdm:1:50 │ 1 │ module example <https://example.com/api> version "" <https://example.com/api/v2> is │ ^^ this value │ = help: for more details, see <https://sdml.io/errors/#W0304> warning: module `example` generated 1 warnings.
3.5. W0305: Deprecated Term Used
The core validation allows for the use of term sets which denote terms that should not be used, and indicates alternatives that should be used instead.
3.5.1. Example
module example <https://example.com/api> is structure AccessRecord is black_list -> {0..} string white_list -> {0..} string end end
warning[W0305]: found a deprecated term, consider an alternative ┌─ examples/errors/w0305.sdm:4:5 │ 4 │ black_list -> {0..} string │ ^^^^^^^^^^ here │ = help: consider one of: Block list, Blocked, Deny list, Denied, Exclusion list, Excluded, Unsafe list, Unapproved = help: Applies a negative connotation to things that are black and a positive connotation to those that are white. = help: for more details, see <https://sdml.io/errors/#W0305> warning[W0305]: found a deprecated term, consider an alternative ┌─ examples/errors/w0305.sdm:5:5 │ 5 │ white_list -> {0..} string │ ^^^^^^^^^^ here │ = help: consider one of: Allow list, Allowed, Deny list, Denied, Inclusion list, Included, Safe list, Approved = help: Applies a negative connotation to things that are black and a positive connotation to those that are white. = help: for more details, see <https://sdml.io/errors/#W0305> warning: module name: `example` generated 2 warnings.
4. Informational
4.1. I0500: Incomplete Module
The module is incomplete as one or more definitions is incomplete.
4.1.1. Example
module example <https://example.com/api> is structure Foo end
note[I0500]: this module is incomplete ┌─ examples/errors/i0500.sdm:1:1 │ 1 │ ╭ module example <https://example.com/api> is 2 │ │ 3 │ │ structure Foo 4 │ │ 5 │ │ end 6 │ │ │ ╰^ this module │ = help: for more details, see <https://sdml.io/errors/#I0500>
4.2. I0501: Incomplete Definition
The definition is incomplete as it has no body, or as one or more members is incomplete.
4.2.1. Example
module example <https://example.com/api> is structure Foo end
note[I0501]: this definition is incomplete ┌─ examples/errors/i0500.sdm:3:3 │ 3 │ structure Foo │ ^^^^^^^^^^^^^ this definition │ = help: for more details, see <https://sdml.io/errors/#I0501>
4.3. I0502: Incomplete Member
The member is incomplete as it’s type is declared to be unknown
.
4.4. I0503: String Without Language
A string literal, usually the value of an attribute property, has no attached language identifier. While this is grammatically correct it is useful to add language tags to allow future translation.
4.4.1. Example
module example <https://example.com/api> is import dc @dc:description = "in unspecified language" end
4.5. I0504: Unconstrained Datatype
A builtin datatype, or an RDF/XSD datatype, was used without any qualification. It is generally better to create new datatypes for members that assert meaningful constraints on the types value-space.
In our example, can a name contain any Unicode codepoint? Can it be of arbitrary length? Can an age be an unbounded integer, which also implies negative values?
4.6. I0505: Double Underscored Identifier
TBD
4.7. I0506: Identifier Not Preferred Case
For readability the following naming conventions are preferred for source code, and this code identifies where identifies do not conform to these conventions.
Model Element | Preferred Case | Example |
---|---|---|
module | snake case | rdf , rdf_schema |
datatype | snake or upper camel case | integer , CustomerId |
rdf definition | snake or upper camel case | type , Class |
type definitions | upper camel case | Class , Customer |
value variants | upper camel or shouty snake case | DebitCard , DEBIT_CARD |
member | snake case | nmame , customer_id |
imported member | snake or upper camel case | integer , CustomerId |
4.7.1. Example
module Example <https://example.com/api> is structure access_record is Name -> string end enum Foo of one two end union Bar of Foo as foo end end
note[I0506]: identifier not using preferred casing ┌─ examples/errors/i0506.sdm:1:8 │ 1 │ module Example <https://example.com/api> is │ ^^^^^^^ this identifier │ = expected snake case (snake_case) = help: for more details, see <https://sdml.io/errors/#I0506> note[I0506]: identifier not using preferred casing ┌─ examples/errors/i0506.sdm:3:13 │ 3 │ structure access_record is │ ^^^^^^^^^^^^^ this identifier │ = expected upper camel case (UpperCamelCase) = help: for more details, see <https://sdml.io/errors/#I0506> note[I0506]: identifier not using preferred casing ┌─ examples/errors/i0506.sdm:4:5 │ 4 │ Name -> string │ ^^^^ this identifier │ = expected snake case (snake_case) = help: for more details, see <https://sdml.io/errors/#I0506> note[I0506]: identifier not using preferred casing ┌─ examples/errors/i0506.sdm:8:5 │ 8 │ one │ ^^^ this identifier │ = expected upper camel (UpperCamelCase) or shouty snake case (SHOUTY_SNAKE_CASE) = help: for more details, see <https://sdml.io/errors/#I0506> note[I0506]: identifier not using preferred casing ┌─ examples/errors/i0506.sdm:9:5 │ 9 │ two │ ^^^ this identifier │ = expected upper camel (UpperCamelCase) or shouty snake case (SHOUTY_SNAKE_CASE) = help: for more details, see <https://sdml.io/errors/#I0506> note[I0506]: identifier not using preferred casing ┌─ examples/errors/i0506.sdm:13:12 │ 13 │ Foo as foo │ ^^^ this identifier │ = expected upper camel case (UpperCamelCase) = help: for more details, see <https://sdml.io/errors/#I0506> note: module `Example` generated 6 informational