social_network
¶
available_social_networks = get_args(SocialNetworkName.__value__)
module-attribute
¶
url_dictionary = {'LinkedIn': 'https://linkedin.com/in/', 'GitHub': 'https://github.com/', 'GitLab': 'https://gitlab.com/', 'IMDB': 'https://imdb.com/name/', 'Instagram': 'https://instagram.com/', 'ORCID': 'https://orcid.org/', 'StackOverflow': 'https://stackoverflow.com/users/', 'ResearchGate': 'https://researchgate.net/profile/', 'YouTube': 'https://youtube.com/@', 'Google Scholar': 'https://scholar.google.com/citations?user=', 'Telegram': 'https://t.me/', 'WhatsApp': 'https://wa.me/', 'Leetcode': 'https://leetcode.com/u/', 'X': 'https://x.com/'}
module-attribute
¶
url_validator = pydantic.TypeAdapter(pydantic.HttpUrl)
module-attribute
¶
SocialNetworkName = Literal['LinkedIn', 'GitHub', 'GitLab', 'IMDB', 'Instagram', 'ORCID', 'Mastodon', 'StackOverflow', 'ResearchGate', 'YouTube', 'Google Scholar', 'Telegram', 'WhatsApp', 'Leetcode', 'X']
¶
SocialNetwork
¶
Bases: BaseModelWithoutExtraKeys
model_config = pydantic.ConfigDict(extra='forbid', validate_default=True)
class-attribute
instance-attribute
¶
network = pydantic.Field()
class-attribute
instance-attribute
¶
url
cached
property
¶
Generate profile URL from network and username.
Why
Users provide network+username for brevity. Property generates full URLs with platform-specific logic (e.g., Mastodon domain extraction).
Returns:
-
str–Complete profile URL.
username = pydantic.Field(examples=['john_doe', '@johndoe@mastodon.social', '12345/john-doe'])
class-attribute
instance-attribute
¶
check_username(username, info)
classmethod
¶
Validate username format per network's requirements.
Why
Different platforms have specific username formats (e.g., Mastodon needs @user@domain, StackOverflow needs id/name). Early validation prevents broken URL generation.
Parameters:
-
username(str) –Username to validate.
-
info(ValidationInfo) –Validation context containing network field.
Returns:
-
str–Validated username.
Source code in src/rendercv/schema/models/cv/social_network.py
validate_generated_url()
¶
Validate generated URL is well-formed.
Why
URL generation from username might produce invalid URLs if username format is wrong. Post-validation check catches edge cases.
Returns:
-
SocialNetwork–Validated social network instance.