Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions dagify/converter/yaml_validator/custom_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ def _is_valid(self, value):
def fail(self, value):
return f'{value} is not a valid email address.'


#K.S. edit: Removing URL validator for now to avoid broken URL links to crash the tool.
# Additionally, requiring internet access for the tool might not be a good idea.
class URLValidator(Validator):
tag = 'validURL' # This is the tag you use in your schema

def _is_valid(self, value):

try:
response = requests.get(value)
return response.status_code == 200
except requests.exceptions.RequestException as e:
print(f"Error checking URL: {e}")

#try:
# response = requests.get(value)
# return response.status_code == 200
#except requests.exceptions.RequestException as e:
# print(f"Error checking URL: {e}")
return True

# Extend default validators with your custom validators
validators = DefaultValidators.copy()
Expand Down