Skip to content

Commit

Permalink
Revert "Revert "fix: schema inconsistency (#761)""
Browse files Browse the repository at this point in the history
This reverts commit 782e283.
  • Loading branch information
ujjwal-ab committed Aug 9, 2023
1 parent 34e5256 commit b7f1273
Show file tree
Hide file tree
Showing 96 changed files with 1,401 additions and 769 deletions.
5 changes: 4 additions & 1 deletion scripts/schemaGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

CONFIG_DIR = 'src/configurations'

EXCLUDED_DEST = ['postgres']

class FieldTypeEnum(Enum):
STRING = "string"
OBJECT = "object"
Expand Down Expand Up @@ -1002,7 +1004,8 @@ def get_schema_diff(name, selector):
uiConfig = file_content.get("uiConfig")
schema = file_content.get("configSchema")
dbConfig = file_content.get("config")
validate_config_consistency(name, selector, uiConfig, dbConfig, schema)
if name not in EXCLUDED_DEST:
validate_config_consistency(name, selector, uiConfig, dbConfig, schema)


if __name__ == '__main__':
Expand Down
137 changes: 85 additions & 52 deletions src/configurations/destinations/hs/schema.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,24 @@
{
"configSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [],
"type": "object",
"properties": {
"authorizationType": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(legacyApiKey|newPrivateAppApi)$"
},
"hubID": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"apiKey": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"accessToken": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"apiVersion": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(legacyApi|newApi)$"
},
"lookupField": {
"authorizationType": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"hubspotEvents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"rsEventName": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"hubspotEventName": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"eventProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"from": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"to": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
}
}
}
}
}
}
"enum": ["legacyApiKey", "newPrivateAppApi"],
"default": "legacyApiKey"
},
"apiVersion": { "type": "string", "enum": ["legacyApi", "newApi"], "default": "legacyApi" },
"useNativeSDK": { "type": "object", "properties": { "web": { "type": "boolean" } } },
"eventFilteringOption": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(disable|whitelistedEvents|blacklistedEvents)$"
"enum": ["disable", "whitelistedEvents", "blacklistedEvents"],
"default": "disable"
},
"whitelistedEvents": {
"type": "array",
Expand Down Expand Up @@ -100,6 +56,83 @@
}
}
}
}
},
"allOf": [
{
"if": {
"properties": { "authorizationType": { "const": "legacyApiKey" } },
"required": ["authorizationType"]
},
"then": {
"properties": {
"apiKey": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
}
},
"required": ["apiKey"]
}
},
{
"if": {
"properties": { "authorizationType": { "const": "newPrivateAppApi" } },
"required": ["authorizationType"]
},
"then": {
"properties": {
"accessToken": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
}
},
"required": ["accessToken"]
}
},
{
"if": { "properties": { "apiVersion": { "const": "newApi" } }, "required": ["apiVersion"] },
"then": {
"properties": {
"lookupField": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
},
"doAssociation": { "type": "boolean", "default": false },
"hubspotEvents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"rsEventName": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"hubspotEventName": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"eventProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"from": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"to": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
}
}
}
}
}
}
}
},
"required": ["lookupField"]
}
}
]
}
}
12 changes: 6 additions & 6 deletions src/configurations/destinations/hs/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "textInput",
"label": "Hub ID",
"value": "hubID",
"regex": "^(.{0,100})$",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$",
"regexErrorMessage": "Invalid Hub ID",
"required": false,
"placeholder": "e.g: 748991",
Expand Down Expand Up @@ -39,7 +39,7 @@
},
"label": "API Key",
"value": "apiKey",
"regex": "^(.{0,100})$",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid API Key",
"required": true,
"placeholder": "e.g: 05afa518-132c-40db-830a-de0f688902f7",
Expand All @@ -53,7 +53,7 @@
},
"label": "Access Token",
"value": "accessToken",
"regex": "^(.{0,100})$",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid Access Token",
"required": true,
"placeholder": "e.g: pat-eu1-kjg875ya-9de4-98uu-8171-62875ht847r9",
Expand Down Expand Up @@ -85,7 +85,7 @@
},
"label": "Hubspot property name to be used as lookup field",
"value": "lookupField",
"regex": "^(.{0,100})$",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$",
"regexErrorMessage": "Invalid Property Name",
"required": true,
"placeholder": "e.g: lookupField",
Expand Down Expand Up @@ -114,7 +114,7 @@
"type": "textInput",
"label": "RudderStack Event Name",
"value": "rsEventName",
"regex": "^(.{0,100})$",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$",
"required": false,
"placeholder": "e.g Products Searched",
"footerNote": "Enter the RudderStack event name you want to map"
Expand All @@ -123,7 +123,7 @@
"type": "textInput",
"label": "HubSpot Event Name",
"value": "hubspotEventName",
"regex": "^(.{0,100})$",
"regex": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$",
"required": false,
"placeholder": "e.g Search",
"footerNote": "Enter the corresponding Hubspot event name you want to map"
Expand Down
113 changes: 78 additions & 35 deletions src/configurations/destinations/pinterest_tag/schema.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,61 @@
{
"configSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [],
"type": "object",
"properties": {
"tagId": { "type": "string", "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^[0-9]*$" },
"advertiserId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^[0-9]*$"
},
"appId": { "type": "string", "pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^[0-9]*$" },
"apiVersion": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(legacyApi|newApi)$"
},
"adAccountId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^[0-9]*$"
},
"conversionToken": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,101})$"
},
"sendingUnHashedData": { "type": "boolean" },
"enableDeduplication": { "type": "boolean" },
"deduplicationKey": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"enhancedMatch": { "type": "boolean" },
"sendExternalId": { "type": "boolean" },
"sendAsCustomEvent": { "type": "boolean" },
"eventsMapping": {
"apiVersion": { "type": "string", "enum": ["legacyApi", "newApi"], "default": "legacyApi" },
"sendingUnHashedData": { "type": "boolean", "default": true },
"enableDeduplication": { "type": "boolean", "default": false },
"enhancedMatch": { "type": "boolean", "default": true },
"sendExternalId": { "type": "boolean", "default": false },
"sendAsCustomEvent": { "type": "boolean", "default": false },
"customProperties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"from": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"to": {
"properties": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
}
}
}
},
"customProperties": {
"eventsMapping": {
"type": "array",
"items": {
"type": "object",
"properties": {
"properties": {
"from": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
},
"to": {
"type": "string",
"enum": [
"Lead",
"PageVisit",
"ViewCategory",
"Signup",
"WatchVideo",
"Checkout",
"Search",
"AddToCart",
"Custom",
""
]
}
}
}
},
"useNativeSDK": { "type": "object", "properties": { "web": { "type": "boolean" } } },
"eventFilteringOption": {
"type": "string",
"pattern": "(^env[.].+)|^(disable|whitelistedEvents|blacklistedEvents)$"
"enum": ["disable", "whitelistedEvents", "blacklistedEvents"],
"default": "disable"
},
"whitelistedEvents": {
"type": "array",
Expand Down Expand Up @@ -98,6 +93,54 @@
}
}
}
}
},
"allOf": [
{
"if": {
"properties": { "apiVersion": { "const": "legacyApi" } },
"required": ["apiVersion"]
},
"then": {
"properties": {
"advertiserId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^[0-9]*$"
}
},
"required": []
}
},
{
"if": { "properties": { "apiVersion": { "const": "newApi" } }, "required": ["apiVersion"] },
"then": {
"properties": {
"adAccountId": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^[0-9]*$"
},
"conversionToken": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,101})$"
}
},
"required": ["adAccountId", "conversionToken"]
}
},
{
"if": {
"properties": { "enableDeduplication": { "const": true } },
"required": ["enableDeduplication"]
},
"then": {
"properties": {
"deduplicationKey": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{1,100})$"
}
},
"required": ["deduplicationKey"]
}
}
]
}
}
Loading

0 comments on commit b7f1273

Please sign in to comment.