Skip to content

Handle sh:maxCount 0 in form fields #205

@dennisvang

Description

@dennisvang

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:

Image

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():

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementImprovement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions