Skip to content

fix(model): type the function input values in app activities - #1718

Open
zimeg wants to merge 1 commit into
apifrom
zimeg-function-input-value
Open

zimeg wants to merge 1 commit into
apifrom
zimeg-function-input-value

Conversation

@zimeg

@zimeg zimeg commented Nov 19, 2026

Copy link
Copy Markdown
Member

Summary

This pull request types AppActivity.FunctionInput.value from admin.apps.activities.list instead of leaving it as Object.

  • A trigger's function input value comes back as a string, or as a credential object with credential_source, external_token_id and user_context_source for inputs that use external authentication.
  • AppActivity.FunctionInputValue holds either form, and a new GsonAppActivityFunctionInputValueFactory, registered in GsonFactory, reads both, the same way LogsResponse.DetailsAction reads details.action.
  • With failOnUnknownProperties on, unknown keys in the object form raise an error.

FunctionInput is new in #1636, so this changes nothing that has been released. Merging this lands it in #1636.

Testing

With an org admin token that has admin.app_activities:read, call admin.apps.activities.list for an app whose workflow trigger has a string input and an external authentication input, and confirm getValue().getStringValue() and getValue().getCredentialSource() are set.

Category

  • bolt (Bolt for Java)
  • bolt-{sub modules} (Bolt for Java - optional modules)
  • slack-api-client (Slack API Clients)
  • slack-api-model (Slack API Data Models)
  • slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
  • slack-app-backend (The primitive layer of Bolt for Java)

Requirements

🤖 Generated with Claude Code

A function input's value is either a string or a credential object, so FunctionInputValue holds both and a Gson factory reads each form.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg requested a review from a team as a code owner November 19, 2026 09:24
@zimeg zimeg added this to the 1.55.1 milestone Nov 19, 2026
@zimeg zimeg added project:slack-api-client project:slack-api-client project:slack-api-model project:slack-api-model semver:patch labels Nov 19, 2026
@zimeg zimeg self-assigned this Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.70213% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.80%. Comparing base (b796e10) to head (222fd09).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...json/GsonAppActivityFunctionInputValueFactory.java 60.86% 12 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                api    #1718      +/-   ##
============================================
- Coverage     73.91%   73.80%   -0.12%     
+ Complexity     4797     4793       -4     
============================================
  Files           489      490       +1     
  Lines         14959    14967       +8     
  Branches       1562     1572      +10     
============================================
- Hits          11057    11046      -11     
- Misses         2977     2990      +13     
- Partials        925      931       +6     
Flag Coverage Δ
jdk-14 73.80% <61.70%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@WilliamBergamin WilliamBergamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Thanks @zimeg! Typing this with an adapter like StepInputValue and DetailsAction is a nice fit, and the strict-mode test for unknown keys is a good guard.
One blocking comment on input values beyond strings and credentials, plus the tests for it 🙏

if (json.isJsonPrimitive()) {
result.setStringValue(json.getAsString());
return result;
} else if (json.isJsonObject()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 issue (blocking): Trigger inputs can be any value (docs), like an array of user IDs. Today an array or a plain object comes back all-null, or throws in strict mode, and true/42 become strings. Could we add stringValues like GsonAppWorkflowStepInputValueFactory and keep the raw value as a fallback?

"}";

@Test
public void deserialize_string() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 issue (blocking): Every test here runs strict mode with a string or a credential. Could we add the default lenient parse of an unknown key, an array, and a non-credential object, plus serializing an empty value?

Comment on lines +104 to +106
// e.g., "https://api.github.com/repos/..." for a string input
private String stringValue;
// credential inputs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪓 suggestion (non-blocking): These comments repeat the field names. The factory tests already show both forms, so we could drop them.

Suggested change
// e.g., "https://api.github.com/repos/..." for a string input
private String stringValue;
// credential inputs
private String stringValue;
private String credentialSource;

This branch has not been deployed

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

Labels

project:slack-api-client project:slack-api-client project:slack-api-model project:slack-api-model semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants