Skip to content

fix(migration): legacy relatedTerms in v1130 glossaryTerm version snapshots break /versions/{v} #27802

@sonika-shah

Description

@sonika-shah

Summary

GET /api/v1/glossaryTerms/{id}/versions/{v} returns 500 on any glossary term that had relatedTerms set on 1.12.x and was upgraded to 1.13+. PR #26586 cleaned glossary_term_entity, but missed the version snapshots in entity_extension.

Symptom

UnrecognizedPropertyException: Unrecognized field "id" (class TermRelation),
not marked as ignorable (2 known properties: "term", "relationType")

The version-history page in the UI fails to load for affected terms. Diff rendering (strikethrough/green for related-term changes) also breaks because of legacy shape inside changeDescription value strings.

Root cause

Pre-1.13 wrote relatedTerms as EntityReference[] (top-level id/name/type). PR #25886 changed the schema to TermRelation[] ({term, relationType}) with extra: forbid.

Version reads (EntityRepository.getVersion) deserialize entity_extension JSON directly:

String json = daoCollection.entityExtensionDAO().getExtension(id, extension);
if (json != null) {
  return JsonUtils.readValue(json, entityClass);
}

No entity_relationship rehydration on this path — the legacy snapshot JSON is parsed straight into GlossaryTerm, and Jackson rejects the unknown id field on TermRelation.

The same legacy shape lives inside changeDescription.fieldsAdded[*].newValue / fieldsDeleted[*].oldValue strings, which the 1.13 UI's diff renderer (expecting TermRelation) cannot render.

Fix approach

Java migration in v1130 that transforms legacy EntityReference[] items into TermRelation[] ({term: <ref>, relationType: "relatedTo"}) at both the top-level relatedTerms field and inside changeDescription diff strings. A strip would silently lose history per version.

PR

#27770

Affected versions

  • 1.13.0+ (after upgrade from any 1.12.x install with non-empty relatedTerms)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done ✅

Status

Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions