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(http): added pathParams field and renamed the tab ro URL params #1831

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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",
"isBatchingEnabled",
"maxBatchSize",
"blacklistedEvents",
Expand Down
12 changes: 12 additions & 0 deletions src/configurations/destinations/http/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
}
}
},
"pathParams": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string",
"pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
}
}
}
},
sandeepdsvs marked this conversation as resolved.
Show resolved Hide resolved
"queryParams": {
"type": "array",
"items": {
Expand Down
18 changes: 17 additions & 1 deletion src/configurations/destinations/http/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,24 @@
]
},
{
"name": "Query Parameters",
"name": "URL 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+\\(\\))*$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant"
}
],
"default": [],
"configKey": "pathParams"
},
{
"type": "mapping",
"label": "Map your query parameters",
Expand Down
118 changes: 118 additions & 0 deletions test/data/validation/destinations/http.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,5 +577,123 @@
"ketchConsentPurposes.web must be array",
"ketchConsentPurposes.unity.0 must be object"
]
},
{
"testTitle": "With pathParams",
"config": {
"apiUrl": "http://sample.com/api/hooks/{{$.traits.userId}}/url/{{$.properties.event}}",
"auth": "basicAuth",
"username": "test-user",
"password": "",
"method": "POST",
"format": "JSON",
"http-connectionMode": "cloud",
"connectionMode": {
"cloud": "cloud"
},
"consentManagement": {},
"isBatchingEnabled": true,
"maxBatchSize": "10",
"headers": [
{
"from": "$.h1",
"to": "'val1'"
},
{
"from": "$.h2",
"to": "2"
},
{
"to": "testProp",
"from": "$.properties.testProp"
}
],
"queryParams": [
{
"from": "$.q1",
"to": "'val1'"
}
],
"propertiesMapping": [
{
"from": "$.properties.key1",
"to": "$.events.key2"
}
],
"pathParams": [
{
"path": "$.properties.key1"
}
],
"oneTrustCookieCategories": {
"android": [
{
"oneTrustCookieCategory": "more than 100 characters string - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
{
"oneTrustCookieCategory": "C0004"
}
],
"ios": [
{
"oneTrustCookieCategory": {
"not": "a string"
}
},
{
"oneTrustCookieCategory": "C0004"
}
],
"web": {
"not": "an array"
},
"unity": [
"not an object",
{
"oneTrustCookieCategory": "C0004"
}
]
},
"ketchConsentPurposes": {
"android": [
{
"purpose": "more than 100 characters string - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
{
"purpose": "P4"
}
],
"ios": [
{
"purpose": {
"not": "a string"
}
},
{
"purpose": "P4"
}
],
"web": {
"not": "an array"
},
"unity": [
"not an object",
{
"purpose": "P4"
}
]
}
},
"result": false,
"err": [
"oneTrustCookieCategories.android.0.oneTrustCookieCategory must match pattern \"(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$\"",
"oneTrustCookieCategories.ios.0.oneTrustCookieCategory must be string",
"oneTrustCookieCategories.web must be array",
"oneTrustCookieCategories.unity.0 must be object",
"ketchConsentPurposes.android.0.purpose must match pattern \"(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$\"",
"ketchConsentPurposes.ios.0.purpose must be string",
"ketchConsentPurposes.web must be array",
"ketchConsentPurposes.unity.0 must be object"
]
}
]
Loading