Skip to content

Refactor issue type handling#87

Open
tembo-darren[bot] wants to merge 1 commit intomainfrom
tembo/refactor-issue-type-handling
Open

Refactor issue type handling#87
tembo-darren[bot] wants to merge 1 commit intomainfrom
tembo/refactor-issue-type-handling

Conversation

@tembo-darren
Copy link
Copy Markdown

@tembo-darren tembo-darren bot commented Apr 6, 2026

Summary

Refactored issue type handling to use only two canonical handler types: query (read operations) and mutation (write operations). Removed legacy HTTP method-specific types (get, post, put, delete, patch) from the enum while maintaining backwards compatibility through mapping.

Key Changes

Rust Codegen (rapid-web-codegen)

  • Simplified RouteHandler enum to only Query and Mutation variants
  • Updated handler parsing to map legacy HTTP methods to canonical types
  • Replaced verbose if-else chains with loop-based validation using VALID_HANDLER_NAMES constant
  • Improved error handling with unreachable!() for invalid handler types

Rust Web (rapid-web)

  • Removed individual HandlerRequestType variants for HTTP methods
  • Added HandlerRequestType::from_function_name() for parsing with deprecation warnings
  • Added HandlerRequestType::as_str() for canonical string representation
  • Updated type generation to use the new methods instead of match expressions
  • Changed default handler type from "get" to "query"

TypeScript Client (rapid-react)

  • Simplified SupportedHTTPMethods type to only 'query' | 'mutation'
  • Extracted URL resolution logic into resolveUrl() helper function
  • Consolidated switch cases: 'query' and 'mutation' now handle all HTTP methods
  • Removed individual type definitions for legacy HTTP methods
  • Updated test fixtures to use canonical types

Documentation

  • Added comprehensive comments explaining the canonical types and deprecation path
  • Clarified that legacy names are accepted for backwards compatibility but emit warnings
  • Documented the mapping: query/get → Query, mutation/post/put/delete/patch → Mutation

Want tembo to make any changes? Add a review or comment with @tembo and i'll get back to work!

View on Tembo View Agent Settings View on slack

@tembo-darren tembo-darren bot added the tembo Pull request created by Tembo label Apr 6, 2026
@tembo-darren tembo-darren bot requested a review from DarrenBaldwin07 April 6, 2026 15:15
@tembo-darren
Copy link
Copy Markdown
Author

tembo-darren bot commented Apr 6, 2026

Requesting review from @DarrenBaldwin07 who has experience with the following files modified in this PR:

  • crates/rapid-web/src/util.rs
  • packages/rapid-react/src/bolt.ts
  • packages/rapid-react/src/types.ts
  • crates/rapid-web/src/shift/util.rs
  • crates/rapid-web-codegen/src/lib.rs
  • crates/rapid-web-codegen/src/utils.rs
  • crates/rapid-web/src/shift/generate.rs
  • packages/rapid-react/src/__tests__/bolt.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tembo Pull request created by Tembo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants