Skip to content

Commit

Permalink
Fixed: JsonPrinter metadata blocks dataset field type isRequired logic
Browse files Browse the repository at this point in the history
  • Loading branch information
GPortas committed Jun 19, 2024
1 parent 1246d7c commit 1606a12
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,11 @@ public static JsonObjectBuilder json(MetadataBlock metadataBlock, boolean printO
boolean requiredAsInputLevel = isInputLevel && ownerDataverse.isDatasetFieldTypeRequiredAsInputLevel(datasetFieldTypeId);
boolean includedAsInputLevel = isInputLevel && ownerDataverse.isDatasetFieldTypeIncludedAsInputLevel(datasetFieldTypeId);

DatasetFieldType parentDatasetFieldType = datasetFieldType.getParentDatasetFieldType();
boolean isRequired = parentDatasetFieldType == null ? datasetFieldType.isRequired() : parentDatasetFieldType.isRequired();

boolean displayCondition = printOnlyDisplayedOnCreateDatasetFieldTypes
? (datasetFieldType.isDisplayOnCreate() || datasetFieldType.isRequired() || requiredAsInputLevel)
? (datasetFieldType.isDisplayOnCreate() || isRequired || requiredAsInputLevel)
: !isInputLevel || includedAsInputLevel;

if (displayCondition) {
Expand Down

0 comments on commit 1606a12

Please sign in to comment.