Skip to content

feat: refactor to strongly typed explicit parameters and explicit error handling#8

Open
cdvelop wants to merge 4 commits intomainfrom
feat-typed-interfaces-6641959686492189938
Open

feat: refactor to strongly typed explicit parameters and explicit error handling#8
cdvelop wants to merge 4 commits intomainfrom
feat-typed-interfaces-6641959686492189938

Conversation

@cdvelop
Copy link
Copy Markdown
Collaborator

@cdvelop cdvelop commented Mar 3, 2026

Implement the refactoring proposed in docs/PLAN.md to introduce strongly typed parameters for core CRUD interfaces, removing the problematic data ...any pattern and implicitly handled errors.

Changes Include:

  1. Interfaces Update: Replace variadic signatures in interfaces.go with Create(payload any) (any, error), Read(id string) (any, error), List() (any, error), Update(payload any) (any, error), Delete(id string) error.
  2. Logic Fixes: Re-engineered CallHandler payload extraction to properly ignore internal injection structures like *http.Request and find the accurate request payload.
  3. Dependency Clean-Up: Completely uncoupled the CRUDP core from any default codec (removed tinywasm/binary) and configured testing exclusively using tinywasm/json as requested.
  4. Refactoring Examples and Docs: Adapted all accompanying example handlers, test cases, and inline markdown snippets to use the correct signatures and return values. Documented the userCRUD wrapper pattern.

PR created automatically by Jules for task 6641959686492189938 started by @cdvelop

… returns

- Refactored `Creator`, `Reader`, `Updater`, `Deleter`, and `DataValidator` interfaces to replace variadic `data ...any` with explicitly typed parameters (`payload any`, `id string`) and strict error returns.
- Added `List() (any, error)` to `Reader` interface to resolve ambiguity in generic reads.
- Updated `CallHandler` logic to correctly iterate, filter out system injected objects (`*http.Request`, `context.Context`), and extract the precise payload before delegation.
- Removed `github.com/tinywasm/binary` as the default codec in `crudp.go` and from the dependencies, enforcing explicit codec configuration.
- Migrated tests (`shared_test.go`, `integration_stlib_test.go`) to utilize `github.com/tinywasm/json`.
- Updated docs, example applications, and integration test mocks to reflect the new API and "Handler Wrapper" design pattern.

Co-authored-by: cdvelop <44058491+cdvelop@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant