Skip to content

Path param support for endpoints#995

Open
ruwinirathnamalala wants to merge 28 commits into
buerokratt:devfrom
rootcodelabs:981/path_param_support_for_endpoints
Open

Path param support for endpoints#995
ruwinirathnamalala wants to merge 28 commits into
buerokratt:devfrom
rootcodelabs:981/path_param_support_for_endpoints

Conversation

@ruwinirathnamalala
Copy link
Copy Markdown
Collaborator

#981

Overview

Adds full support for path variable placeholders (e.g. {param}) in custom API endpoint URLs across the service flow canvas, API Registry, and the endpoint test/save flow. Previously, URLs containing {name} placeholders were sent raw to the backend, causing Spring's RestTemplate to throw Not enough variable values available to expand 'param'.

Changes

Types

  • Added paramType?: 'path' | 'query' to EndpointVariableData, RequestVariablesRowData, and RequestVariablesTableColumns to distinguish path variable placeholders from query string parameters throughout the data model

URL Parsing (Custom/index.tsx)

  • Replaced parseURL() with parseURLWithPlaceholders() which scans the URL path for {name} placeholders in addition to parsing the query string
  • Path placeholders are registered as paramType: 'path' params; query params get paramType: 'query'
  • Fixed URL rebuild in onParametersChange to use string split instead of new URL() (which crashes on {braces}) — preserves the path template including placeholders
  • When a query param value is empty, the placeholder {paramName} is restored in the URL keeping it as a live template
  • When a path param is renamed in the params table, the {oldName} placeholder in the URL path is automatically replaced with {newName} and the input field is updated via ref

Test URL (Custom/index.tsxhandleJsonRequestClick)

  • Path param names are derived directly from {name} placeholders in the URL path string (not from stored paramType) so that endpoints loaded from the DB work correctly even if paramType was not persisted
  • Validates all path params have values before testing — shows "Missing value for '{{name}}'" toast on failure
  • Validates all named query params have values
  • Substitutes path param values into the URL with encodeURIComponent before sending
  • Strips the query string from the URL — query params are sent separately as a map
  • Guards against any remaining unresolved {name} — shows "Unresolved placeholder '{{name}}'" toast and aborts

API Registry Quick Test (api-registry.store.ts)

  • Same path variable resolution logic applied to the quick test button in the registry table
  • Separates path params from query params before posting to test-endpoint.yml
  • Silently skips the test if any placeholder is still unresolved (no stored value)

Save Guard (AddEndpointModal.tsx)

  • Blocks saving if any path parameter has an empty value, preventing a broken URL template from being persisted to the DB

Params Table (RequestVariables/index.tsx)

  • paramType is now propagated through every row construct/update/operator operation so it is never lost during edits
  • Path param rows are always kept in the variable list even when their value is empty, so the user can fill them in
  • All custom params (including path params) have editable names — renaming a path param syncs back to the URL

Variable Cell (VariableCell/index.tsx)

  • Non-editable variable name cells (e.g. nested OpenAPI schema fields) now render as a read-only FormInput with a grey background instead of a plain <p> tag, maintaining visual consistency with the rest of the table

i18n

  • Added missingPathParam and unresolvedPlaceholder translation keys in both English and Estonian

How it works (example)

  1. User types https://api.example.com/{param}/data in the URL field
  2. {param} is detected as a path placeholder → a paramType: 'path' row appears in the Params table
  3. User enters a value (e.g. admin) for param
  4. On Test URL → URL becomes https://api.example.com/admin/data, sent to the backend with no unresolved placeholders
  5. On Save → blocked if param has no value; proceeds otherwise
  6. If user renames paramparamId in the table → URL updates to https://api.example.com/{paramId}/data automatically

Pull from buerokratt/dev
Pull from buerokratt/dev
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@matKlju matKlju linked an issue May 11, 2026 that may be closed by this pull request
19 tasks
@matKlju matKlju requested a review from Thirunayan22 May 11, 2026 13:02
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.

Path Parameter Support for API Endpoints

1 participant