Skip to content

Commit

Permalink
Merge pull request #90 from ecmwf-projects/jsonld-fixes
Browse files Browse the repository at this point in the history
Fixed image usage in JSON-LD
  • Loading branch information
keul authored Oct 17, 2024
2 parents 462fca7 + 5fd95f2 commit 3be99a2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cads_catalogue_api_service/models/schema_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ class Dataset(pydantic.BaseModel):
spatialCoverage: Place
datePublished: str | None
dateModified: str | None
thumbnailUrl: str | None = None
image: str | None = None
4 changes: 1 addition & 3 deletions cads_catalogue_api_service/schema_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,5 @@ def schema_org_json_ld(
),
datePublished=collection.get("published", None),
dateModified=collection.get("updated", None),
thumbnailUrl=collection.get("assets", {})
.get("thumbnail", {})
.get("href", None),
image=collection.get("assets", {}).get("thumbnail", {}).get("href", None),
)
5 changes: 2 additions & 3 deletions schemas/schema_org.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"dateModified": {
"type": ["string","null"]
},
"thumbnailUrl": {
"image": {
"type": ["string","null"]
}
},
Expand All @@ -105,8 +105,7 @@
"distribution",
"temporalCoverage",
"spatialCoverage",
"dateModified",
"thumbnailUrl"
"dateModified"
]
}
}
2 changes: 1 addition & 1 deletion tests/test_40_schema_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,5 @@ def test_schema_org_jsonId(monkeypatch) -> None:
},
"dateModified": "2023-06-22T00:00:00Z",
"datePublished": "2020-05-19T00:00:00Z",
"thumbnailUrl": "https://s3.cds.org.int/swift/v1/AUTH_3e237111c3a144df8e0e0980577062b4/cds2-dev-catalogue/resources/era5-something/overview_36fc7b601512e3619bc5ba70ae0488b911d9d74e203400f9a321f5745768f6a5.png",
"image": "https://s3.cds.org.int/swift/v1/AUTH_3e237111c3a144df8e0e0980577062b4/cds2-dev-catalogue/resources/era5-something/overview_36fc7b601512e3619bc5ba70ae0488b911d9d74e203400f9a321f5745768f6a5.png",
}

0 comments on commit 3be99a2

Please sign in to comment.