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

Revert "#228 rm input empty string default value (#705)" #837

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
//5. map to engine data and return
return this.engineDataMapper.mapObjectsToVariables(clearedData);
return this.engineDataMapper.mapObjectsToVariables(serializedData);
}

}
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);

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

@Override
Expand Down