fix test schema generation for virtual required relation fields
@@ -163,6 +163,8 @@ trait SchemaBaseV11 extends PlayJsonExtensions {
}
def schemaWithRelation(onParent: RelationField, onChild: RelationField, withoutParams: Boolean = false) = {
+ val isRequiredOneToOne = onParent.isRequired && onChild.isRequired
+ require(!isRequiredOneToOne, "required 1:1 relations must be rejected by the parser already")
//Query Params
val idParams = QueryParams(
selection = "id",
@@ -228,8 +230,9 @@ trait SchemaBaseV11 extends PlayJsonExtensions {
childReferenceToParent <- childReferences(simple, parentId, onParent, onChild);
parentReferenceToChild <- parentReferences(simple, childId, childReferenceToParent, onParent, onChild);
- // skip required virtual relation fields as those are not allowed
- if onParent.isRequired && parentReferenceToChild != noRef;
+ // skip required virtual relation fields as those are disallowed in a Prisma Schema
+ isVirtualRequiredRelationField = onParent.isRequired && parentReferenceToChild == noRef
+ if !isVirtualRequiredRelationField;
// Only based on id
parentParams <- if (withoutParams) {
