You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/04/23 16:07:33 UTC
(tooling-trusted-releases) branch arm updated: #463/#464 - mirror correct schema for data from datasource
This is an automated email from the ASF dual-hosted git repository.
alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/arm by this push:
new 2834fadd #463/#464 - mirror correct schema for data from datasource
2834fadd is described below
commit 2834faddd0eb0d039612a98082480214a089c27f
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Thu Apr 23 16:57:53 2026 +0100
#463/#464 - mirror correct schema for data from datasource
---
atr/datasources/apache.py | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/atr/datasources/apache.py b/atr/datasources/apache.py
index e0f11f95..3a559294 100644
--- a/atr/datasources/apache.py
+++ b/atr/datasources/apache.py
@@ -25,6 +25,7 @@ from typing import TYPE_CHECKING, Annotated, Any, Final
if TYPE_CHECKING:
from collections.abc import Mapping
+import pydantic
import sqlmodel
import atr.config as config
@@ -189,10 +190,10 @@ class Release(schema.Strict):
class ProjectStatus(schema.Strict):
- category: str | None = None
+ category: list[str] = schema.factory(list)
created: str | None = None
description: str | None = None
- programming_language: str | None = schema.alias_opt("programming-language")
+ programming_language: list[str] = schema.Field(alias="programming-language", default_factory=list)
doap: str | None = None
homepage: str
name: str
@@ -219,6 +220,15 @@ class ProjectStatus(schema.Strict):
account: AccountInfo | None = None
platform: str | None = None
+ @pydantic.field_validator("category", "programming_language", mode="before")
+ @classmethod
+ def _coerce_to_list(cls, v: object) -> list[str]:
+ if isinstance(v, list):
+ return [str(x) for x in v]
+ if isinstance(v, str):
+ return [v] if v else []
+ return []
+
class ProjectsData(helpers.DictRoot[ProjectStatus]):
pass
@@ -486,9 +496,9 @@ async def _update_projects(data: db.Session, projects: ProjectsData) -> tuple[in
# Pass the project name through the validator
safe.ProjectKey(project_model.key)
project_model.name = str(project_status.name)
- project_model.category = project_status.category
+ project_model.category = ", ".join(project_status.category) or None
project_model.description = project_status.description
- project_model.programming_languages = project_status.programming_language
+ project_model.programming_languages = ", ".join(project_status.programming_language) or None
return added_count, updated_count
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org