From a7e7b51f06c47f735766c47a90d13436eb3e1b28 Mon Sep 17 00:00:00 2001 From: Monika Manwani Date: Tue, 23 Jan 2024 05:48:30 +0000 Subject: [PATCH] Support Assist Regex pattern fix --- components/create_swagger_config.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/components/create_swagger_config.py b/components/create_swagger_config.py index e39f38d..b450e4d 100755 --- a/components/create_swagger_config.py +++ b/components/create_swagger_config.py @@ -1390,6 +1390,28 @@ def resolve_schema_issues(definition_name, isi_schema, (prop_name == 'target_protocol_write_latency_usec')): props[prop_name]['maximum'] = 1.79769e+308 log.warning("Removing Infinity maximum: {}, {}".format(definition_name, prop_name)) + # Issue 67: Regex fail on supportassist settings on primary contact while getting + # details of Support Assist + if definition_name.startswith('SupportassistSettings'): + if prop_name == 'first_name' and 'pattern' in prop: + prop['pattern'] = prop['pattern'].replace( "[\\p{L}\\p{M}*\\-\\.\\' ]*", "[a-zA-Z]*[\\-\\.\\']*") + log.warning("Modified regex pattern") + elif prop_name == 'last_name' and 'pattern' in prop: + prop['pattern'] = prop['pattern'].replace("[\\p{L}\\p{M}*\\-\\.\\' ]*","[a-zA-Z]*[\\-\\.\\']*") + log.warning("Modified regex pattern") + elif prop_name == 'email': + if 'default' in prop: + if prop['pattern'] == "^[a-zA-Z0-9._%-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9]+$": + del prop['default'] + log.warning("Deleted default value for email") + elif prop_name == 'phone': + if 'default' in prop: + if prop['pattern'] == "([\\.\\-\\+\\/\\sxX]*([0-9]+|[\\(\\d+\\)])+)+": + del prop['default'] + log.warning("Deleted default value for phone") + elif prop_name.__eq__("language"): + props["language"] = "En" + log.info("Modified language value") def main(): """Main method for create_swagger_config executable."""