Skip to content

VariableGet does not parse JSON responses for single returned result. #583

Description

@frankgiordano

Retrieving multiple z/OS system variables by name returns the expected data list. However, passing a single variable name in the input list results in an empty list within the VariableGetResponse object. This occurs because the underlying JSON response structure changes from a JSON array to a single JSON object, which the SDK fails to parse.

Steps to Reproduce

Case 1: Requesting Multiple Variables (Successful)

VariableGet variableGet = new VariableGet(connection);
VariableGetInputData getInputData = VariableGetInputFactory.createZosVariable(sysplexName, systemName, List.of("var1", "var2"));
response = variableGet.get(getInputData);// Result: Response correctly contains a list of both variables and their values.

Case 2: Requesting a Single Variable (Fails to Populate)

VariableGet variableGet = new VariableGet(connection);
VariableGetInputData getInputData = VariableGetInputFactory.createZosVariable(sysplexName, systemName, List.of("var1"));
response = variableGet.get(getInputData);// Result: response.getSystemVariableList() returns an empty list [].

Root Cause Analysis

The issue stems from how the SDK deserializes the incoming JSON payload. The z/OSMF REST API alters its JSON root schema based on whether one or multiple variables are requested:

  • Multiple Variables Structure: z/OSMF returns a root JSON object wrapping a JSON array. The SDK is designed to parse this format correctly.

{"system-variable-list":[{"name":"var1","value":"value1","description":"first variable description"},{"name":"var2","value":"value2","description":null}]}

  • Single Variable Structure: z/OSMF returns a single JSON object directly at the root, completely omitting the system-variable-list array container.

{"name":"var1","value":"value1","description":"first variable description"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions