Skip to content

Commit

Permalink
Merge branch 'develop' into loops-destination
Browse files Browse the repository at this point in the history
  • Loading branch information
danrowden authored Jan 27, 2025
2 parents f390203 + 10ebbd9 commit 00dbe4e
Show file tree
Hide file tree
Showing 18 changed files with 179 additions and 98 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

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.102.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.101.1...v1.102.0) (2025-01-20)


### Features

* **http:** add urlPreview custom field to ui-config ([#1869](https://github.com/rudderlabs/rudder-config-schema/issues/1869)) ([41be203](https://github.com/rudderlabs/rudder-config-schema/commit/41be20376268251ebe06c6dd909f0e8752006647))

### [1.101.1](https://github.com/rudderlabs/rudder-config-schema/compare/v1.101.0...v1.101.1) (2025-01-14)

## [1.101.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.100.0...v1.101.0) (2025-01-14)

### Bug Fixes

* update config for klaviyo and ga4 v2 ([09d4977](https://github.com/rudderlabs/rudder-config-schema/pull/1863/commits/7efcfd1c017a5608710babb40a28d3c145cd8c85))

## [1.100.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.99.1...v1.100.0) (2024-12-18)


Expand All @@ -12,6 +27,7 @@ All notable changes to this project will be documented in this file. See [standa

### Bug Fixes

* enable ga4 v2 as beta ([4ba0df7](https://github.com/rudderlabs/rudder-config-schema/pull/1863/commits/4ba0df7dc0694e6469b6aa9fa6db427b54b5dc90))
* pr body in constants pr workflow ([83d7b26](https://github.com/rudderlabs/rudder-config-schema/commit/83d7b2674f2b4bc209331d1dcd2b3c3bacafb4ab))
* pr body in constants pr workflow ([3d227f7](https://github.com/rudderlabs/rudder-config-schema/commit/3d227f7126c96df9bf64fbd9587ac5d8f19fe17c))
* pr labels in constants pr workflow ([e8c5167](https://github.com/rudderlabs/rudder-config-schema/commit/e8c5167cad5f9792e2621ddc7695fe85b7aa8fb4))
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.100.0",
"version": "1.102.0",
"description": "",
"main": "src/index.ts",
"private": true,
Expand Down
43 changes: 36 additions & 7 deletions scripts/schemaGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,33 @@ def get_options_list_for_enum(field):
return options_list


def generate_uiconfig_pattern(field, dbConfig=None) -> str:
"""
Generates the pattern for schema based on the type of field.
Cases:
If dynamicConfigSupported is present in dbConfig:
- Regex is present in ui-config for the field
- Use the regex mentioned in ui-config.
- Regex is not present in ui-config for the field
- Use the regex ^(.{0,100})$.
If dynamicConfigSupported is not present in dbConfig:
- Regex is present in ui-config for the field
- Use the regex mentioned in ui-config & includes dynamic config regex & env regex(if not already present).
- Regex is not present in ui-config for the field
- Use the regex ^(.{0,100})$ & includes dynamic config regex & env regex(if not already present).
"""
# TODO: remove this once all the destinations have been updated with dynamicConfigSupported field
if "dynamicConfigSupported" not in dbConfig:
return generalize_regex_pattern(field) # old way

# regex from ui-config
if "regex" in field:
return field["regex"]
else:
return "^(.{0,100})$"


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 Expand Up @@ -269,12 +296,12 @@ def generate_schema_for_textinput(field, dbConfig, schema_field_name):
}
if "regex" in field:
textInputSchemaObj["properties"][sourceType]["pattern"] = (
generalize_regex_pattern(field)
generate_uiconfig_pattern(field, dbConfig)
)
else:
textInputSchemaObj = {"type": FieldTypeEnum.STRING.value}
if "regex" in field:
textInputSchemaObj["pattern"] = generalize_regex_pattern(field)
textInputSchemaObj["pattern"] = generate_uiconfig_pattern(field, dbConfig)
return textInputSchemaObj


Expand All @@ -292,7 +319,7 @@ def generate_schema_for_textarea_input(field, dbConfig, schema_field_name):
"""
textareaInputObj = {"type": FieldTypeEnum.STRING.value}
if "regex" in field:
textareaInputObj["pattern"] = generalize_regex_pattern(field)
textareaInputObj["pattern"] = generate_uiconfig_pattern(field, dbConfig)
return textareaInputObj


Expand Down Expand Up @@ -394,7 +421,9 @@ def generate_schema_for_dynamic_custom_form(field, dbConfig, schema_field_name):
and customField["type"] != "singleSelect"
and customField["type"] != "dynamicSelectForm"
):
customFieldSchemaObj["pattern"] = generalize_regex_pattern(customField)
customFieldSchemaObj["pattern"] = generate_uiconfig_pattern(
customField, dbConfig
)

# If the custom field is source dependent, we remove the source keys as it's not required inside custom fields, rather they need to be moved to top.
if isCustomFieldDependentOnSource:
Expand Down Expand Up @@ -510,13 +539,13 @@ def generate_key(forFieldWithTo):
}
if field["type"] == "dynamicSelectForm":
if forFieldWithTo != (field.get("reverse", False) == False):
obj["pattern"] = generalize_regex_pattern(field)
obj["pattern"] = generate_uiconfig_pattern(field, dbConfig)
else:
if "defaultOption" in field:
obj["default"] = field["defaultOption"]["value"]
obj["enum"] = get_options_list_for_enum(field)
else:
obj["pattern"] = generalize_regex_pattern(field)
obj["pattern"] = generate_uiconfig_pattern(field, dbConfig)
return obj

dynamicFormSchemaObject = {}
Expand Down Expand Up @@ -602,7 +631,7 @@ def generate_schema_for_tag_input(field, dbConfig, schema_field_name):
tagItemProps = {
str(field["tagKey"]): {
"type": FieldTypeEnum.STRING.value,
"pattern": generalize_regex_pattern(field),
"pattern": generate_uiconfig_pattern(field, dbConfig),
}
}
tagItem["properties"] = tagItemProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"config": {
"transformAtV1": "processor",
"saveDestinationResponse": true,
"dynamicConfigSupported": ["trackingServerUrl", "reportSuiteIds", "trackingServerSecureUrl"],
"includeKeys": [
"trackingServerUrl",
"reportSuiteIds",
Expand Down
Loading

0 comments on commit 00dbe4e

Please sign in to comment.