Feat/api v3 filters no reflect#4146
Closed
tothandras wants to merge 5 commits intomainfrom
Closed
Conversation
Contributor
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (60)
📝 WalkthroughWalkthroughThis PR implements Kong AIP-160-style deepObject query-parameter filtering for OpenMeter v3 list endpoints. It adds comprehensive documentation, new filter type definitions, parsing and conversion logic, updates TypeSpec specifications, and refactors handlers/adapters to integrate the new filtering system across the API surface. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Handler as HTTP Handler
participant Parser as filters.Parse
participant Converter as Converter<br/>(FromAPIFilter*)
participant Adapter as Adapter
participant Ent as Ent ORM
Client->>Handler: GET /api/v3/customers?filter[name][contains]=acme<br/>filter[labels][eq]=env:prod
Handler->>Parser: Parse(url.Values, ¶ms.Filter)
Parser->>Parser: Extract filter[name], filter[labels]<br/>from deepObject query keys
Parser->>Parser: Dispatch by type: StringFieldFilter
Parser->>Handler: params.Filter populated
Handler->>Converter: FromAPIFilterString(params.Filter.Name)
Converter->>Converter: Map API operators<br/>(Contains → Contains)
Converter->>Handler: *filter.FilterString
Handler->>Converter: FromAPIFilterString(params.Filter.Labels)
Converter->>Handler: *filter.FilterString
Handler->>Adapter: ListCustomers(ctx, req)
Adapter->>Ent: input.Name.Select("name")
Ent->>Ent: Returns func(*sql.Selector)<br/>with ILIKE predicate
Adapter->>Ent: Apply selector to query
Adapter->>Ent: Build WHERE clauses<br/>for all filters
Ent->>Ent: Execute SQL query
Ent->>Adapter: Customer records
Adapter->>Handler: ListCustomersResponse
Handler->>Client: 200 OK + filtered results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches📝 Generate docstrings
🧪 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes #(issue)
Notes for reviewer
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation