Skip to content

Commit

Permalink
Merge pull request #1363 from rudderlabs/release/v1.74.0
Browse files Browse the repository at this point in the history
chore(release): pull release/v1.74.0 into main
  • Loading branch information
ItsSudip authored May 16, 2024
2 parents dcce6f3 + 9279fc6 commit a6f0ceb
Show file tree
Hide file tree
Showing 24 changed files with 1,250 additions and 33 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.74.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.73.0...v1.74.0) (2024-05-13)


### Features

* **criteo:** add support of sha256 hashing method for email field ([#1301](https://github.com/rudderlabs/rudder-config-schema/issues/1301))
* improve schema generator ([#1207](https://github.com/rudderlabs/rudder-config-schema/issues/1207))
* onboard emersys destination ([#1335](https://github.com/rudderlabs/rudder-config-schema/issues/1335))
* onboard new destination sftp ([#1321](https://github.com/rudderlabs/rudder-integrations-config/pull/1321))

### Bug Fixes

* adding group call to emarsys ([#1349](https://github.com/rudderlabs/rudder-config-schema/issues/1349))
* remove useNativeSdk from snowflake ([#1359](https://github.com/rudderlabs/rudder-config-schema/issues/1359))
* add unity and web as supported source type on singular ([#1370](https://github.com/rudderlabs/rudder-integrations-config/pull/1370))

## [1.73.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.72.0...v1.73.0) (2024-05-08)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-config-schema",
"version": "1.73.0",
"version": "1.74.0",
"description": "",
"main": "src/index.ts",
"private": true,
Expand Down
93 changes: 72 additions & 21 deletions scripts/schemaGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@ def is_dest_field_dependent_on_source(field, dbConfig, schema_field_name):
return False


def is_key_present_in_dest_config(dbConfig, key):
"""Checks if the given key is present in destConfig across all source types.
Args:
dbConfig (object): Destination configuration in db-config.json.
key (string): key to be searched in destConfig tree.
Returns:
boolean: True if the key is present in destConfig else, False.
"""
if not dbConfig:
return False

if "destConfig" in dbConfig:
for configSection in dbConfig["destConfig"]:
if key in dbConfig["destConfig"][configSection]:
return True
return False


def is_field_present_in_default_config(field, dbConfig, schema_field_name):
"""Checks if the given field is present in defaultConfig list present in dbConfig.
Expand Down Expand Up @@ -740,6 +760,7 @@ def generate_schema_for_allOf(uiConfig, dbConfig, schema_field_name):
- For each unique preRequisiteField, the properties are found by matching the current preRequisiteField.
- preRequisiteField becomes if block and corresponding properties become then block.
Args:
uiConfig (object): file content of ui-config.json.
dbConfig (object): Configurations of db-config.json.
Expand Down Expand Up @@ -971,17 +992,14 @@ def generate_connection_mode(dbConfig):
return connectionObj


def generate_schema_properties(
uiConfig, dbConfig, schemaObject, properties, name, selector
):
def generate_schema_properties(uiConfig, dbConfig, schemaObject, properties, selector):
"""Generates corresponding schema properties by iterating over each of the ui-config fields.
Args:
uiConfig (object): file content of ui-config.json.
dbConfig (object): Configurations of db-config.json.
schemaObject (object): schema being generated
properties (object): properties of schema
name (string): name of the source or destination.
selector (string): either 'source' or 'destination'
"""
if is_old_format(uiConfig):
Expand All @@ -992,9 +1010,16 @@ def generate_schema_properties(
continue
generateFunction = uiTypetoSchemaFn.get(field["type"], None)
if generateFunction:
properties[field["value"]] = generateFunction(
field, dbConfig, "value"
)
# Generate schema for the field if it is defined in the destination config
if is_key_present_in_dest_config(dbConfig, field["value"]):
properties[field["value"]] = generateFunction(
field, dbConfig, "value"
)
else:
warnings.warn(
f'The field {field["value"]} is defined in ui-config.json but not in db-config.json\n',
UserWarning,
)
if field.get(
"required", False
) == True and is_field_present_in_default_config(
Expand All @@ -1012,9 +1037,18 @@ def generate_schema_properties(
for field in group.get("fields", []):
generateFunction = uiTypetoSchemaFn.get(field["type"], None)
if generateFunction:
properties[field["configKey"]] = generateFunction(
field, dbConfig, "configKey"
)
# Generate schema for the field if it is defined in the destination config
if is_key_present_in_dest_config(
dbConfig, field["configKey"]
):
properties[field["configKey"]] = generateFunction(
field, dbConfig, "configKey"
)
else:
warnings.warn(
f'The field {field["configKey"]} is defined in ui-config.json but not in db-config.json\n',
UserWarning,
)
if (
template.get("title", "") == "Initial setup"
and is_field_present_in_default_config(
Expand All @@ -1027,9 +1061,17 @@ def generate_schema_properties(
for field in sdkTemplate.get("fields", []):
generateFunction = uiTypetoSchemaFn.get(field["type"], None)
if generateFunction:
properties[field["configKey"]] = generateFunction(
field, dbConfig, "configKey"
)
# Generate schema for the field if it is defined in the destination config
if is_key_present_in_dest_config(dbConfig, field["configKey"]):
properties[field["configKey"]] = generateFunction(
field, dbConfig, "configKey"
)
else:
warnings.warn(
f'The field {field["configKey"]} is defined in ui-config.json but not in db-config.json\n',
UserWarning,
)

if field.get(
"required", False
) == True and is_field_present_in_default_config(
Expand All @@ -1051,9 +1093,12 @@ def generate_schema_properties(
schemaObject["required"].append(field["configKey"])

# default properties in new ui-config based schemas.
schemaObject["properties"]["useNativeSDK"] = generate_schema_for_checkbox(
{"type": "checkbox", "value": "useNativeSDK"}, dbConfig, "value"
)
if is_key_present_in_dest_config(dbConfig, "useNativeSDK"):
schemaObject["properties"]["useNativeSDK"] = (
generate_schema_for_checkbox(
{"type": "checkbox", "value": "useNativeSDK"}, dbConfig, "value"
)
)
schemaObject["properties"]["connectionMode"] = generate_connection_mode(
dbConfig
)
Expand Down Expand Up @@ -1099,6 +1144,7 @@ def generate_schema(uiConfig, dbConfig, name, selector):
schemaObject["type"] = "object"
schemaObject["properties"] = {}
allOfSchemaObj = {}
print(f"Generating schema for {name} {selector}")
if is_old_format(uiConfig):
allOfSchemaObj = generate_schema_for_allOf(uiConfig, dbConfig, "value")
if allOfSchemaObj:
Expand All @@ -1110,8 +1156,9 @@ def generate_schema(uiConfig, dbConfig, name, selector):
schemaObject["anyOf"] = allOfSchemaObj
else:
schemaObject["allOf"] = allOfSchemaObj

generate_schema_properties(
uiConfig, dbConfig, schemaObject, schemaObject["properties"], name, selector
uiConfig, dbConfig, schemaObject, schemaObject["properties"], selector
)
newSchema["configSchema"] = schemaObject

Expand Down Expand Up @@ -1154,7 +1201,10 @@ def generate_warnings_for_each_type(uiConfig, dbConfig, schema, curUiType):
)
if (
curUiType == "textInput"
and field["value"] in schema["required"]
and (
schema.get("required", False) == True
and field["value"] in schema["required"]
)
and "regex" not in field
):
warnings.warn(
Expand Down Expand Up @@ -1204,7 +1254,10 @@ def generate_warnings_for_each_type(uiConfig, dbConfig, schema, curUiType):
)
if (
curUiType == "textInput"
and field["configKey"] in schema["required"]
and (
schema.get("required", False) == True
and field["configKey"] in schema["required"]
)
and "regex" not in field
):
warnings.warn(
Expand Down Expand Up @@ -1423,11 +1476,9 @@ def get_schema_diff(name, selector, shouldUpdateSchema=False):
selector (string): either 'source' or 'destination'.
shouldUpdateSchema (boolean): if it should update the existing schema with generated one
"""

file_selectors = ["db-config.json", "ui-config.json", "schema.json"]
directory = f"./{CONFIG_DIR}/{selector}s/{name}"
if not os.path.isdir(directory):
print(f"No {selector}s directory found for {name}")
return

if name not in EXCLUDED_DEST:
Expand Down
1 change: 1 addition & 0 deletions src/configurations/destinations/af/db-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"sharingFilter",
"useRichEventName",
"addPropertiesAtRoot",
"afCurrencyAtRoot",
"androidAppId",
"appleAppId",
"blacklistedEvents",
Expand Down
1 change: 1 addition & 0 deletions src/configurations/destinations/af/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"useRichEventName": { "type": "boolean", "default": false },
"addPropertiesAtRoot": { "type": "boolean", "default": false },
"afCurrencyAtRoot": { "type": "boolean", "default": false },
"sharingFilter": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,100})$"
Expand Down
15 changes: 15 additions & 0 deletions src/configurations/destinations/af/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@
"footerNote": "To send the custom properties to the root of eventValue.",
"default": false
},
{
"type": "checkbox",
"label": "Add af_currency to root of eventValue",
"value": "afCurrencyAtRoot",
"footerNote": "af_currency is added at the root of eventValue, outside properties object.",
"default": false,
"preRequisites": {
"featureFlags": [
{
"configKey": "AMP_appsflyer_add_prop_to_root",
"value": true
}
]
}
},
{
"type": "textInput",
"label": "Sharing Filter",
Expand Down
6 changes: 5 additions & 1 deletion src/configurations/destinations/criteo/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|(?!.*\\.ngrok\\.io)^(.{0,100})$"
},
"hashMethod": { "type": "string", "enum": ["none", "md5"], "default": "none" },
"hashMethod": {
"type": "string",
"enum": ["none", "md5", "sha256"],
"default": "none"
},
"fieldMapping": {
"type": "array",
"items": {
Expand Down
4 changes: 4 additions & 0 deletions src/configurations/destinations/criteo/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
{
"name": "MD5",
"value": "md5"
},
{
"name": "SHA256",
"value": "sha256"
}
],
"defaultOption": {
Expand Down
66 changes: 66 additions & 0 deletions src/configurations/destinations/emarsys/db-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "EMARSYS",
"displayName": "Emarsys",
"config": {
"cdkV2Enabled": true,
"transformAtV1": "router",
"saveDestinationResponse": true,
"excludeKeys": [],
"supportedSourceTypes": [
"android",
"ios",
"unity",
"amp",
"reactnative",
"flutter",
"cordova",
"web",
"cloud",
"shopify",
"warehouse"
],
"supportedConnectionModes": {
"android": ["cloud"],
"ios": ["cloud"],
"web": ["cloud"],
"unity": ["cloud"],
"amp": ["cloud"],
"reactnative": ["cloud"],
"flutter": ["cloud"],
"cordova": ["cloud"],
"shopify": ["cloud"],
"cloud": ["cloud"],
"warehouse": ["cloud"]
},
"supportedMessageTypes": {
"cloud": ["identify", "track", "group"]
},
"destConfig": {
"defaultConfig": [
"emersysUsername",
"emersysUserSecret",
"eventsMapping",
"fieldMapping",
"emersysCustomIdentifier",
"defaultContactList",
"discardEmptyProperties",
"oneTrustCookieCategories"
],
"android": ["connectionMode"],
"ios": ["connectionMode"],
"unity": ["connectionMode"],
"amp": ["connectionMode"],
"reactnative": ["connectionMode"],
"flutter": ["connectionMode"],
"cordova": ["connectionMode"],
"web": ["connectionMode"],
"cloud": ["connectionMode"],
"shopify": ["connectionMode"],
"warehouse": ["connectionMode"]
},
"secretKeys": ["emersysUsername", "emersysUserSecret"]
},
"options": {
"isBeta": true
}
}
Loading

0 comments on commit a6f0ceb

Please sign in to comment.