-
Notifications
You must be signed in to change notification settings - Fork 20
ECOPROJECT-3787 | feat: Add filtering, sorting, and pagination to Assessments API #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e09e015
0676741
dbe0a34
2e603fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: "2" | ||
|
|
||
| run: | ||
| skip-dirs: | ||
| - agent-v2 | ||
| - bin | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -306,18 +306,30 @@ clean: | |
| - rm -f -r bin | ||
|
|
||
| ##################### "make lint" support start ########################## | ||
| GOLANGCI_LINT_VERSION := v1.64.8 | ||
| GOLANGCI_LINT_VERSION := v2.10.1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: golangci-lint v1 → v2 migration (breaking changes highlights)1) Use the built-in config migrator
2) Config schema / structure changes
3) Defaults that can change behavior
4) Removed/renamed config options
5) Command/flag breaking changes
Primary references: official Migration Guide [1] and v2.0.0 changelog entry [2]. Major version bump (v1.64.8 → v2.10.1) — run
🤖 Prompt for AI Agents |
||
| GOLANGCI_LINT := $(GOBIN)/golangci-lint | ||
|
|
||
| # Download golangci-lint locally if not already present | ||
| # Run every time: if installed version != required, remove binary so $(GOLANGCI_LINT) will re-install | ||
| .PHONY: check-golangci-lint-version | ||
| check-golangci-lint-version: | ||
| @if [ -f '$(GOLANGCI_LINT)' ]; then \ | ||
| installed=$$('$(GOLANGCI_LINT)' version 2>/dev/null | sed -n 's/.*version \([0-9.]*\).*/\1/p' | head -1); \ | ||
| required=$$(echo '$(GOLANGCI_LINT_VERSION)' | sed 's/^v//'); \ | ||
| if [ -n "$$installed" ] && [ "$$installed" != "$$required" ]; then \ | ||
| echo "🔍 Installed golangci-lint $$installed != required $(GOLANGCI_LINT_VERSION), re-installing..."; \ | ||
| rm -f '$(GOLANGCI_LINT)'; \ | ||
| fi; \ | ||
| fi | ||
|
|
||
| # Download golangci-lint if not present | ||
| $(GOLANGCI_LINT): | ||
| @echo "🔍 Installing golangci-lint $(GOLANGCI_LINT_VERSION)..." | ||
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \ | ||
| @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \ | ||
| sh -s -- -b $(CURDIR)/bin $(GOLANGCI_LINT_VERSION) | ||
| @echo "✅ 'golangci-lint' installed successfully." | ||
|
|
||
| # Run linter | ||
| lint: $(GOLANGCI_LINT) | ||
| lint: check-golangci-lint-version $(GOLANGCI_LINT) | ||
| @echo "🔍 Running golangci-lint..." | ||
| @$(GOLANGCI_LINT) run --timeout=5m | ||
| @echo "✅ Lint passed successfully!" | ||
|
|
@@ -332,10 +344,10 @@ $(MOQ): | |
| @go install github.com/matryer/moq@latest | ||
| @echo "✅ 'moq' installed successfully." | ||
|
|
||
| # Code generation | ||
| # Code generation (exclude agent-v2 submodule) | ||
| generate: $(MOQ) | ||
| @echo "⚙️ Running go generate..." | ||
| @PATH="$(GOBIN):$$PATH" go generate -v $(shell go list ./...) | ||
| @PATH="$(GOBIN):$$PATH" go generate -v $(shell go list ./... | grep -v 'agent-v2' || true) | ||
| @echo "⚙️ Running mockgen script..." | ||
| @hack/mockgen.sh | ||
| @$(MAKE) format | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -377,7 +377,7 @@ paths: | |||||||||||||||||||||||||||||||||||
| get: | ||||||||||||||||||||||||||||||||||||
| tags: | ||||||||||||||||||||||||||||||||||||
| - assessment | ||||||||||||||||||||||||||||||||||||
| description: List assessments | ||||||||||||||||||||||||||||||||||||
| description: List assessments with filtering, sorting, and pagination | ||||||||||||||||||||||||||||||||||||
| operationId: listAssessments | ||||||||||||||||||||||||||||||||||||
| parameters: | ||||||||||||||||||||||||||||||||||||
| - name: sourceId | ||||||||||||||||||||||||||||||||||||
|
|
@@ -387,13 +387,56 @@ paths: | |||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||
| format: uuid | ||||||||||||||||||||||||||||||||||||
| - name: source | ||||||||||||||||||||||||||||||||||||
| in: query | ||||||||||||||||||||||||||||||||||||
| description: Filter assessments by source type (agent, inventory, rvtools) | ||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+390
to
+395
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding an The description documents valid values as 🛠️ Suggested fix - name: source
in: query
description: Filter assessments by source type (agent, inventory, rvtools)
required: false
schema:
type: string
+ enum: [agent, inventory, rvtools]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| - name: name | ||||||||||||||||||||||||||||||||||||
| in: query | ||||||||||||||||||||||||||||||||||||
| description: Filter assessments by name pattern (case-insensitive partial match) | ||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+396
to
+401
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a Without a length limit, a client could submit an extremely long string that translates into an expensive - name: name
in: query
description: Filter assessments by name pattern (case-insensitive partial match)
required: false
schema:
type: string
+ maxLength: 255📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| - name: sort | ||||||||||||||||||||||||||||||||||||
| in: query | ||||||||||||||||||||||||||||||||||||
| description: "Sort fields (format: 'field:direction', e.g., 'name:asc', 'created_at:desc'). Multiple sort fields can be specified." | ||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| type: array | ||||||||||||||||||||||||||||||||||||
| items: | ||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+402
to
+409
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add The 🛠️ Suggested fix schema:
type: array
+ maxItems: 5
items:
type: string📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| - name: page | ||||||||||||||||||||||||||||||||||||
| in: query | ||||||||||||||||||||||||||||||||||||
| description: "Page number (default: 1)" | ||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| type: integer | ||||||||||||||||||||||||||||||||||||
| minimum: 1 | ||||||||||||||||||||||||||||||||||||
| default: 1 | ||||||||||||||||||||||||||||||||||||
| - name: pageSize | ||||||||||||||||||||||||||||||||||||
| in: query | ||||||||||||||||||||||||||||||||||||
| description: "Items per page (default: 20, max: 100)" | ||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| type: integer | ||||||||||||||||||||||||||||||||||||
| minimum: 1 | ||||||||||||||||||||||||||||||||||||
| maximum: 100 | ||||||||||||||||||||||||||||||||||||
| default: 20 | ||||||||||||||||||||||||||||||||||||
| responses: | ||||||||||||||||||||||||||||||||||||
| "200": | ||||||||||||||||||||||||||||||||||||
| description: OK | ||||||||||||||||||||||||||||||||||||
| content: | ||||||||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| $ref: "#/components/schemas/AssessmentList" | ||||||||||||||||||||||||||||||||||||
| $ref: "#/components/schemas/AssessmentListResponse" | ||||||||||||||||||||||||||||||||||||
| "400": | ||||||||||||||||||||||||||||||||||||
| description: Bad Request | ||||||||||||||||||||||||||||||||||||
| content: | ||||||||||||||||||||||||||||||||||||
| application/json: | ||||||||||||||||||||||||||||||||||||
| schema: | ||||||||||||||||||||||||||||||||||||
| $ref: "#/components/schemas/Error" | ||||||||||||||||||||||||||||||||||||
| "401": | ||||||||||||||||||||||||||||||||||||
| description: Unauthorized | ||||||||||||||||||||||||||||||||||||
| content: | ||||||||||||||||||||||||||||||||||||
|
|
@@ -1573,6 +1616,28 @@ components: | |||||||||||||||||||||||||||||||||||
| items: | ||||||||||||||||||||||||||||||||||||
| $ref: "#/components/schemas/Assessment" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| AssessmentListResponse: | ||||||||||||||||||||||||||||||||||||
| type: object | ||||||||||||||||||||||||||||||||||||
| required: | ||||||||||||||||||||||||||||||||||||
| - assessments | ||||||||||||||||||||||||||||||||||||
| - total | ||||||||||||||||||||||||||||||||||||
| - page | ||||||||||||||||||||||||||||||||||||
| - pageCount | ||||||||||||||||||||||||||||||||||||
| properties: | ||||||||||||||||||||||||||||||||||||
| assessments: | ||||||||||||||||||||||||||||||||||||
| type: array | ||||||||||||||||||||||||||||||||||||
| items: | ||||||||||||||||||||||||||||||||||||
| $ref: "#/components/schemas/Assessment" | ||||||||||||||||||||||||||||||||||||
| page: | ||||||||||||||||||||||||||||||||||||
| type: integer | ||||||||||||||||||||||||||||||||||||
| description: Current page number | ||||||||||||||||||||||||||||||||||||
| pageCount: | ||||||||||||||||||||||||||||||||||||
| type: integer | ||||||||||||||||||||||||||||||||||||
| description: Total number of pages | ||||||||||||||||||||||||||||||||||||
| total: | ||||||||||||||||||||||||||||||||||||
| type: integer | ||||||||||||||||||||||||||||||||||||
| description: Total number of assessments matching the filter | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ClusterRequirementsRequest: | ||||||||||||||||||||||||||||||||||||
| type: object | ||||||||||||||||||||||||||||||||||||
| description: Request payload for calculating cluster requirements | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
golangci-lint v2 run.skip-dirs removed migration guide💡 Result:
In golangci-lint v2,
run.skip-dirswas removed (it had been deprecated since v1.57.0). You should exclude directories via exclusions paths instead. [1] (golangci-lint.run)What to change
Before (v1)
After (v2)
[1] (golangci-lint.run)
Recommended migration path
Run the built-in config migrator and then review the output:
It will update your config where possible (but won’t carry over deprecated/unknown fields and won’t migrate comments). [1] (golangci-lint.run)
Citations:
🌐 Web query:
golangci-lint v2 linters exclusions paths configuration schema💡 Result:
In golangci-lint v2, path-based “exclusions” for linters live under
linters.exclusions(notissues.exclude-dirs-use-default, which was removed and migrated tolinters.exclusions.paths). [1][3]JSON Schema (v2)
The v2 config can be validated against the official schema at:
https://golangci-lint.run/jsonschema/golangci.jsonschema.json[1][2]Also ensure your config declares the v2 format:
[1]
Linter exclusions: paths + rules (v2)
(Structure/field meanings shown in the v2 “Configuration File” docs.) [1]
Relative-path behavior (important for
paths/rules.path)By default, v2 evaluates relative paths relative to the config file, configurable via:
[1][4]
run.skip-dirsis removed in golangci-lint v2 config format —agent-v2andbinwill not be excluded.run.skip-dirswas deprecated since v1.57.0 and removed entirely in v2. The correct replacement islinters.exclusions.paths(andformatters.exclusions.pathsif using formatters). Withversion: "2", the currentrun.skip-dirsblock is silently ignored, so these directories will not be excluded.🔧 Proposed fix
🤖 Prompt for AI Agents