From 497a654f76486691a2bfde94b86f0882cdd8853b Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Fri, 24 Sep 2021 16:30:15 -0500 Subject: [PATCH 1/3] add id --- app/util/JSONLD.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/util/JSONLD.scala b/app/util/JSONLD.scala index c45dca24d..97ea6fc22 100644 --- a/app/util/JSONLD.scala +++ b/app/util/JSONLD.scala @@ -63,7 +63,8 @@ object JSONLD { ) //convert metadata to json using implicit writes in Metadata model - val metadataJson = resourceJson ++ toJson(metadata).asInstanceOf[JsObject] + //include metadata ID in the json + val metadataJson = resourceJson ++ toJson(metadata).asInstanceOf[JsObject] ++ JsObject(Seq("id" -> JsString(metadata.id.toString()))) //combine the two json objects and return if (contextJson.isEmpty) metadataJson else contextJson.get ++ metadataJson From 8d62c6874d579d277f01eb74ae86accd234d8e78 Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Fri, 24 Sep 2021 16:47:04 -0500 Subject: [PATCH 2/3] add entry in changelog issue #278 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73cf5b602..694cb70bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - Add "when" parameter in a few GET API endpoints to enable pagination [#266](https://github.com/clowder-framework/clowder/issues/266) +- Add "id" in GET metadata.jsonld endpoints [#278](https://github.com/clowder-framework/clowder/issues/278) ## 1.18.1 - 2021-08-16 From 60744fd49e8a0b1a4f788e5715ce2664e019b936 Mon Sep 17 00:00:00 2001 From: Chen Wang Date: Thu, 30 Sep 2021 09:50:26 -0500 Subject: [PATCH 3/3] reordering the field to make id second --- app/util/JSONLD.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/util/JSONLD.scala b/app/util/JSONLD.scala index 97ea6fc22..3eacc7214 100644 --- a/app/util/JSONLD.scala +++ b/app/util/JSONLD.scala @@ -64,7 +64,7 @@ object JSONLD { //convert metadata to json using implicit writes in Metadata model //include metadata ID in the json - val metadataJson = resourceJson ++ toJson(metadata).asInstanceOf[JsObject] ++ JsObject(Seq("id" -> JsString(metadata.id.toString()))) + val metadataJson = JsObject(Seq("id" -> JsString(metadata.id.toString()))) ++ resourceJson ++ toJson(metadata).asInstanceOf[JsObject] //combine the two json objects and return if (contextJson.isEmpty) metadataJson else contextJson.get ++ metadataJson