Skip to content

API Registry - create/edit endpoint modal#983

Open
ruwinirathnamalala wants to merge 14 commits intobuerokratt:devfrom
rootcodelabs:928/create_edit_endpoint_modal
Open

API Registry - create/edit endpoint modal#983
ruwinirathnamalala wants to merge 14 commits intobuerokratt:devfrom
rootcodelabs:928/create_edit_endpoint_modal

Conversation

@ruwinirathnamalala
Copy link
Copy Markdown
Collaborator

#928

Overview

Implements the create and edit flows for both Custom and OpenAPI endpoints across the API Registry page, extending the existing modal used in Service Flow. Changes span the GUI frontend, Ruuter DSL flows, Resql SQL queries, and a Liquibase database migration.

GUI (GUI/src/)

Endpoint Create / Edit Modal

  • components/Flow/EdgeTypes/AddEndpointModal.tsx — Implements both create and edit flows:
    • Create flow: opens a blank modal; user fills in description, selects endpoint type (Custom or OpenAPI), configures params, tests the URL, and saves — persisting the endpoint to the database
    • Edit flow: pre-fills existing endpoint data (description, params, test results); save is enabled without requiring re-testing
    • Test URL results are persisted to the database for both Custom and OpenAPI endpoint types
    • Added onSaveSuccess callback — API Registry list refreshes automatically after a successful create or edit
    • Save is blocked if validation fails: any named param missing a description, or any mandatory param missing a value

OpenAPI Endpoint

  • components/ApiEndpointCard/Endpoints/OpenAPI/index.tsx:
    • Fetch spec URL → select endpoint from dropdown → configure params → test → save
    • Description field pre-fills correctly when editing an existing endpoint
    • Param type resolves correctly for OpenAPI 3.x specs where type is nested under schema (e.g. param.schema.type)
    • Spec-defined params are read-only — type dropdown is locked and delete is disabled to prevent invalid modifications
    • Replaced mount-only useEffect for description initialisation with a useState initializer

Custom Endpoint

  • components/ApiEndpointCard/Endpoints/Custom/index.tsx — Name, description, params, and test URL fully wired for both create and edit

Mandatory Parameters Feature

  • components/ApiEndpointCard/Endpoints/RequestVariables/MandatoryCell/index.tsx (new) — Yes/No dropdown in the Params tab for marking parameters as mandatory
  • components/ApiEndpointCard/Endpoints/RequestVariables/columns.tsx — Added Mandatory column for Params tab
  • components/ApiEndpointCard/Endpoints/RequestVariables/index.tsx — Violation tracking for save blocking
  • Spec-required params are automatically marked as mandatory on load

API Registry

  • pages/ApiRegistryPage.tsx — "Create new endpoint" button opens the create modal; list refreshes after successful save
  • pages/ApiRegistryPage/ApiRegistryTable.tsx — Param tooltip now displays param type: name (TYPE) : value

Service Flow Sidebar

  • store/api-registry.store.ts — Endpoint mapping now includes description field from API response
  • Endpoint list now shows all non-deleted endpoints regardless of service — enables reuse across services

i18n (i18n/en/common.json, i18n/et/common.json)

Added translation keys: endpoints, fetchEndpointsSuccess, paramMandatory, mandatoryYes, mandatoryNo, mandatoryNameValueRequired, nameTypeDescriptionRequired

Ruuter (DSL/Ruuter/)

POST/services/service-by-id.yml (modified)

  • get_endpoints_by_service_id step now calls get_all_endpoints — no longer filters by service_id
  • Removed id from request body

POST/services/create-endpoint.yml (modified)

  • Added description field to the declaration and request body (description: ${incoming.body.description ?? ''})

POST/services/update-endpoint.yml (modified)

  • Added description field to the declaration and request body (description: ${incoming.body.description ?? ''})

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

get_all_endpoints.sql (new)

Returns all non-deleted endpoints with search filter and user-preference ordering. No service_id or is_common filter — used by the service flow sidebar to show all available endpoints.

get_common_endpoints.sql (modified)

Added description to SELECT.

get_endpoints_by_service_id.sql (modified)

Added description to SELECT.

create_endpoint.sql (modified)

Added description to INSERT columns and values.

update_endpoint.sql (modified)

Added description = :description to the UPDATE SET clause.

Liquibase Migrations (DSL/Liquibase/)

Migration Change
20260428120000_add-description-to-endpoints Adds description TEXT NOT NULL DEFAULT '' column to the endpoints table

Includes rollback script.

@matKlju matKlju linked an issue May 4, 2026 that may be closed by this pull request
15 tasks
@matKlju matKlju requested a review from Thirunayan22 May 4, 2026 06:11
});

const initialHistoryState = {
nodes: JSON.parse(JSON.stringify(nodes)),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The structuredClone approach failed with DataCloneError because flow nodes contain function references (onDelete, onEdit, setClickedNode, update), which cannot be cloned by the structured clone algorithm. The JSON.parse(JSON.stringify()) method is used here to strip functions from nodes before saving to history, which are then manually re-attached during undo/redo operations.

@matKlju matKlju mentioned this pull request May 5, 2026
15 tasks
@matKlju
Copy link
Copy Markdown
Collaborator

matKlju commented May 5, 2026

NB!!!
Current PR #983 has to be merged BEFORE #989 PR

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
8.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

Endpoint Creation/ Edit Modal

2 participants