Skip to content

Commit

Permalink
Support Assist Regex pattern fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mmanwani07 committed Jan 23, 2024
1 parent b262a80 commit a7e7b51
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions components/create_swagger_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit a7e7b51

Please sign in to comment.