Skip to content

Commit

Permalink
Revert "#228 rm input empty string default value (#705)" (#837)
Browse files Browse the repository at this point in the history
This reverts commit d4e0af7.
  • Loading branch information
simonhir authored Oct 12, 2023
1 parent 249c015 commit fc139bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ private Map<String, Object> initalizeData(final ServiceDefinitionDetail definiti
//3. simulate previous data for merging and removing JSON.null values
final JSONObject previousData = this.serializationService.initialize(new JSONObject(definition.getJsonSchema()).toString());
final Map<String, Object> clearedData = this.serializationService.merge(filteredData, previousData);
//4. merge with default values
final JSONObject defaultValue = this.serializationService.initialize(new JSONObject(definition.getJsonSchema()).toString());
final Map<String, Object> serializedData = this.serializationService.merge(new JSONObject(clearedData), defaultValue);

Check warning on line 72 in digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/process/definition/domain/service/ServiceDefinitionDataService.java

View check run for this annotation

Codecov / codecov/patch

digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/process/definition/domain/service/ServiceDefinitionDataService.java#L71-L72

Added lines #L71 - L72 were not covered by tests
//5. map to engine data and return
return this.engineDataMapper.mapObjectsToVariables(clearedData);
return this.engineDataMapper.mapObjectsToVariables(serializedData);

Check warning on line 74 in digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/process/definition/domain/service/ServiceDefinitionDataService.java

View check run for this annotation

Codecov / codecov/patch

digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/process/definition/domain/service/ServiceDefinitionDataService.java#L74

Added line #L74 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ public Map<String, Object> validateAndSerialize(JsonSchema schema, Task task, Ma
val taskData = this.engineDataMapper.mapToData(task.getPayload());
val targetData = this.serializationService.deserializeData(schema.asMap(), taskData);
val serializedData = this.serializationService.merge(filteredData, new JSONObject(targetData));
val defaultValue = this.serializationService.initialize(new JSONObject(schema.getSchema()).toString());
val serializedDataWithDefaultValues = this.serializationService.merge(new JSONObject(serializedData), defaultValue);

Check warning on line 34 in digiwf-task/digiwf-tasklist-service/src/main/java/de/muenchen/oss/digiwf/task/service/adapter/out/schema/JsonSchemaValidationAdapter.java

View check run for this annotation

Codecov / codecov/patch

digiwf-task/digiwf-tasklist-service/src/main/java/de/muenchen/oss/digiwf/task/service/adapter/out/schema/JsonSchemaValidationAdapter.java#L33-L34

Added lines #L33 - L34 were not covered by tests

return this.engineDataMapper.mapObjectsToVariables(serializedData);
return this.engineDataMapper.mapObjectsToVariables(serializedDataWithDefaultValues);

Check warning on line 36 in digiwf-task/digiwf-tasklist-service/src/main/java/de/muenchen/oss/digiwf/task/service/adapter/out/schema/JsonSchemaValidationAdapter.java

View check run for this annotation

Codecov / codecov/patch

digiwf-task/digiwf-tasklist-service/src/main/java/de/muenchen/oss/digiwf/task/service/adapter/out/schema/JsonSchemaValidationAdapter.java#L36

Added line #L36 was not covered by tests
}

@Override
Expand Down

0 comments on commit fc139bb

Please sign in to comment.