Variable with no scope

Hi,

We have found an issue with our current version of Octopus 3.7.10, where variables with empty scopes are stored inconsistently.

Here is the scenario:

I create a variable named varA with value valA with no scope. We save the variables and query the API.
We get the following snippet:

"Variables": [
    {
      "Id": "6653652a-2961-1d55-2000-c5634bab8182",
      "Name": "varA",
      "Value": "valA",
      "Scope": {},
      "IsSensitive": false,
      "IsEditable": true,
      "Prompt": null
    }
]

If I create another variable named varB with value valB, but his time I add an environment scope, then remove the environment scope, so that it should be as if I never added any scope. We save the variables and query the API.
We get the following snippet:

"Variables": [
    {
      "Id": "6653652a-2961-1d55-2000-c5634bab8182",
      "Name": "varA",
      "Value": "valA",
      "Scope": {},
      "IsSensitive": false,
      "IsEditable": true,
      "Prompt": null
    },
    {
      "Id": "104962f9-82c3-dc71-d341-bd4f59efda06",
      "Name": "varB",
      "Value": "valB",
      "Scope": {
        "Environment": []
      },
      "IsSensitive": false,
      "IsEditable": true,
      "Prompt": null
    }
]

The issue is this:

"Scope": {},
"Scope": {
        "Environment": []
      },

I understand that it does this because, when we add an environment it instantiates an environment list, then it removes the environment from the list, so we have an empty array. Would it be possible to clean up the empty objects before the serialization? This will help us to avoid coding for this.

Regards,
Avinash

Hi Avinash,

I’ve spoken to the team and we don’t think this is something we will fix (at least not in the foreseeable future).

Sorry for the inconvenience!

Thank you and best regards,
Henrik