Skip to content
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

feat: added path param tab http #1813

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/configurations/destinations/http/db-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"propertiesMapping",
"queryParams",
"headers",
"pathParams",
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Schema validation missing for pathParams

The schema.json file lacks validation rules for the pathParams configuration, while the UI configuration (ui-config.json) correctly includes the Path Parameters tab. This could lead to validation issues.

  • Add schema validation for pathParams in schema.json similar to the existing queryParams and headers validation:
"pathParams": {
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "path": {
        "type": "string",
        "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
      }
    }
  }
}
🔗 Analysis chain

LGTM! The placement of pathParams is logical and non-breaking.

The addition of "pathParams" is well-positioned among other HTTP request configuration options like queryParams and headers.

Let's verify the integration with related schema and UI files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that schema.json and ui-config.json have corresponding changes for pathParams

# Check if schema.json has been updated to allow pathParams
echo "Checking schema.json for pathParams support..."
rg -A 5 '"pathParams"' "src/configurations/destinations/http/schema.json"

# Check if ui-config.json has UI configuration for pathParams
echo "Checking ui-config.json for pathParams UI configuration..."
rg -A 5 '"pathParams"' "src/configurations/destinations/http/ui-config.json"

Length of output: 482


Script:

#!/bin/bash
# Let's verify schema.json changes more thoroughly by checking its content
echo "Checking complete schema.json content..."
cat "src/configurations/destinations/http/schema.json"

# Also check if there are any validation rules or type definitions for pathParams
echo -e "\nChecking for pathParams validation rules..."
rg -C 10 'pathParams|path.*param' "src/configurations/destinations/http/schema.json"

# Check the complete UI config to understand the context better
echo -e "\nChecking complete ui-config.json content..."
cat "src/configurations/destinations/http/ui-config.json"

Length of output: 51198

"isBatchingEnabled",
"maxBatchSize",
"blacklistedEvents",
Expand Down
1 change: 1 addition & 0 deletions src/configurations/destinations/http/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"required": ["apiUrl", "auth", "method", "format"],
"type": "object",
"additionalProperties": true,
"properties": {
"apiUrl": {
"type": "string",
Expand Down
21 changes: 21 additions & 0 deletions src/configurations/destinations/http/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,27 @@
]
}
]
},
{
"name": "Path Parameters",
"fields": [
{
"type": "mapping",
"label": "Enter your path parameters in sequence",
"columns": [
{
"key": "path",
"type": "textInput",
"label": "Path",
"placeholder": "$.userId or users",
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{1,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant",
}
Comment on lines +614 to +615
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix JSON syntax error: Remove trailing comma

There's a trailing comma after the regexErrorMessage field which needs to be removed to ensure valid JSON syntax.

Apply this fix:

           "regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{1,100}$",
-          "regexErrorMessage": "Please enter a valid JSON path or a constant",
+          "regexErrorMessage": "Please enter a valid JSON path or a constant"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"regexErrorMessage": "Please enter a valid JSON path or a constant",
}
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{1,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant"
}

],
"default": [],
"configKey": "pathParams"
}
]
Comment on lines +600 to +620
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Documentation needs to be added for path parameters feature

The codebase search reveals:

  • Path parameters UI configuration exists but lacks comprehensive documentation
  • Example URLs with path parameters are only present in test files
  • The API URL field's documentation briefly mentions dynamic path variables but doesn't explain the new path parameters feature

Required documentation updates:

  • Add path parameters documentation in README.md or create a new documentation file
  • Include examples demonstrating the relationship between path parameters and API URL
  • Document the syntax and usage of the new path parameters feature
🔗 Analysis chain

Verify path parameter documentation and examples

Let's ensure the documentation and examples are consistent across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for path parameter documentation and examples
echo "Searching for path parameter documentation..."
rg -l "path param(eter)?" docs/
rg -l "path param(eter)?" README.md

echo "Searching for example URLs with path parameters..."
rg -l "http.*\{\{.*\}\}" docs/

Length of output: 408


Script:

#!/bin/bash
# Let's try a broader search for documentation and examples
echo "Searching for path parameter documentation in all files..."
rg -i "path param(eter)?"

echo -e "\nSearching for example URLs with path parameters..."
rg -i "https?://[^\"'\s]*\{[^}]+\}"

echo -e "\nSearching for any markdown or documentation files..."
fd -e md
fd -e mdx
fd -e txt

Length of output: 2693

🧰 Tools
🪛 Biome (1.9.4)

[error] 616-616: Expected a property but instead found '}'.

Expected a property here.

(parse)

Comment on lines +602 to +620
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider enhancing path parameter validation and documentation

The implementation needs additional safeguards and clarity:

  1. Add validation to prevent duplicate path parameters which could cause runtime issues
  2. Clarify the sequence importance in the label or add a note
  3. Consider adding validation for the total number of path parameters to match URL placeholders

Apply these changes to enhance validation and clarity:

 {
   "name": "Path Parameters",
   "fields": [
     {
       "type": "mapping",
-      "label": "Enter your path parameters in sequence",
+      "label": "Enter your path parameters in sequence (order matters)",
+      "note": "Parameters will be substituted in order into URL placeholders. Use either JSON path (e.g., $.userId) for dynamic values or constants.",
       "columns": [
         {
           "key": "path",
           "type": "textInput",
           "label": "Path",
           "placeholder": "$.userId or users",
           "regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{1,100}$",
           "regexErrorMessage": "Please enter a valid JSON path or a constant",
+          "validation": {
+            "unique": true,
+            "errorMessage": "Duplicate path parameters are not allowed"
+          }
         }
       ],
       "default": [],
       "configKey": "pathParams"
     }
   ]
 }

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Biome (1.9.4)

[error] 616-616: Expected a property but instead found '}'.

Expected a property here.

(parse)

}
]
}
Expand Down
Loading