def join_properties()

in functions/orchestration-helpers/intermediate/main.py [0:0]


def join_properties(workflow_properties, step_properties):
    """
    receives 2 dictionaries if exists, and join step properties into workflow properties, overriding props if necessary.

    Args:
        workflow_properties: properties passed in firestore to the workflow
        step_properties: properties configured in each step in functional json workflow definition.
                         can overwrite workflow properties

    Returns:
        final properties dictionary
    """

    # Handle None or empty inputs
    workflow_props = {}
    if workflow_properties:
        workflow_props = json.loads(workflow_properties) if isinstance(workflow_properties,
                                                                       str) else workflow_properties

    step_props = {}
    if step_properties:
        step_props = json.loads(step_properties) if isinstance(step_properties, str) else step_properties

    return {**workflow_props, **step_props}