Skip to content
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

fix: iconImage in an app response is optional #252

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

rossiam
Copy link
Contributor

@rossiam rossiam commented Jan 13, 2025

Changes

  • marked iconImage field as optional in response from API
  • minor updates to CONTRIBUTING.md document to make things more clear

Notes

The iconImage field is an object which contains a single url key which means there are three possible ways this can be defined:

  1. The iconImage field is omitted entirely.
  2. It is included but url is not. ("iconImage": {})
  3. It is included with a url populated. ("iconImage": { "url": "<my-url>" })

When submitting data to the API, all three are accepted and work as expected.

When retrieving data, option 2 is sensibly never returned, normalizing to option 1 if option 2 was submitted via creation.

So, the type used for creation and updating was left as iconImage?: IconImage which allows for all three cases, but the type for the return value was changed to iconImage?: Required<IconImage> which allows for options 1 and 3. (The previous value of iconImage: Required<IconImage> allowed only for option 3.)

@rossiam rossiam requested a review from a team January 13, 2025 17:25
Copy link

changeset-bot bot commented Jan 13, 2025

🦋 Changeset detected

Latest commit: a9ec956

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smartthings/core-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rossiam rossiam merged commit 9f9a3f2 into SmartThingsCommunity:main Jan 13, 2025
5 checks passed
@rossiam rossiam deleted the iconImage-optional branch January 13, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants