Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation url field #665

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions crates/core/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ impl From<legacy::LandscapeData> for LandscapeData {
item.devstats_url = extra.dev_stats_url;
item.discord_url = extra.discord_url;
item.docker_url = extra.docker_url;
item.documentation_url = extra.documentation_url;
item.github_discussions_url = extra.github_discussions_url;
item.gitter_url = extra.gitter_url;
item.graduated_at = extra.graduated;
Expand Down Expand Up @@ -572,6 +573,9 @@ pub struct Item {
#[serde(skip_serializing_if = "Option::is_none")]
pub docker_url: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
pub documentation_url: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
pub enduser: Option<bool>,

Expand Down Expand Up @@ -1371,6 +1375,7 @@ mod tests {
dev_stats_url: Some("dev_stats_url".to_string()),
discord_url: Some("discord_url".to_string()),
docker_url: Some("docker_url".to_string()),
documentation_url: Some("documentation_url".to_string()),
github_discussions_url: Some("github_discussions_url".to_string()),
gitter_url: Some("gitter_url".to_string()),
graduated: Some(date),
Expand Down Expand Up @@ -1450,6 +1455,7 @@ mod tests {
devstats_url: Some("dev_stats_url".to_string()),
discord_url: Some("discord_url".to_string()),
docker_url: Some("docker_url".to_string()),
documentation_url: Some("documentation_url".to_string()),
enduser: Some(false),
featured: None,
github_discussions_url: Some("github_discussions_url".to_string()),
Expand Down
12 changes: 12 additions & 0 deletions crates/core/src/data/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ pub(super) struct ItemExtra {
pub dev_stats_url: Option<String>,
pub discord_url: Option<String>,
pub docker_url: Option<String>,
pub documentation_url: Option<String>,
pub github_discussions_url: Option<String>,
pub gitter_url: Option<String>,
pub graduated: Option<NaiveDate>,
Expand Down Expand Up @@ -223,8 +224,11 @@ fn validate_urls(item: &Item) -> Result<()> {
("dev_stats", &extra.dev_stats_url),
("discord", &extra.discord_url),
("docker", &extra.docker_url),
("documentation", &extra.documentation_url),
("github_discussions", &extra.github_discussions_url),
("gitter", &extra.gitter_url),
("linkedin", &extra.linkedin_url),
("package_manager", &extra.package_manager_url),
("mailing_list", &extra.mailing_list_url),
("slack", &extra.slack_url),
("stack_overflow", &extra.stack_overflow_url),
Expand All @@ -241,6 +245,14 @@ fn validate_urls(item: &Item) -> Result<()> {
validate_url("audit", &audit_url)?;
}
}

// Other links
if let Some(other_links) = &extra.other_links {
for link in other_links {
let link_url = Some(link.url.clone());
validate_url("other_link", &link_url)?;
}
}
};

Ok(())
Expand Down
3 changes: 3 additions & 0 deletions docs/config/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ categories:
# Docker URL (optional).
docker_url: https://docker.url

# Documentation URL (optional).
documentation_url: https://documentation.url

# GitHub discussions URL (optional).
github_discussions_url: https://github.discussions.url

Expand Down