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: update mapping component regex for HTTP destination #1820

Merged
merged 5 commits into from
Dec 5, 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
20 changes: 10 additions & 10 deletions src/configurations/destinations/http/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
"properties": {
"from": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$"
},
"to": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{0,100}$"
}
}
}
Expand All @@ -48,13 +48,13 @@
"items": {
"type": "object",
"properties": {
"from": {
"to": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "^(?!\\$).{0,100}$"
},
"to": {
"from": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{0,100}$"
}
}
}
Expand All @@ -64,13 +64,13 @@
"items": {
"type": "object",
"properties": {
"from": {
"to": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "^(?!\\$).{0,100}$"
},
"to": {
"from": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{0,100}$"
}
}
}
Expand Down
27 changes: 18 additions & 9 deletions src/configurations/destinations/http/ui-config.json
krishna2020 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -468,19 +468,22 @@
"to": "$."
krishna2020 marked this conversation as resolved.
Show resolved Hide resolved
}
],
"jsonPathValidation": true,
"columns": [
{
"type": "textInput",
"key": "from",
"label": "RudderStack",
"placeholder": "e.g: $.properties.key1"
"key": "to",
"label": "Destination property",
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{0,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant",
"placeholder": "e.g: $.events.key2"
},
{
"type": "textInput",
"key": "to",
"label": "HTTP",
"placeholder": "e.g: $.events.key2"
"key": "from",
"label": "RudderStack property",
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$",
"regexErrorMessage": "Please enter a valid JSON path",
"placeholder": "e.g: $.properties.key1"
}
]
}
Expand All @@ -494,19 +497,22 @@
"label": "Map your query parameters",
"configKey": "queryParams",
"default": [],
"jsonPathValidation": true,
"hideKeysJsonView": true,
"columns": [
{
krishna2020 marked this conversation as resolved.
Show resolved Hide resolved
"type": "textInput",
"key": "to",
"label": "Key",
"regex": "^(?!\\$).{0,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+\\(\\))*$|^(?!\\$).{0,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant",
"placeholder": "e.g: $.userId or \"userId\""
}
]
Expand All @@ -522,18 +528,21 @@
"configKey": "headers",
"default": [],
"hideKeysJsonView": true,
"jsonPathValidation": true,
"columns": [
{
"type": "textInput",
krishna2020 marked this conversation as resolved.
Show resolved Hide resolved
"key": "to",
"label": "Key",
"regex": "^(?!\\$).{0,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+\\(\\))*$|^(?!\\$).{0,100}$",
"regexErrorMessage": "Please enter a valid JSON path or a constant",
"placeholder": "e.g. \"application/json\""
}
]
Expand Down
54 changes: 27 additions & 27 deletions test/data/validation/destinations/http.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
"maxBatchSize": "10",
"headers": [
{
"to": "$.h1",
"from": "'val1'"
"to": "val",
"from": "adfg"
},
{
"to": "$.h2",
"to": "val2",
"from": "2"
},
{
"to": "$.h3",
"to": "auth",
"from": "$.properties.testProp"
}
],
"queryParams": [
{
"to": "$.q1",
"from": "'val1'"
"from": "$.q1",
"to": "'val1'"
}
],
"propertiesMapping": [
Expand Down Expand Up @@ -254,22 +254,22 @@
"maxBatchSize": "10",
"headers": [
{
"to": "$.h1",
"from": "'val1'"
"from": "$.h1",
"to": "'val1'"
},
{
"to": "$.h2",
"from": "2"
"from": "$.h2",
"to": "2"
},
{
"to": "$.h3",
"to": "testProp",
"from": "$.properties.testProp"
}
],
"queryParams": [
{
"to": "$.q1",
"from": "'val1'"
"from": "$.q1",
"to": "'val1'"
}
],
"propertiesMapping": [
Expand Down Expand Up @@ -421,22 +421,22 @@
"maxBatchSize": "10",
"headers": [
{
"to": "$.h1",
"from": "'val1'"
"from": "$.h1",
"to": "'val1'"
},
{
"to": "$.h2",
"from": "2"
"from": "$.h2",
"to": "2"
},
{
"to": "$.h3",
"to": "testProp",
"from": "$.properties.testProp"
}
],
"queryParams": [
{
"to": "$.q1",
"from": "'val1'"
"from": "$.q1",
"to": "'val1'"
}
],
"propertiesMapping": [
Expand Down Expand Up @@ -483,22 +483,22 @@
"maxBatchSize": "10",
"headers": [
{
"to": "$.h1",
"from": "'val1'"
"from": "$.h1",
"to": "'val1'"
},
{
"to": "$.h2",
"from": "2"
"from": "$.h2",
"to": "2"
},
{
"to": "$.h3",
"to": "testProp",
"from": "$.properties.testProp"
}
],
"queryParams": [
{
"to": "$.q1",
"from": "'val1'"
"from": "$.q1",
"to": "'val1'"
}
],
"propertiesMapping": [
Expand Down
Loading