-
Notifications
You must be signed in to change notification settings - Fork 4
DI‐Portal‐GS‐005 Ruleset Management for API Quality Check
Design Item ID: DI-Portal-GS-004
Design Item Name: Ruleset Management for API Quality Check
Related Design Items:
Related API:
- Get a list of rulesets (GET api/v1/rulesets)
- Create a new ruleset (POST api/v1/rulesets)
- Get ruleset metadata (GET /api/v1/rulesets/{id})
- Delete a ruleset (DELETE /api/v1/rulesets/{id})
- Get activation history for a ruleset (GET /api/v1/rulesets/{id}/activation)
- Activate a ruleset (POST /api/v1/rulesets/{id}/activation)
- Download Spectral ruleset file (GET /api/v1/rulesets/{id}/data)
Revision History:
| Date | Description |
|---|---|
| 12.05.2025 | initial version for https://github.com/Netcracker/qubership-apihub/issues/118 / https://github.com/Netcracker/qubership-apihub/issues/117 |
This functionality enables system administrators to manage Spectral rulesets used to lint OpenAPI specifications and show the result (for more information see TBD) in APIHUB. Linting is performed by the qubership-api-linter-service. The system administrator can manage rulesets against which the system will validate OpenAPI specifications. Rulesets are organized by API type (OpenAPI 3.0, OpenAPI 3.1). When the Linter Service is enabled, a new system user visiting the Ruleset Management tab for the first time will see one default out-of-the-box (OOB) rulesets for each supported API type, with one active ruleset per API type. This default rulesets is used automatically to validate all newly published OpenAPI documents unless the administrator activates a different one.
- The public ruleset URL must end with the .yaml extension to be correctly recognized by Spectral CLI and VSCode extension. If the URL does not end with .yaml, users may encounter an error.
- qubership-api-linter-service always has at least one ruleset and exactly one active ruleset; i.e. there is no state of the service where no rulesets exist or all existing rulesets are inactive.
- User navigates to APIHUB Portal Settings → Ruleset Management tab.
Precondition: qubership-api-linter-service must be enabled. The system verifies if the qubership-api-linter-service is enabled:
- API to check of linter service is enabled - GET /system/info:
- if linterEnabled = true, then it means linter service is enabled.
- If the service is disabled, the Ruleset Management tab is not shown, and the functionality is effectively disabled.
To view list of existing rulesets:
- User clicks Ruleset Management tab in Portal settings.
- The system opens Ruleset Management page and shows API type selector dropdown.
- User can select different API types from the dropdown to filter rulesets.
- The system shows the following information in the table for the selected API type:
- Ruleset Name - A unique name for the ruleset.
- Activation History - Historical active periods displayed as date ranges
- The system shows only the latest 100 activation records.
- Status - Current state of the ruleset:
- Active — Currently used for validating newly published OpenAPI specifications.
- Inactive — Not currently in use; available for activation.
- API to show list of all rulesets - GET /api/v1/rulesets. Rulesets in the response are sorted as follows:
- First, active ruleset.
- Second, rulesets with no activation history, sorted by creation date/time in descending order.
- Then, rulesets with activation history, sorted by last activation date/time in descending order.
qubership-api-linter-service provides OOB ruleset which is active by default.
To create new ruleset:
- User clicks [Add New Ruleset] button while viewing rulesets for a specific API type.
- System opens Create Ruleset popup with title "Create Ruleset for [API Type]" (e.g., "Create Ruleset for OAS 3.1"):
- Ruleset Name (required field)
- Ruleset File (required field, the field allows the user to select YAML file from local filesystem)
- User fills the required fields and clicks Create button.
- System creates new ruleset. New ruleset has Inactive status.
- API to create new ruleset - POST /api/v1/rulesets
- System shows the newly created ruleset in the Ruleset Management table for the current API type view.
To activate a ruleset:
- User hovers over ruleset in Active status.
- The system shows disabled Activate button and shows tooltip on button hover: "The ruleset is already active".
- User hovers over ruleset in Inactive status and clicks Activate button.
- System displays a confirmation dialog with the message: "Activating this ruleset will automatically deactivate the currently active one. Do you want to proceed?"
- User clicks the [Proceed] button in the confirmation dialog to confirm.
- System sets the chosen ruleset status to "Active", automatically changing the status of the previously active ruleset to "Inactive".
- API to activate the selected ruleset - POST /api/v1/rulesets/{id}/activation.
- System refreshes the page and shows updated state of rulesets.
To delete a ruleset:
- User hovers over an ruleset from the ruleset list.
- The system checks if the ruleset can be deleted:
- API to check if the ruleset can be deleted - GET /api/v1/rulesets:
- if canBeDeleted = false, then it cannot be deleted. There are two criteria that must be met delete ruleset:
- ruleset is in inactive status AND
- currently no package version revision exists that was validated against this ruleset
- if canBeDeleted = false, then it cannot be deleted. There are two criteria that must be met delete ruleset:
- API to check if the ruleset can be deleted - GET /api/v1/rulesets:
- If the ruleset cannot be deleted and its current status is active, the system disables Delete button and show the following tooltip on button hover: "Active ruleset cannot be deleted"
- If the ruleset cannot be deleted and its current status is inactive, the system disables Delete button and show the following tooltip on button hover: "The ruleset cannot be deleted due to existing versions that have been validated against this ruleset".
- If the ruleset can be deleted, then user clicks the [Delete] button.
- The system displays a confirmation prompt: “Delete ruleset?”
- User clicks the [Delete] button in the confirmation dialog to confirm the deletion.
- The system deletes the selected ruleset.
- API to delete ruleset - DELETE /api/v1/rulesets/{id}:
- <id> - id of the selected ruleset.
- API to delete ruleset - DELETE /api/v1/rulesets/{id}:
To download a ruleset original file:
- User hover over a ruleset from the Ruleset Management table.
- User clicks [Download] icon.
- System downloads the original YAML ruleset file to the user's local machine.
- API call to retrieve the original ruleset file - GET /api/v1/rulesets/{id}/download
- inlineContent = false
- <id> - id of the selected ruleset
- API call to retrieve the original ruleset file - GET /api/v1/rulesets/{id}/download
To get public link to ruleset (inline content):
- User hover over a ruleset from the Ruleset Management table.
- User clicks [Copy Public URL] icon.
- The system (client) generates a public URL according to the following format: "https://<current_server>/api/v1/rulesets/{id}/download", where <id> is id of current ruleset.
- API to access ruleset file content - GET /api/v1/rulesets/{id}/data
- inlineContent = true
- <id> - id of the selected ruleset
- API to access ruleset file content - GET /api/v1/rulesets/{id}/data
- UI for ruleset management is available only for system administrator user.
- API for ruleset creation, activation, deletion are available only for system administrator user.
- API to download ruleset / get public link to ruleset is public API without any authorization.
Processes description
Technical articles
Design Items
- Navigation to APIHUB (log in / log out)
- Create Workspace
- Create Group
- Create Package
- Favorite packages, dashboards, groups, workspaces
- Shared Packages
- Activity History in Main Page
- Personal private workspace
- Version summary
- Revision History
- Package Activity History
- Manage Manual Operations Group
- Export Operations Group (reduced source specifications)
- Export Operations Group (combined specification)
- Export List of Operations in Excel
- Search and Filter Operations
- List of Operations
- List of Operations Groups
- Manage REST Path Prefix Group
- Activity History
- List of Deprecated Operations
- Export List of Changes in Excel
- Human‐readable description for deprecated items for OpenAPI 3.0
- List of Documents
- OpenAPI Document Overview
- Copy Package Version
- Export Package Version
- Export Document from Package Version
- Export List of Deprecated Operations in Excel
- API Quality Validation Result
- Export of discrepancy analysis results for arbitrary package versions in Excel
- AI Recommendations Tab
- General Settings
- Package versions list
- Access Tokens Management
- Delete Package
- Default Release Version
- Define Release Version Pattern