Skip to content

Investigate indexing while validating non-recurring elements #369

@Kasdejong

Description

@Kasdejong

We seem to validate nearly everything as if they were groups. Most of our "validateInternal" functions which take a single IScopedNode will instead call the one meant for IEnumerable instead by collecting the single node into an array of 1. This bothers me for multiple reasons.

  1. We do not know if we are validating a potential recurring element. If the enumerable size is 1, we cannot defer any cardinality assumptions from that, since it could be a recurring element with only 1 item.
  2. We add indices to the instance path, even when an element is not recurring. This does not make sense to me.
  3. We create a lot of enumerables of length 1, almost for every element! This seems like a waste of resources.

As an example, I was working on the resource schema when I realised all resources are validated as groups of resources. There is 1 (ONE) case where a field of type resource is recurring, which is "contained". The fact that we group validate single resources led to bugs like #368. We should investigate if we can have a clearer boundary between what is validated as a group and what is validated as a standalone element

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions