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 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",
"isBatchingEnabled",
"maxBatchSize",
"blacklistedEvents",
Expand Down
22 changes: 17 additions & 5 deletions src/configurations/destinations/http/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,19 @@
},
"from": {
"type": "string",
"pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
"pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
}
}
}
},
"pathParams": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string",
"pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
}
}
}
Expand All @@ -50,11 +62,11 @@
"properties": {
"to": {
"type": "string",
"pattern": "^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
"pattern": "^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
},
"from": {
"type": "string",
"pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
"pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
}
}
}
Expand All @@ -66,11 +78,11 @@
"properties": {
"to": {
"type": "string",
"pattern": "^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
"pattern": "^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
},
"from": {
"type": "string",
"pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
"pattern": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$"
}
}
}
Expand Down
28 changes: 22 additions & 6 deletions src/configurations/destinations/http/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
"type": "textInput",
"key": "from",
"label": "Value",
"regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant",
"placeholder": "e.g: $.properties.key1"
}
Expand All @@ -490,8 +490,24 @@
]
},
{
"name": "Query Parameters",
"name": "Request URL",
"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 All @@ -503,15 +519,15 @@
"type": "textInput",
"key": "to",
"label": "Key",
"regex": "^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regex": "^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regexErrorMessage": "JSON path is not supported. Please enter a constant",
"placeholder": "e.g: customerId"
},
{
"type": "textInput",
"key": "from",
"label": "Value",
"regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant",
"placeholder": "e.g: $.userId or userId"
}
Expand All @@ -533,15 +549,15 @@
"type": "textInput",
"key": "to",
"label": "Key",
"regex": "^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regex": "^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regexErrorMessage": "JSON path is not supported. Please enter a constant",
"placeholder": "e.g. content-type"
},
{
"type": "textInput",
"key": "from",
"label": "Value",
"regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regex": "^\\$(?:\\.|(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*)$|^(?!\\$)[A-Za-z0-9!#$%&'*+.^_`|~-]{1,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant",
"placeholder": "e.g. application/json"
}
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