Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/.gitbook/assets/v1-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12074,7 +12074,7 @@ components:
description: A list of issues
total:
type: number
description: The number of results returned
description: The total number of dependencies in the organization matching the applied filters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide some supporting documentation for this. (code snippets, example API calls with/without filters)

Copy link
Contributor Author

@fsargent fsargent Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Analysis

In registry/src/web/routes/api/v1/external/org/dependencies.ts:
Line 273: total: count, — the count variable is returned as total
Lines 230-249: count comes from Projects.getProjectsAndDependencies()

In dependencies.ts (lines 188-199): count is computed by ProjectSnapshotsStorage.countMonitorDependencies()

In monitor-dependencies.ts
(lines 829-834): the SQL is COUNT(DISTINCT("full")) AS "count" — a distinct count of all dependencies matching the filters


Tracing how filters are applied in the dependencies API to confirm whether total reflects them.

The total field accounts for filters

Filter flow

  1. API endpoint (dependencies.ts lines 222-229): extracts filters from the request body
  2. getProjectsAndDependencies() (line 243): passes ...usedFilters to the database layer
  3. countMonitorDependencies() (lines 188-199): receives the filters
  4. generateDependenciesWhereSQL() (lines 709-764): builds the WHERE clause from:
    • dependencies (lines 728-731)
    • licenses (lines 733-739)
    • severity (lines 747-756)
    • depStatus (lines 741-745)
    • monitorIds (lines 723-726)

SQL query

SELECT COUNT(DISTINCT("full")) AS "count" 
FROM monitor_dependencies 
WHERE ${where.query}

The where.query includes all applied filters, so the count reflects only dependencies matching those filters.

Example

  • No filters: total = 6024 (all dependencies in the org)
  • With severity filter: total = 150 (dependencies with high-severity issues)
  • With license filter: total = 50 (dependencies with specific licenses)

Documentation update

The description should be:

"The total number of dependencies in the organization matching the applied filters"

This is more accurate than "The number of results returned" because it reflects the filtered total, not the current page size.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant trying out the actual API not some AI-generated tokens

Dependenciesfilters:
title: Dependenciesfilters
type: object
Expand Down