in src/validators/swagger_request_models.py [0:0]
def root(self) -> Self:
self.git_project_id = self.git_project_id.strip().strip('/')
is_github = self.git_project_id.count('/') == 1
is_gitlab = self.git_project_id.isdigit()
if not is_github and not is_gitlab:
raise ValueError(
'unknown git_project_id. '
'Specify Gitlab project id or Github owner/repo'
)
if not self.git_url:
if is_github:
self.git_url = HttpUrl(GITHUB_API_URL_DEFAULT)
elif is_gitlab:
self.git_url = HttpUrl(GITLAB_API_URL_DEFAULT)
if not self.type:
if is_github:
self.type = RuleSourceType.GITHUB
elif is_gitlab:
self.type = RuleSourceType.GITLAB
if self.type is RuleSourceType.GITHUB_RELEASE and not is_github:
raise ValueError(
'GITHUB_RELEASES is only available for GitHub projects'
)
return self