Skip to content

fix(sdk): resolve getResource by requested type#2171

Open
thorthelegend99 wants to merge 1 commit intoevent-catalog:mainfrom
thorthelegend99:fix/sdk-type-safe-find-by-id
Open

fix(sdk): resolve getResource by requested type#2171
thorthelegend99 wants to merge 1 commit intoevent-catalog:mainfrom
thorthelegend99:fix/sdk-type-safe-find-by-id

Conversation

@thorthelegend99
Copy link
Contributor

@thorthelegend99 thorthelegend99 commented Feb 17, 2026

Summary

  • make SDK findFileById optionally type-aware using resource folder matching
  • pass requested resource type from getResource into findFileById
  • add regression test for duplicate id across different resource types (channel + service)
  • add changeset for @eventcatalog/sdk

Why

When multiple resource types share an id, getService/getEvent-style calls could resolve the wrong resource because lookup was id-only.

Validation

  • pnpm --filter @eventcatalog/sdk exec vitest run src/test/resources.test.ts
  • pnpm --filter @eventcatalog/sdk exec vitest run src/test/services.test.ts -t "returns the given service id from EventCatalog and the latest version when no version is given"

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: 018c436

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

This PR includes changesets to release 4 packages
Name Type
@eventcatalog/sdk Patch
@eventcatalog/cli Patch
@eventcatalog/core Patch
@eventcatalog/linter 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

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Thor seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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