Skip to content
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
basic email validation
  • Loading branch information
0xC0FFEEEE committed Apr 9, 2025
commit a3faba717dcc3010ce5c3e030fcd5134c0c91722
11 changes: 10 additions & 1 deletion contentctl/objects/email.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
from __future__ import annotations

from abc import ABC
from typing import Any

Check failure on line 4 in contentctl/objects/email.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F401)

contentctl/objects/email.py:4:20: F401 `typing.Any` imported but unused

from pydantic import BaseModel
from pydantic import BaseModel, model_validator


class EmailObject(BaseModel, ABC):
to: str
subject: str
message: str

@model_validator(mode="before")
# Validate the email address
def validate_email(cls, data: str) -> str:
if data.get("to"):
if "@" not in data.get("to"):
raise ValueError("Invalid email address")
return data
Loading