Skip to content

feat(api): support more filter types in parser#4389

Open
tothandras wants to merge 1 commit into
mainfrom
feat/api-time-filter
Open

feat(api): support more filter types in parser#4389
tothandras wants to merge 1 commit into
mainfrom
feat/api-time-filter

Conversation

@tothandras
Copy link
Copy Markdown
Contributor

@tothandras tothandras commented May 19, 2026

Summary by CodeRabbit

  • New Features

    • Timestamp filtering added: accept RFC-3339 date-time values for precise query filtering. Operator-style keys for timestamp filters are not supported and return a clear error.
  • Tests

    • Added tests for parsing and validation: valid/invalid RFC-3339 inputs, correct pointer parsing into timestamp fields, nil-preservation when omitted, and proper error messages for unsupported formats.

Review Change Stack

@tothandras tothandras requested a review from a team as a code owner May 19, 2026 18:11
@tothandras tothandras added the release-note/feature Release note: Exciting New Features label May 19, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 86c7ff5c-f2d0-4dc1-bcde-106eabc5b31b

📥 Commits

Reviewing files that changed from the base of the PR and between a098615 and 05be25f.

📒 Files selected for processing (5)
  • api/spec/packages/aip/src/test.tsp
  • api/v3/filters/parse.go
  • api/v3/filters/parse_test.go
  • api/v3/test/filters_test.go
  • api/v3/test/openapi.test.yaml
🚧 Files skipped from review as they are similar to previous changes (5)
  • api/spec/packages/aip/src/test.tsp
  • api/v3/test/openapi.test.yaml
  • api/v3/filters/parse.go
  • api/v3/filters/parse_test.go
  • api/v3/test/filters_test.go

📝 Walkthrough

Walkthrough

Adds a timestamp filter to FieldFilters, wires it into OpenAPI and test fixtures, and extends filter parsing to support pointer types implementing encoding.TextUnmarshaler (e.g., *time.Time) with unit and integration tests.

Changes

Timestamp Filter Support

Layer / File(s) Summary
Timestamp filter schema definition
api/spec/packages/aip/src/test.tsp, api/v3/test/filters_test.go, api/v3/test/openapi.test.yaml
FieldFilters gains timestamp?: Shared.DateTime; test fixtures and OpenAPI schema add the timestamp filter property.
TextUnmarshaler pointer parsing implementation
api/v3/filters/parse.go
Adds encoding import, a cached reflect.Type for encoding.TextUnmarshaler, updates parseFiltersValue to detect pointer types implementing TextUnmarshaler, rejects operator-style keys for those fields, and adds parseTextUnmarshalerPtr to unmarshal filter[field]=value into *T.
Timestamp parsing unit tests
api/v3/filters/parse_test.go
Test struct gains Timestamp *time.Time; TestParse_TimestampPtr verifies RFC-3339 parsing, nil when omitted, invalid-value error includes filter[timestamp], and operator-style key rejection.
Integration tests for timestamp validation and parsing
api/v3/test/filters_test.go
Adds table-driven validation cases for multiple valid/invalid RFC-3339 variants and a parse test asserting filter[timestamp] populates the target *time.Time.

Sequence Diagram

No sequence diagram needed—the change is internal parsing and schema/test updates and does not introduce a multi-component sequential flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • solkimicreb
  • borosr
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding support for timestamp filter parsing via TextUnmarshaler interface, which is indeed a new filter type capability in the parser.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/api-time-filter

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tothandras tothandras force-pushed the feat/api-time-filter branch from 65ffd13 to a098615 Compare May 19, 2026 18:16
@tothandras tothandras enabled auto-merge (squash) May 19, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/feature Release note: Exciting New Features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant