BloodHound icon indicating copy to clipboard operation
BloodHound copied to clipboard

fix(ApiExplorer): Modified the predicate filter files to use type string. BED-6051

Open RaymondLaubert opened this issue 4 weeks ago โ€ข 1 comments

Description

Modified the predicate filters to use type string instead of integer and boolean. This enabled the predicates to be read correctly instead of throwing a validation error when entering a value such as, "eq:7".

Motivation and Context

Resolves BED-6051

Why is this change required? What problem does it solve?

The change is required to correctly enable the use of predicates in fields that traditionally are looking for an integer or boolean.

How Has This Been Tested?

Manually tested making requests using the API Explorer, using with and without predicates.

Screenshots (optional):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [x] I have met the contributing prerequisites
    • Assigned myself to this PR
    • Added the appropriate labels
    • Associated an issue: https://github.com/SpecterOps/BloodHound/issues/672
    • Read the Contributing guide: https://github.com/SpecterOps/BloodHound/wiki/Contributing
  • [x] I have ensured that related documentation is up-to-date
    • Open API docs
    • Code comments (GoDocs / JSDocs)
  • [x] I have followed proper test practices
    • Added/updated tests to cover my changes
    • All new and existing tests passed

Summary by CodeRabbit

  • Changes
    • API filter parameters for integer and boolean fields now accept string-formatted predicates (e.g., "eq:7", "gt:3", "eq:true") instead of native integer/boolean values.
    • Examples added to the API schema to illustrate the new string predicate formats for filtering.

โœ๏ธ Tip: You can customize this high-level summary in your review settings.

RaymondLaubert avatar Dec 01 '25 16:12 RaymondLaubert

Walkthrough

OpenAPI predicate filter schemas changed types from native primitives (integer, boolean) to string across source YAML files and the generated OpenAPI JSON; examples/examples block were added for the new string-based predicate formats.

Changes

Cohort / File(s) Change Summary
Source schema updates
packages/go/openapi/src/schemas/api.params.predicate.filter.integer.yaml, packages/go/openapi/src/schemas/api.params.predicate.filter.integer-strict.yaml, packages/go/openapi/src/schemas/api.params.predicate.filter.boolean.yaml
Changed type from integer/boolean to string; added examples or example entries (e.g., eq:7, gt:3, eq:true) while descriptions remained unchanged.
Generated OpenAPI documentation
packages/go/openapi/doc/openapi.json
Updated compiled schema entries (api.params.predicate.filter.integer, api.params.predicate.filter.integer-strict, api.params.predicate.filter.boolean) to type: "string" and included example(s)/examples reflecting predicate syntax.

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 minutes

  • Homogeneous, small edits across schema files and the generated spec.
  • Pay attention to:
    • api.params.predicate.filter.integer.yaml โ€” examples added (equals/greaterthan).
    • api.params.predicate.filter.integer-strict.yaml โ€” example eq:7.
    • api.params.predicate.filter.boolean.yaml โ€” example eq:true.
    • packages/go/openapi/doc/openapi.json โ€” ensure generated spec consistency and no leftover type mismatches.

Suggested reviewers

  • specter-flq
  • urangel

Poem

๐Ÿฐ
I hopped through schemas, light and spry,
Turned numbers and truths into quoted sky.
Examples tucked in pockets neat,
Predicates now speak in strings so sweet.
โœจ

Pre-merge checks and finishing touches

โœ… Passed checks (3 passed)
Check name Status Explanation
Title check โœ… Passed The title clearly and specifically describes the main change: modifying predicate filter files to use string type, with the ticket reference BED-6051.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check โœ… Passed The PR description provides clear context, motivation, testing details, and includes the associated Jira ticket (BED-6051) with most checklist items completed.
โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch BED-6051/ApiExplorer-Predicates

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.

coderabbitai[bot] avatar Dec 01 '25 16:12 coderabbitai[bot]