Skip to content

Commit 3c5eddc

Browse files
longshuicylmarini
andauthored
add id in GET /metadata.jsonld responses (#279)
* add id * add entry in changelog issue #278 * reordering the field to make id second Co-authored-by: Luigi Marini <[email protected]>
1 parent d25f2a4 commit 3c5eddc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313
### Added
1414
- Adding mime type for geojson
1515
- Add "when" parameter in a few GET API endpoints to enable pagination [#266](https://github.com/clowder-framework/clowder/issues/266)
16+
- Add "id" in GET metadata.jsonld endpoints [#278](https://github.com/clowder-framework/clowder/issues/278)
1617

1718
## 1.18.1 - 2021-08-16
1819

app/util/JSONLD.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ object JSONLD {
6363
)
6464

6565
//convert metadata to json using implicit writes in Metadata model
66-
val metadataJson = resourceJson ++ toJson(metadata).asInstanceOf[JsObject]
66+
//include metadata ID in the json
67+
val metadataJson = JsObject(Seq("id" -> JsString(metadata.id.toString()))) ++ resourceJson ++ toJson(metadata).asInstanceOf[JsObject]
6768

6869
//combine the two json objects and return
6970
if (contextJson.isEmpty) metadataJson else contextJson.get ++ metadataJson

0 commit comments

Comments
 (0)