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

chore: limit dynamic config for all destinations #1801

Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 9 additions & 5 deletions scripts/schemaGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ def is_field_purpose(field):
bool: True if field is a purpose field, False otherwise.
"""
return (
"value" in field and field["value"] == "purpose"
or
"configKey" in field and field["configKey"] == "purpose"
"value" in field
and field["value"] == "purpose"
or "configKey" in field
and field["configKey"] == "purpose"
)


def generate_for_regexed_field(field) -> str:
pattern = field["regex"]
if not is_field_purpose(field):
Expand All @@ -93,19 +95,21 @@ def generate_for_regexed_field(field) -> str:

return pattern


def generate_for_non_regexed_field(field) -> str:
# TODO: we should not use a case here for the individual properties. Just pass the desired pattern as regex property
# in ketch purpose fields and delete next case
pattern = "^(.{0,100})$"
if is_field_purpose(field):
return pattern
# non purpose field & regex is not present in the field
if field["dynamicConfigSupported"]:
pattern = "|".join([defaultSubPattern, pattern])
if defaultEnvPattern not in pattern:
pattern = "|".join([defaultEnvPattern, pattern])
if "dynamicConfigSupported" in field and field["dynamicConfigSupported"]:
pattern = "|".join([defaultSubPattern, pattern])
return pattern


def generalize_regex_pattern(field):
"""Generates the pattern for schema based on the type of field.
- For type : singleSelect and dynamicSelectForm, the pattern is generated by iterating over options.
Expand Down
74 changes: 37 additions & 37 deletions src/configurations/destinations/active_campaign/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
"properties": {
"apiUrl": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$"
"pattern": "(^env[.].+)|(?!.*\\.ngrok\\.io)^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$"
},
"apiKey": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|.*"
"pattern": "(^env[.].+)|.*"
},
"actid": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
},
"eventKey": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
},
"oneTrustCookieCategories": {
"type": "object",
Expand All @@ -30,7 +30,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -42,7 +42,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -54,7 +54,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -66,7 +66,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -78,7 +78,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -90,7 +90,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -102,7 +102,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -114,7 +114,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -126,7 +126,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -138,7 +138,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -150,7 +150,7 @@
"properties": {
"oneTrustCookieCategory": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -177,7 +177,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -269,7 +269,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -315,7 +315,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -361,7 +361,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -407,7 +407,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -453,7 +453,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -499,7 +499,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -545,7 +545,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -591,7 +591,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -637,7 +637,7 @@
"properties": {
"consent": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down Expand Up @@ -735,7 +735,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -747,7 +747,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -759,7 +759,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -771,7 +771,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -783,7 +783,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -795,7 +795,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -807,7 +807,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -819,7 +819,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -831,7 +831,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -843,7 +843,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand All @@ -855,7 +855,7 @@
"properties": {
"purpose": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
"pattern": "(^env[.].+)|^(.{0,100})$"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"type": "textInput",
"label": "API Url",
"configKey": "apiUrl",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$",
"regex": "(^env[.].+)|(?!.*\\.ngrok\\.io)^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$",
"regexErrorMessage": "Invalid URL",
"required": true,
"placeholder": "e.g. https://accountname.api-us1.com",
Expand Down
Loading
Loading