Check reference in validator#539
Conversation
| if required and not from_field.get("reference"): | ||
| return f"Relational collectionfield {from_collectionfield} must have 'reference' attribute." | ||
|
|
||
| return None |
There was a problem hiding this comment.
What if both sides are required?
There was a problem hiding this comment.
Result is the same: the fields are being generated in both tables instead of table + view. required in this case changes only whether the NOT NULL constraint exists.
Similar for the other field combinations.
There was a problem hiding this comment.
But in this case required refers not to the field attribute but to whether the reference attribute is required for this side of the relation. If it is required but not set, the error will be added to self.errors.
There was a problem hiding this comment.
ah, then the variable should probably get a more verbose name.
|
Working notes: Correct schema is produced
Implemented in schema generator, but generate invalid schemaThese relations are implemented in schema generator (before this PR), but the produced schema is not correct. Should become not allowed in both collections validator and schema generator. Field generated in both tables instead of table-view:
2 nm-tables get generated:
Not implemented in schema generatorNo fields get generated, error is added to the end of the generated schema file. Should also make validator scream.
|
luisa-beerboom
left a comment
There was a problem hiding this comment.
I have one minor thing, then it's good
| if required and not from_field.get("reference"): | ||
| return f"Relational collectionfield {from_collectionfield} must have 'reference' attribute." | ||
|
|
||
| return None |
There was a problem hiding this comment.
ah, then the variable should probably get a more verbose name.
Resolves #415 and makes validator fail when
referenceattribute (or it absence) can cause inconsistencies in schema.Allowed combinations that result in correct schema: