Skip to content

Create API-Registry#973

Open
ruwinirathnamalala wants to merge 14 commits intobuerokratt:devfrom
rootcodelabs:918/Create-API-Registry
Open

Create API-Registry#973
ruwinirathnamalala wants to merge 14 commits intobuerokratt:devfrom
rootcodelabs:918/Create-API-Registry

Conversation

@ruwinirathnamalala
Copy link
Copy Markdown
Collaborator

@ruwinirathnamalala ruwinirathnamalala commented Apr 21, 2026

Task: #918

Overview

Implements the API Registry page — a centralized view for managing, testing, and monitoring common endpoints. Changes span the GUI frontend, Ruuter DSL flows, Resql SQL queries, and Liquibase database migrations.

This PR doesn't have implementation related to the "Create new endpoint" button and "Edit" button. It will be implemented in a separate task (#928).

*Reused some changes from an existing PR: #937

GUI (GUI/src/)

New page: API Registry

  • pages/ApiRegistryPage.tsx — Main page with search bar, "Create new endpoint" button, delete confirmation modal, and orchestration of all actions (test, copy, edit, delete)
  • pages/ApiRegistryPage/ApiRegistryTable.tsx — Sortable, paginated data table with:
    • Name column: full-width truncation with ellipsis; hover tooltip showing full name, endpoint type, URL, method, parameters (with types), headers, and body
    • Last tested column: formatted timestamp (dd.MM.yyyy HH:mm:ss), --- in red when never tested; defaults to descending sort on first click
    • Status column: green check / red cross icon + HTTP status code; sorts by status code (200 → 400 → --- last); --- for untested
    • Schema column: captured / not-captured icon; defaults to descending (captured first) on first click
    • Actions column: Copy, Test, Edit, Delete buttons (appearance="text")
    • Sort icons displayed left of column headers; unsorted columns show a neutral indicator
  • pages/ApiRegistryPage/columns.tsxformatLastTest date formatter
  • store/api-registry.store.ts — Zustand store handling:
    • Endpoint loading with server-side sorting, pagination, and search
    • Test endpoint flow (sends full request object; reloads from DB after; toast based on actual verification status)
    • Copy endpoint (timestamp-based name generation, strips previous timestamps on re-copy, cleans testValue from definitions, serviceId fallback)
    • Delete endpoint
    • verificationMap for keeping test metadata separate from endpoint data
  • resources/api-constants.ts — Added testEndpointUrl, getCommonEndpoints URL constants
  • resources/routes-constants.ts — Registered /api-registry route
  • RootComponent.tsx — Added route entry for ApiRegistryPage
  • i18n/en/common.json, i18n/et/common.json — Added all apiRegistry.* translation keys (column headers, action labels, toast messages)

Ruuter (DSL/Ruuter/)

POST/services/test-endpoint.yml (new)

New flow for testing an endpoint:

  • Accepts { endpointId, request: { url, method, headers, params, body } }
  • Routes to the correct HTTP method handler (GET, POST, PUT, DELETE)
  • Evaluates the response: determines success (2xx), handles 204 no-body case, optionally captures the response schema
  • Saves result to DB via Resql (test_endpoint), storing verificationStatus, lastStatusCode, and responseSchema

POST/endpoints/common.yml (modified)

The existing create/update endpoint flow is used by the copy action.

Resql (DSL/Resql/services/POST/endpoints/)

get_common_endpoints.sql (modified)

  • Added to SELECT: service_id, verification_status, last_status_code, last_test_at, response_schema_captured
  • Server-side sorting via CASE WHEN :sorting = '...' pattern for:
    • created_at, name
    • lastTestAt
    • lastStatusCode (with name as secondary sort)
    • schemaCaptured (with name as secondary sort)
  • Search filter: LOWER(name) LIKE LOWER('%' || :search || '%')
  • Pagination with total_pages window function calculation

test_endpoint.sql (new)

UPDATE query saving test results: last_test_at, verification_status, last_status_code, and conditionally response_schema / response_schema_captured.

create_endpoint.sql (modified)

Uses NULLIF(:serviceId, '')::uuid to safely handle optional service_id.

Liquibase Migrations (DSL/Liquibase/)

Migration Change
20260417121000_add-endpoint-test-fields Adds last_test_at, verification_status, last_status_code, response_schema_captured, response_schema columns to endpoints table
20260421121000_make_service_id_nullable_in_endpoint_table Drops NOT NULL constraint from service_id to support endpoints without an associated service

Both migrations include rollback scripts.

@sonarqubecloud
Copy link
Copy Markdown

@matKlju matKlju linked an issue Apr 23, 2026 that may be closed by this pull request
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create API-Registry

1 participant