Skip to content

Handling schema fields with cardinality 0..0 #260

@camemre49

Description

@camemre49

Fields with a cardinality of 0..0 are currently allowed to be added to the schema, but they are ignored when converting from StructureDefinition to SimpleStructureDefinition. As a result, these fields are not included in the schema sent to the UI and are deleted from the file when the schema is saved again. This prevents such fields from being persistent, even though they may hold descriptive value for the user's data (e.g., in systems like RedCap).

Relevant code snippet from SimpleStructureDefinitionService:

if(createdElementDefinition.maxCardinality.contains(0)) {
  Option.empty[SimpleStructureDefinition] // Do not put an element into our result if it is removed (max-cardinality = 0) in the profile definitions.
}

In addition, when a schema is initially saved with a cardinality other than 0..0, attempting to update its cardinality to 0..0 later does not work as expected. Instead, the schema retains its previous cardinality or is set to 0..*.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions