Skip to content

Commit

Permalink
feat: updated regex and added in schema json
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepdsvs committed Dec 3, 2024
1 parent 4d6a795 commit 4630789
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
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
12 changes: 8 additions & 4 deletions src/configurations/destinations/http/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,15 @@
"type": "textInput",
"key": "from",
"label": "RudderStack",
"regex": "^\\$((\\.[a-zA-Z_][a-zA-Z0-9_]*)|(\\[\\d+\\])|(\\[\\'.*?\\'\\])|(\\[\\\".*?\\\"\\]))*$\n",
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$",
"regexErrorMessage": "Invalid RudderStack parameter",
"placeholder": "e.g: $.properties.key1"
},
{
"type": "textInput",
"key": "to",
"label": "HTTP",
"regex": "^\\$((\\.[a-zA-Z_][a-zA-Z0-9_]*)|(\\[\\d+\\])|(\\[\\'.*?\\'\\])|(\\[\\\".*?\\\"\\]))*$|^[a-zA-Z_][a-zA-Z0-9_]*$\n",
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{0,100}$",
"regexErrorMessage": "Invalid HTTP parameter",
"placeholder": "e.g: $.events.key2"
}
Expand All @@ -561,13 +561,15 @@
"type": "textInput",
"key": "to",
"label": "Key",
"regex": "^(?!\\$).{0,100}$",
"regexErrorMessage": "Invalid parameter",
"placeholder": "e.g: customerId"
},
{
"type": "textInput",
"key": "from",
"label": "Value",
"regex": "^\\$((\\.[a-zA-Z_][a-zA-Z0-9_]*)|(\\[\\d+\\])|(\\[\\'.*?\\'\\])|(\\[\\\".*?\\\"\\]))*$|^[a-zA-Z_][a-zA-Z0-9_]*$\n",
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{0,100}$",
"regexErrorMessage": "Invalid HTTP parameter",
"placeholder": "e.g: $.userId or \"userId\""
}
Expand All @@ -589,13 +591,15 @@
"type": "textInput",
"key": "to",
"label": "Key",
"regex": "^(?!\\$).{0,100}$",
"regexErrorMessage": "Invalid parameter",
"placeholder": "e.g. content-type"
},
{
"type": "textInput",
"key": "from",
"label": "Value",
"regex": "^\\$((\\.[a-zA-Z_][a-zA-Z0-9_]*)|(\\[\\d+\\])|(\\[\\'.*?\\'\\])|(\\[\\\".*?\\\"\\]))*$|^[a-zA-Z_][a-zA-Z0-9_]*$\n",
"regex": "^\\$(\\.(\\w+|\\*)|\\[\\d+\\]|\\[('\\w+'|\"\\w+\")\\]|\\[\\*\\]|\\.\\w+\\(\\))*$|^(?!\\$).{0,100}$",
"regexErrorMessage": "Invalid parameter",
"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

0 comments on commit 4630789

Please sign in to comment.