-
Notifications
You must be signed in to change notification settings - Fork 5
Add fetchPackageVersionDependencies function to thunderstore-api #1566
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
base: master
Are you sure you want to change the base?
Add fetchPackageVersionDependencies function to thunderstore-api #1566
Conversation
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRenames packageDependency to packageListingDependency across schemas and types and updates the ListingDependency component and PackageListingDetails to use PackageListingDependency. Adds a new packageVersionDependencySchema and PackageVersionDependency type, plus request and query param schemas for package version dependencies. Introduces a paginated packageVersionDependenciesResponseDataSchema and exports PackageVersionDependenciesResponseData. Adds a new fetchPackageVersionDependencies API function and re-exports it from the package index. Adds a unit test for package version dependencies and adds a versionNumber field to the test defaultConfig. Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts (1)
21-23
: Schema validation assertion could be clearer.The assertion
expect(packageVersionDependenciesResponseDataSchema.parse(response)).toBe(response)
will always pass because Zod'sparse
returns the input when validation succeeds. Consider asserting on specific response fields or just callingparse
to verify validation without the.toBe()
check.Apply this diff for a clearer assertion:
- expect(packageVersionDependenciesResponseDataSchema.parse(response)).toBe( - response - ); + // Validate response structure + packageVersionDependenciesResponseDataSchema.parse(response);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
apps/cyberstorm-remix/app/commonComponents/ListingDependency/ListingDependency.tsx
(1 hunks)packages/dapper/src/types/package.ts
(2 hunks)packages/thunderstore-api/src/__tests__/defaultConfig.ts
(1 hunks)packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts
(1 hunks)packages/thunderstore-api/src/get/packageVersionDependencies.ts
(1 hunks)packages/thunderstore-api/src/index.ts
(1 hunks)packages/thunderstore-api/src/schemas/objectSchemas.ts
(3 hunks)packages/thunderstore-api/src/schemas/queryParamSchemas.ts
(1 hunks)packages/thunderstore-api/src/schemas/requestSchemas.ts
(1 hunks)packages/thunderstore-api/src/schemas/responseSchemas.ts
(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
apps/cyberstorm-remix/app/commonComponents/ListingDependency/ListingDependency.tsx (1)
packages/thunderstore-api/src/schemas/objectSchemas.ts (1)
packageListingDependencySchema
(145-153)
packages/thunderstore-api/src/schemas/responseSchemas.ts (1)
packages/thunderstore-api/src/schemas/objectSchemas.ts (1)
packageVersionDependencySchema
(230-238)
packages/dapper/src/types/package.ts (1)
packages/thunderstore-api/src/schemas/objectSchemas.ts (1)
PackageListingDependency
(155-157)
packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts (3)
packages/thunderstore-api/src/__tests__/defaultConfig.ts (1)
testData
(11-16)packages/thunderstore-api/src/get/packageVersionDependencies.ts (1)
fetchPackageVersionDependencies
(11-35)packages/thunderstore-api/src/schemas/responseSchemas.ts (1)
packageVersionDependenciesResponseDataSchema
(135-140)
packages/thunderstore-api/src/schemas/objectSchemas.ts (1)
packages/dapper/src/types/package.ts (1)
PackageListingDependency
(37-45)
packages/thunderstore-api/src/get/packageVersionDependencies.ts (5)
packages/thunderstore-api/src/index.ts (1)
ApiEndpointProps
(9-15)packages/thunderstore-api/src/schemas/requestSchemas.ts (1)
PackageVersionDependenciesRequestParams
(198-200)packages/thunderstore-api/src/schemas/queryParamSchemas.ts (2)
PackageVersionDependenciesRequestQueryParams
(83-85)packageVersionDependenciesRequestQueryParamsSchema
(79-81)packages/thunderstore-api/src/schemas/responseSchemas.ts (2)
PackageVersionDependenciesResponseData
(142-144)packageVersionDependenciesResponseDataSchema
(135-140)packages/thunderstore-api/src/apiFetch.ts (1)
apiFetch
(59-114)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build
- GitHub Check: Generate visual diffs
🔇 Additional comments (7)
packages/thunderstore-api/src/__tests__/defaultConfig.ts (1)
15-15
: LGTM!The addition of
versionNumber
to test data properly supports the new package version dependencies endpoint tests.packages/dapper/src/types/package.ts (1)
26-26
: LGTM!The rename from
PackageDependency
toPackageListingDependency
better clarifies the scope of this type (listing-level vs. version-level dependencies). The change is consistent with the new schema naming introduced in the thunderstore-api package.Also applies to: 37-45
packages/thunderstore-api/src/schemas/requestSchemas.ts (1)
191-200
: LGTM!The new request params schema follows the established pattern and correctly includes the three required path parameters for the package version dependencies endpoint.
packages/thunderstore-api/src/index.ts (1)
36-36
: LGTM!The export is correctly placed in alphabetical order and exposes the new
fetchPackageVersionDependencies
function.apps/cyberstorm-remix/app/commonComponents/ListingDependency/ListingDependency.tsx (1)
1-1
: LGTM!The type update correctly reflects the schema rename from
packageDependencySchema
topackageListingDependencySchema
with no behavioral changes.Also applies to: 6-6
packages/thunderstore-api/src/schemas/queryParamSchemas.ts (1)
78-85
: LGTM!The query params schema correctly defines pagination support for the package version dependencies endpoint, reusing the existing
pageQueryParam
definition.packages/thunderstore-api/src/schemas/responseSchemas.ts (1)
135-144
: LGTM!The response schema follows the established paginated response pattern and correctly uses
packageVersionDependencySchema
for the results array.
packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts
Outdated
Show resolved
Hide resolved
59df60b
to
fb0216b
Compare
fb0216b
to
1f3e6ac
Compare
And the related object schemas Additionally the existing PackageDependency type needs to be renamed to be more accurate. As it's a package dependency returned with the package listing
1f3e6ac
to
6a1591e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts (2)
16-16
: Remove the typo and extra field.The
queryParams
contains a typoimpotent
(likely meant to beimportant
or removed entirely). Additionally, this field is not part of the query param schema and should be removed.Apply this diff:
- queryParams: [{ key: "page", value: 1, impotent: 1 }], + queryParams: [{ key: "page", value: 1 }],
21-23
: Use toEqual for value comparison.Schema validation tests should use
toEqual()
rather thantoBe()
sinceparse()
may return a new object instance with identical values.This is already correctly implemented in the current code.
🧹 Nitpick comments (1)
packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts (1)
15-15
: Remove unnecessary data property.The
data: {}
is not needed for GET endpoints and can be removed for clarity.Apply this diff:
params: { namespace_id: namespaceId, package_name: packageName, version_number: versionNumber, }, - data: {}, queryParams: [{ key: "page", value: 1 }],
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
apps/cyberstorm-remix/app/commonComponents/ListingDependency/ListingDependency.tsx
(1 hunks)packages/dapper/src/types/package.ts
(2 hunks)packages/thunderstore-api/src/__tests__/defaultConfig.ts
(1 hunks)packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts
(1 hunks)packages/thunderstore-api/src/get/packageVersionDependencies.ts
(1 hunks)packages/thunderstore-api/src/index.ts
(1 hunks)packages/thunderstore-api/src/schemas/objectSchemas.ts
(3 hunks)packages/thunderstore-api/src/schemas/requestSchemas.ts
(1 hunks)packages/thunderstore-api/src/schemas/responseSchemas.ts
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
- packages/thunderstore-api/src/index.ts
- packages/thunderstore-api/src/get/packageVersionDependencies.ts
- packages/thunderstore-api/src/schemas/requestSchemas.ts
- packages/dapper/src/types/package.ts
- apps/cyberstorm-remix/app/commonComponents/ListingDependency/ListingDependency.tsx
- packages/thunderstore-api/src/schemas/responseSchemas.ts
🧰 Additional context used
🧬 Code graph analysis (2)
packages/thunderstore-api/src/get/__tests__/packageVersionDependencies.test.ts (3)
packages/thunderstore-api/src/__tests__/defaultConfig.ts (1)
testData
(11-16)packages/thunderstore-api/src/get/packageVersionDependencies.ts (1)
fetchPackageVersionDependencies
(11-35)packages/thunderstore-api/src/schemas/responseSchemas.ts (1)
packageVersionDependenciesResponseDataSchema
(135-140)
packages/thunderstore-api/src/schemas/objectSchemas.ts (1)
packages/dapper/src/types/package.ts (1)
PackageListingDependency
(37-45)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build
- GitHub Check: Generate visual diffs
🔇 Additional comments (3)
packages/thunderstore-api/src/schemas/objectSchemas.ts (2)
145-157
: LGTM on the rename.The rename from
PackageDependency
toPackageListingDependency
better clarifies this type represents dependencies in package listings.
230-242
: Confirm icon_url nullability in packageVersionDependencySchema
All other dependency schemas usez.string().nullable()
foricon_url
, but here it’s non-nullable. Verify this matches the API contract.packages/thunderstore-api/src/__tests__/defaultConfig.ts (1)
15-15
: LGTM.The addition of
versionNumber
to test data supports the new package version dependencies endpoint tests.
And the related object schemas
Additionally the existing PackageDependency type needs to be renamed to
be more accurate. As it's a package dependency returned with the package
listing