-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Description
Currently, fields with sh:maxCount 0 are rendered as "list" in the form.
For example, if we set sh:maxCount 0 in the default Catalog schema, the client (in this case v2.0.0-alpha.1) renders the following form:
Expected behavior
Definition of sh:maxCount from the SHACL spec:
If the number of value nodes is greater than
$maxCount, there is a validation result.
This would imply that, for sh:maxCount 0, no value nodes are allowed at all.
Usage examples are found in the shacl-shacl shapes graph in the spec (in combination with sh:or). Also see e.g. validatingrdf.
Notes
Here's how the SHACL form renderer handles maxCount 0, based on isList():
FAIRDataPoint-client/src/components/ShaclForm/fieldUtils.ts
Lines 24 to 26 in d6eacb9
| function isList(field: FormField): boolean { | |
| return field.maxCount !== 1 | |
| } |
and in getShaclValue() we find:
| if (fieldConfig.maxCount === 1) { |
Note that Field.maxCount (or FormField.maxCount) can be null:
| maxCount: number | null |
