diff --git a/lib/resolution/resolver.js b/lib/resolution/resolver.js index 23322e4..4afb2d9 100644 --- a/lib/resolution/resolver.js +++ b/lib/resolution/resolver.js @@ -452,7 +452,7 @@ class Resolver { isArray: false, isNotNull: element?.isRefNotNull !== undefined ? element?.isRefNotNull - : element?.key || element?.notNull || cardinality > 1, + : element?.key || element?.notNull || element?.['@mandatory'] || cardinality > 1, } if (element?.type === undefined) { diff --git a/lib/visitor.js b/lib/visitor.js index 3507e6a..47a3b58 100644 --- a/lib/visitor.js +++ b/lib/visitor.js @@ -243,7 +243,7 @@ class Visitor { LOG.error(`Attempting to generate a foreign key reference called '${foreignKey}' in type definition for entity ${fq}. But a property of that name is already defined explicitly. Consider renaming that property.`) } else { const kelement = Object.assign(Object.create(originalKeyElement), { - isRefNotNull: !!element.notNull || !!element.key + isRefNotNull: !!element.notNull || !!element['@mandatory'] || !!element.key }) this.visitElement(foreignKey, kelement, file, buffer) }