Repository navigation
fix(servicenow): keep help_text in Get Catalog Item Variables #22183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ashwins01
merged 3 commits into
PipedreamHQ:master
from
akshaykumarg:AGENTS-7047-catalog-variable-help-text
Oct 9, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||
| import { ConfigurationError } from "@pipedream/platform"; | ||||||||||||
| import constants from "./constants.mjs"; | ||||||||||||
|
|
||||||||||||
| export function parseObject(value) { | ||||||||||||
| if (!value) return undefined; | ||||||||||||
|
|
@@ -160,6 +161,14 @@ const DESCRIBED_VARIABLE_FIELDS = [ | |||||||||||
| "choices", | ||||||||||||
| ]; | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * Trim one catalog variable (and its children) to the fields an agent needs, | ||||||||||||
| * and attach an `options` descriptor for choice-based types. | ||||||||||||
| * @param {object} variable - A variable from the Service Catalog `/variables` response | ||||||||||||
| * @param {object[]} scriptDefaults - Collects described reference variables whose | ||||||||||||
| * default is a `javascript:` script, for the caller to resolve | ||||||||||||
| * @returns {object} The described variable | ||||||||||||
| */ | ||||||||||||
| function describeVariable(variable, scriptDefaults) { | ||||||||||||
| const type = Number(variable.type); | ||||||||||||
| const described = {}; | ||||||||||||
|
|
@@ -168,6 +177,11 @@ function describeVariable(variable, scriptDefaults) { | |||||||||||
| described[field] = variable[field]; | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| for (const field of constants.DESCRIBED_TEXT_FIELDS) { | ||||||||||||
| if (typeof variable[field] === "string" && variable[field].trim()) { | ||||||||||||
| described[field] = variable[field]; | ||||||||||||
|
Comment on lines
+181
to
+182
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This checks the trimmed value but stores the original, so leading/trailing padding is kept. Was keeping the untrimmed value intentional ? Some stock items return help text wrapped in
Suggested change
|
||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (Array.isArray(variable.children)) { | ||||||||||||
| described.children = variable.children.map((child) => | ||||||||||||
|
|
@@ -227,10 +241,11 @@ function describeVariable(variable, scriptDefaults) { | |||||||||||
| * them in a Table API query, so they are flagged with `qualifier_unresolved` | ||||||||||||
| * rather than returned as `query`. Only the fields an agent needs to fill the | ||||||||||||
| * form are kept (`id`, `name`, `label`, `type`, `mandatory`, `value`, | ||||||||||||
| * `choices`, `children`, `options` and the default flags); form-rendering | ||||||||||||
| * metadata such as list collector `columns` is dropped. Reference variables | ||||||||||||
| * whose default is a `javascript:` script are returned in `scriptDefaults`, | ||||||||||||
| * with the referenced table in `options.table`, for the caller to resolve. | ||||||||||||
| * `choices`, `children`, `options`, a non-empty `help_text` and the default | ||||||||||||
| * flags); form-rendering metadata such as list collector `columns` is dropped. | ||||||||||||
| * Reference variables whose default is a `javascript:` script are returned in | ||||||||||||
| * `scriptDefaults`, with the referenced table in `options.table`, for the | ||||||||||||
| * caller to resolve. | ||||||||||||
| */ | ||||||||||||
| export function describeCatalogVariables(variables) { | ||||||||||||
| const scriptDefaults = []; | ||||||||||||
|
|
||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.