Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling schema fields with cardinality 0..0 #260

Open
camemre49 opened this issue Dec 3, 2024 · 0 comments
Open

Handling schema fields with cardinality 0..0 #260

camemre49 opened this issue Dec 3, 2024 · 0 comments

Comments

@camemre49
Copy link
Contributor

camemre49 commented Dec 3, 2024

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..*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant