Skip to content

Commit

Permalink
fix(designer): Removed new OpenAPI token behavior added in #4122 (#4158)
Browse files Browse the repository at this point in the history
Revert new behavior added in #4122
  • Loading branch information
ek68794998 committed Feb 8, 2024
1 parent 60fe43a commit c72e9e9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2488,16 +2488,6 @@ describe('core/utils/parameters/helper', () => {
['outputs.$.headers', undefined, `triggerOutputs()`],
['outputs.$.relativePathParameters', undefined, `triggerOutputs()`],

// For nested properties (OpenAPI) within `outputs.$.body`, use BODY.
['outputs.$.body.ID', undefined, `triggerBody()`],
['outputs.$.body.Title', undefined, `triggerBody()`],
['outputs.$.body.Author.DisplayName', undefined, `triggerBody()`],

// For nested path properties (OpenAPI) within `outputs.$.body/*`, use BODY.
['outputs.$.body/value.ID', undefined, `triggerBody()`],
['outputs.$.body/value.Title', undefined, `triggerBody()`],
['outputs.$.body/value.Author.DisplayName', undefined, `triggerBody()`],

// For values using `body/*` syntax, use OUTPUTS.
['outputs.$.body/subject', 'Get_event_(V3)', `outputs('Get_event_(V3)')`],
])('correctly gets the token expression for %p', (key, actionName, expected) => {
Expand Down
12 changes: 1 addition & 11 deletions libs/designer/src/lib/core/utils/parameters/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1022,17 +1022,7 @@ function segmentsAreBodyReference(segments: Segment[]): boolean {
return false;
}

if (segments[0].value === OutputSource.Body) {
return true;
}

// For tokens of format `outputs.$.body.Title` or `outputs.$.body/Title`, where we are referring to a property within
// the body, we have to reference the body rather than the outputs field.
return (
segments.length >= 4 &&
isString(segments[2].value) &&
(segments[2].value === constants.OUTPUT_LOCATIONS.BODY || segments[2].value.startsWith(`${constants.OUTPUT_LOCATIONS.BODY}/`))
);
return segments[0].value === OutputSource.Body;
}

// NOTE: For example, if tokenKey is outputs.$.foo.[*].bar, which means
Expand Down

0 comments on commit c72e9e9

Please sign in to comment.