Skip to content

Commit

Permalink
fix(core): id can optionally be included in Entity Fragments
Browse files Browse the repository at this point in the history
TODO: to be checked in other similar endpoints (Replace Entity, ...)
  • Loading branch information
bobeal committed Dec 14, 2024
1 parent 1456303 commit 807172e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import com.egm.stellio.shared.model.addSysAttrs
import com.egm.stellio.shared.model.toExpandedAttributes
import com.egm.stellio.shared.model.toNgsiLdAttributes
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_EXPANDED_ENTITY_SPECIFIC_MEMBERS
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_ID
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_TYPE
import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_SCOPE_PROPERTY
import com.egm.stellio.shared.util.JsonUtils.serializeObject
Expand Down Expand Up @@ -150,7 +151,10 @@ class EntityService(
authorizationService.userCanUpdateEntity(entityId, sub.toOption()).bind()

val (coreAttrs, otherAttrs) =
expandedAttributes.toList().partition { JSONLD_EXPANDED_ENTITY_SPECIFIC_MEMBERS.contains(it.first) }
expandedAttributes.toList()
// remove @id if it is present (optional as per 5.4)
.filter { it.first != JSONLD_ID }
.partition { JSONLD_EXPANDED_ENTITY_SPECIFIC_MEMBERS.contains(it.first) }
val mergedAt = ngsiLdDateTime()
logger.debug("Merging entity {}", entityId)

Expand Down

0 comments on commit 807172e

Please sign in to comment.