ReferenceRust API
RSL diagnostics
Every schema error includes its file, line, column, and a stable RSL code. Run rent validate for semantic
validation or rent validate --syntax-only while repairing incomplete syntax.
Syntax
| Code | Meaning | Fix |
|---|---|---|
RSL000 | Source text could not be mapped to a valid UTF-8 span. | Save the schema as UTF-8 and retry. |
RSL001 | The lexer reached an unexpected character. | Remove the character or place the value in a quoted string. |
RSL002 | A string, escape, or block comment is incomplete. | Close it and check escapes near the reported location. |
RSL003 | The top-level declaration is unknown. | Use datasource, generator, model, view, enum, type, or extension. |
RSL004 | The parser expected another token or expression. | Check delimiters, attribute arguments, and the preceding line. |
Schema meaning
| Code | Meaning | Fix |
|---|---|---|
RSL200 | The normalized schema violates a cross-model invariant. | Read the attached invariant message; it names the entity, field, relationship, or index. |
RSL201 | A view has no SQL definition. | Add @@rent.sql("..."). |
RSL202 | @rent.version uses an incompatible field type. | Use required UInt or BigInt. |
RSL203 | A field type is unknown. | Use a built-in, enum, composite type, or an explicitly mapped unsupported database type. |
RSL204 | A default value, function argument, or automatic timestamp declaration is invalid. | Match the field type; use uuid()/uuid(4)/uuid(7), now(), autoincrement(), or dbgenerated("SQL"). Use @updatedAt on a mutable timestamp field. |
RSL205 | Relationship fields and references have different lengths. | Supply one referenced field for every local foreign-key field. |
RSL206 | An inverse relationship has no matching forward relationship. | Add the matching relationship on the target model and use the same relationship name when needed. |
RSL207 | An index declaration is malformed. | Provide a valid field list and valid field options. |
RSL208 | An attribute argument that must list field names is not an array of field names. | Write the argument as [field, other_field]. |
RSL209 | A required attribute argument is missing. | Add the argument named in the diagnostic, such as name on @@rent.check, @@rent.trigger, @@rent.policy, or @rent.through, field on @rent.order, or table on @rent.join. |
RSL210 | Primary-key metadata is invalid. | Use one required field-level @id, or one @@id([...]) containing required fields. |
RSL211 | Join-table storage metadata is invalid. | Supply the required table, two columns, and at most two constraint names. |
RSL212 | A declaration name is duplicated. | Rename or remove one model, view, enum, or composite type. |
RSL213 | A field or enum value is duplicated. | Keep each name unique inside its declaration. |
RSL214 | A singleton or named configuration block is duplicated. | Keep one datasource and unique generator and extension names. |
RSL215 | An attribute is unknown for that declaration. | Correct the spelling or move the attribute to a supported owner. |
RSL216 | A non-repeatable attribute appears more than once. | Keep one copy; indexes, unique constraints, policies, checks, and triggers remain repeatable where appropriate. |
RSL217 | An attribute argument is unknown. | Correct the argument name or remove it. |
RSL218 | A named attribute argument is duplicated. | Keep one value for that argument. |
RSL219 | A configuration property is unknown. | Correct the property name or remove it. |
RSL220 | A configuration property is duplicated. | Keep one value for that property. |
RSL221 | A required configuration property is missing. | Add provider to datasource and generator blocks, or name to an extension block. |
RSL222 | A relationship cannot infer a compound identity safely. | Declare explicit fields and references; use an explicit join model for compound many-to-many data. |
RSL223 | An enum default uses an unknown variant or the wrong value shape. | Use an unquoted declared variant, or an array of variants for a list; do not use the mapped database strings. |
RSL224 | An enum has no variants or ambiguous stored values. | Declare at least one variant and give each variant a distinct, nonempty database value. |
RSL225 | A storage mapping has an invalid argument. | Give @map or @@map exactly one nonempty quoted string. |
RSL226 | A JSON default contains invalid JSON. | Put a valid JSON document inside the quoted default string. |
RSL227 | A typed list default has the wrong shape, element type, or numeric range. | Use an array of values matching the declared type; timestamps need an offset, UUIDs must parse, and bytes must be between 0 and 255. |
RSL228 | A native extension field is declared outside a PostgreSQL datasource, as a list, or as a primary key. | Use a PostgreSQL datasource and declare the field as a scalar that is not the primary key. |
RSL229 | @@rent.native has arguments, or an enum uses @@map or @@schema without @@rent.native. | Declare @@rent.native with no arguments and name the SQL type with @@map and @@schema. |
RSL230 | An attribute cannot apply to a JSON value object. | Use literal defaults and mapped names on JSON members; put database constraints and callbacks on model fields. |
Example
rent/schema.rsl:8:16 [RSL217] unknown `reference` argument for `@relation`The location points at the invalid argument. In this case, rename reference to references, then run:
rent validate
rent format --check
rent generate