conductor icon indicating copy to clipboard operation
conductor copied to clipboard

Don't send certain input parameters if their value is null

Open joshuahaertel opened this issue 3 months ago • 2 comments

The feature, motivation and pitch

I'm trying to slim down the data sent between Conductor and microservices my workflow uses. I would like to prevent Conductor from sending certain parameters that don't have a value. It currently sends them with a null value.

Alternatives

I've considered a JavaScript or possibly even a JQ task right before that removes certain/all keys with null values. I don't like having an extra task associated with every task that needs this since it increases the size of the workflow and adds extra latency to do a relatively simple task.

Additional context

I am specifically using HTTP Tasks, but I imagine this is beneficial for other task types as well.

The microservices have optional input parameters that come from optional output parameters of a previous microservice/task. Since they don't always exist, there are extra keys in Conductor's request with null values. While it's not a huge deal for a single parameter for an occasional request, if you get enough of these parameters, or make enough requests, the increase in unnecessary data transfer can start to incur material costs, especially with cloud ingress/egress.

joshuahaertel avatar Aug 29 '25 19:08 joshuahaertel

Hi @joshuahaertel, thanks for the idea, this is worth considering. Since we've just restarted our roadmap-based planning for OSS we'll have to slot this in a little further down the road (if we do at all) -- it'll need signoff from Viren first.

That said, here are some implementation approaches we could consider:

Option 1: Per-Task Configuration (Recommended)

Add an omitNullInputs boolean parameter to the HTTP task input:

{
  "inputParameters": {
    "http_request": {
      "uri": "https://api.example.com/endpoint",
      "method": "POST",
      "omitNullInputs": true,
      "body": {
        "field1": "value",
        "field2": null  // Would be excluded from the request
      }
    }
  }
}

Implementation: Filter null values from the body Map before creating the HttpEntity in HttpTask.httpCall() (around line 151-194).

Pros:

  • Backward compatible (defaults to false)
  • Per-task control - use it where needed
  • Simple to implement
  • Aligns with similar boolean flags in the enterprise version

Option 2: Global Configuration

Add a property like conductor.tasks.http.omitNullInputs=true that applies to all HTTP tasks.

Pros: Set once, applies everywhere Cons: Less flexible, might break existing workflows that rely on null value behavior

Option 3: Jackson ObjectMapper Configuration

Configure the RestTemplate's message converter to use Jackson's @JsonInclude(Include.NON_NULL) globally.

Pros: Handles nested objects automatically Cons: Would affect all JSON serialization in HTTP tasks, potentially surprising behavior

Recommended Approach

I'd suggest Option 1 as it gives users the most control and is the safest from a backward compatibility perspective. The implementation would involve:

  1. Add omitNullInputs field to HttpTask.Input class
  2. In httpCall(), before creating the HttpEntity, recursively filter null values from the body if omitNullInputs == true
  3. Add tests to verify null values are excluded when flag is set

Let us know if you have any thoughts on these approaches!

nthmost-orkes avatar Oct 22 '25 02:10 nthmost-orkes

I appreciate the follow-up @nthmost-orkes! I agree that option 1 seems like the best one. Thanks 😊

joshuahaertel avatar Oct 22 '25 03:10 joshuahaertel