Skip to content

Commit

Permalink
Merge pull request #4199 from GordonSmith/STRING_ARRAY_REGRESSION
Browse files Browse the repository at this point in the history
fix:  Request string arrays had incorrect nesting
  • Loading branch information
GordonSmith authored May 24, 2024
2 parents 9b113a7 + 37a0f8a commit 9be6398
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 36 deletions.
6 changes: 3 additions & 3 deletions packages/comms/src/ecl/workunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,12 @@ export class Workunit extends StateObject<UWorkunitState, IWorkunitState> implem
return this.fetchDetails({
ScopeFilter: {
MaxDepth: 999999,
Ids: { id: graphIDs },
ScopeTypes: { ScopeType: rootTypes },
Ids: graphIDs,
ScopeTypes: rootTypes,
},
NestedFilter: {
Depth: 999999,
ScopeTypes: { ScopeType: ["graph", "subgraph", "activity", "edge", "function"] }
ScopeTypes: ["graph", "subgraph", "activity", "edge", "function"]
},
PropertiesToReturn: {
AllStatistics: true,
Expand Down
40 changes: 14 additions & 26 deletions packages/comms/src/services/wsdl/WsWorkunits/v2/WsWorkunits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -949,18 +949,6 @@ export namespace WsWorkunits {
Workunit: Workunit;
}

export interface Scopes {
Scope: string[];
}

export interface Ids {
id: string[];
}

export interface ScopeTypes {
ScopeType: string[];
}

export interface PropertyFilter {
Name: string;
ExactValue: string;
Expand All @@ -974,24 +962,20 @@ export namespace WsWorkunits {

export interface ScopeFilter {
MaxDepth: integer;
Scopes: Scopes;
Ids: Ids;
ScopeTypes: ScopeTypes;
Scopes: string[];
Ids: string[];
ScopeTypes: string[];
PropertyFilters: PropertyFilters;
}

export interface NestedFilter {
Depth: unsignedInt;
ScopeTypes: ScopeTypes;
}

export interface Properties2 {
Property: string[];
ScopeTypes: string[];
}

export interface Extra {
scopeType: string;
Properties: Properties2;
Properties: string[];
}

export interface ExtraProperties {
Expand All @@ -1007,7 +991,7 @@ export namespace WsWorkunits {
AllNotes: boolean;
MinVersion: uint64;
Measure: string;
Properties: Properties2;
Properties: string[];
ExtraProperties: ExtraProperties;
}

Expand Down Expand Up @@ -1037,15 +1021,15 @@ export namespace WsWorkunits {
SinkActivity: string;
}

export interface Scopes2 {
export interface Scopes {
Scope: Scope[];
}

export interface WUDetailsResponse {
Exceptions: Exceptions;
MaxVersion: uint64;
WUID: string;
Scopes: Scopes2;
Scopes: Scopes;
}

export interface WUDetailsMeta {
Expand All @@ -1058,10 +1042,14 @@ export namespace WsWorkunits {
Description: string;
}

export interface Properties3 {
export interface Properties2 {
Property: Property2[];
}

export interface ScopeTypes {
ScopeType: string[];
}

export interface Measures {
Measure: string[];
}
Expand All @@ -1079,7 +1067,7 @@ export namespace WsWorkunits {

export interface WUDetailsMetaResponse {
Exceptions: Exceptions;
Properties: Properties3;
Properties: Properties2;
ScopeTypes: ScopeTypes;
Measures: Measures;
Activities: Activities2;
Expand Down
19 changes: 12 additions & 7 deletions packages/comms/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function parseEnum(enumString: string, enumEl) {
};
}

function parseTypeDefinition(operation: JsonObj, opName: string, types, depth: number = 0) {
function parseTypeDefinition(operation: JsonObj, opName: string, types, isResponse: boolean) {
const hashId = hashSum({ opName, operation });
if (knownTypes[hashId]) {
return knownTypes[hashId];
Expand All @@ -124,11 +124,16 @@ function parseTypeDefinition(operation: JsonObj, opName: string, types, depth: n
const propName = (!prop.endsWith("[]")) ? prop : prop.slice(0, -2);
if (typeof operation[prop] === "object") {
const op = operation[prop];
const [newPropName, defn] = parseTypeDefinition(op, propName, types, depth + 1);
if (prop.endsWith("[]")) {
typeDefn[propName] = newPropName + "[]";
const keys = Object.keys(op);
if (!isResponse && keys?.length === 1 && keys[0].indexOf("[]") >= 0 && Object.values(op)[0] === "xsd:string") {
typeDefn[propName] = "string[]";
} else {
typeDefn[propName] = newPropName;
const [newPropName, defn] = parseTypeDefinition(op, propName, types, isResponse);
if (prop.endsWith("[]")) {
typeDefn[propName] = newPropName + "[]";
} else {
typeDefn[propName] = newPropName;
}
}
} else {
if (ignoredWords.indexOf(prop) < 0) {
Expand Down Expand Up @@ -181,8 +186,8 @@ wsdlToTs(args.url)
const response = operation["output"];
const respName = bindings[op].methods[svc].output.$name;

parseTypeDefinition(request, reqName, types);
parseTypeDefinition(response, respName, types);
parseTypeDefinition(request, reqName, types, false);
parseTypeDefinition(response, respName, types, true);
}
}
}
Expand Down

0 comments on commit 9be6398

Please sign in to comment.