-
-
Notifications
You must be signed in to change notification settings - Fork 50
feat(hey-api): improve compatibility #611
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Caution Review failedThe pull request is closed. WalkthroughThis update renames all planet-related API method and type names for consistency, such as changing Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant SDK
participant API
Client->>SDK: planetList(query?)
SDK->>API: GET /planets?query
API-->>SDK: PlanetListResponses
SDK-->>Client: PlanetListResponses
Client->>SDK: planetCreate(body)
SDK->>API: POST /planets (body)
API-->>SDK: PlanetCreateResponses (200: UpdatedPlanet or 201: Planet)
SDK-->>Client: PlanetCreateResponses
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
More templates
@orpc/arktype
@orpc/client
@orpc/contract
@orpc/hey-api
@orpc/nest
@orpc/openapi
@orpc/openapi-client
@orpc/react
@orpc/react-query
@orpc/server
@orpc/shared
@orpc/solid-query
@orpc/standard-server
@orpc/standard-server-aws-lambda
@orpc/standard-server-fetch
@orpc/standard-server-node
@orpc/standard-server-peer
@orpc/svelte-query
@orpc/tanstack-query
@orpc/valibot
@orpc/vue-colada
@orpc/vue-query
@orpc/zod
commit: |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
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: 1
🧹 Nitpick comments (1)
packages/hey-api/tests/client/types.gen.ts (1)
44-44
: Fix grammatical error in comment.The comment contains a grammatical error that should be corrected.
- * A updated planet + * An updated planetNote: Since this is auto-generated code, the fix should be applied to the OpenAPI specification or generator template.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/hey-api/src/to-orpc-client.test-d.ts
(2 hunks)packages/hey-api/src/to-orpc-client.test.ts
(9 hunks)packages/hey-api/src/to-orpc-client.ts
(1 hunks)packages/hey-api/tests/client/sdk.gen.ts
(2 hunks)packages/hey-api/tests/client/types.gen.ts
(2 hunks)packages/hey-api/tests/spec.json
(4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
packages/hey-api/src/to-orpc-client.test-d.ts (2)
packages/client/src/types.ts (1)
NestedClient
(30-32)packages/hey-api/tests/client/types.gen.ts (1)
Planet
(3-6)
packages/hey-api/src/to-orpc-client.ts (1)
packages/client/src/types.ts (1)
Client
(26-28)
packages/hey-api/tests/client/sdk.gen.ts (1)
packages/hey-api/tests/client/types.gen.ts (4)
PlanetListData
(16-24)PlanetListResponses
(26-31)PlanetCreateData
(35-40)PlanetCreateResponses
(42-51)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: publish-commit
- GitHub Check: lint
🔇 Additional comments (12)
packages/hey-api/src/to-orpc-client.test-d.ts (1)
12-12
: LGTM: Consistent method renaming applied throughout type tests.The renaming from
listPlanets
/createPlanet
toplanetList
/planetCreate
is consistently applied across all test cases. The enhanced return type on line 45 correctly reflects the union typePlanet | { id: string }
which aligns with the new UpdatedPlanet schema added to the OpenAPI spec.Also applies to: 19-19, 21-26, 28-33, 43-43, 45-45
packages/hey-api/src/to-orpc-client.test.ts (1)
50-50
: LGTM: Method renaming consistently applied across all test scenarios.All test cases have been properly updated to use the new method names
planetList
andplanetCreate
. The test logic, assertions, and error handling remain unchanged, ensuring that functionality is preserved while adopting the new naming convention.Also applies to: 59-59, 72-72, 93-93, 105-105, 119-119, 135-135, 148-148, 157-157
packages/hey-api/src/to-orpc-client.ts (2)
5-5
: Improved type inference by removing parameter constraint.Removing the explicit constraint on the
options
parameter allows for more flexible type inference ofUInput
, improving compatibility with various SDK input types.
12-14
: Enhanced support for nested SDK structures.The recursive type mapping now properly handles nested record properties by mapping them to their corresponding client result types, rather than returning
never
. This enables the type system to correctly represent complex nested SDK structures while maintaining type safety.packages/hey-api/tests/spec.json (2)
77-86
: New 200 response extends API contract for planet creation.The addition of a 200 response with UpdatedPlanet schema means the POST /planets endpoint can now return either a newly created planet (201) or an updated existing planet (200). This is a valid API design but represents a change in the API contract.
151-159
: UpdatedPlanet schema appropriately minimal.The new UpdatedPlanet schema correctly requires only the
id
field, which makes sense for an update response where only the identifier might be guaranteed to be present.packages/hey-api/tests/client/sdk.gen.ts (3)
4-4
: LGTM! Consistent type import renaming.The import statement correctly reflects the renamed types from
ListPlanets*
/CreatePlanet*
toPlanetList*
/PlanetCreate*
pattern, maintaining consistency with the updated API specification.
21-26
: Function renaming follows consistent pattern.The
listPlanets
toplanetList
renaming aligns with the new naming convention. The function implementation remains correct with properly updated type references.Note: This introduces a breaking change for existing consumers of the SDK.
28-37
: Function renaming maintains type safety.The
createPlanet
toplanetCreate
renaming is consistent with the overall refactoring. The function correctly uses the updatedPlanetCreateResponses
type which now includes both 200 (UpdatedPlanet) and 201 (Planet) responses.packages/hey-api/tests/client/types.gen.ts (3)
12-14
: Good addition of UpdatedPlanet type.The new
UpdatedPlanet
type provides clear distinction between created and updated planet responses, enhancing type safety for different API response scenarios.
16-33
: Consistent type renaming pattern.The renaming from
ListPlanetsData
/ListPlanetsResponses
/ListPlanetsResponse
toPlanetListData
/PlanetListResponses
/PlanetListResponse
follows a clear, consistent pattern that improves API naming conventions.
35-53
: Enhanced response type with proper renaming.The
PlanetCreateResponses
type correctly includes both 200 (UpdatedPlanet) and 201 (Planet) responses, providing flexibility for different API behaviors. The renaming pattern is consistently applied.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Style