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

feat(type-safe-api): generate infinite query hooks for smithy operations with paginated trait #531

Merged
merged 1 commit into from
Aug 13, 2023

Conversation

cogwirrel
Copy link
Member

Instead of through the jsonAdd escape hatch, we now support using the @paginated trait in Smithy to generate useInfiniteQuery hooks in the TypeScript React Hooks library. The escape hatch will still work, since we still support specifying x-paginated for the OpenAPI use case.

We achieve this by reading traits from the Smithy JSON model generated as part of the openapi projection (the model build task), and injecting them into the OpenAPI spec prior to code generation.

This could be replaced once smithy-lang/smithy#1609 is merged and released by implementing our own @paginated trait which Smithy renders into the OpenAPI spec, though I think I prefer the solution of injecting all traits into the OpenAPI spec as it works without requiring users to change their model.

…ons with paginated trait

Instead of through the "jsonAdd" escape hatch, we now support using the @paginated trait in
Smithy to generate useInfiniteQuery hooks in the TypeScript React Hooks library. The escape
hatch will still work, since we still support specifying "x-paginated" for the OpenAPI use
case. We achieve this by reading traits from the Smithy JSON model generated as part of the
openapi projection (the model build task), and injecting them into the OpenAPI spec prior
to code generation.
@agdimech agdimech merged commit 82677b3 into mainline Aug 13, 2023
@agdimech agdimech deleted the feat/tsapi-smithy-paginated-trait branch August 13, 2023 23:38
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