Recently we upgrade Tridion platform to 8.5 and DXA from 1.3 to 1.8. Although everything seemed OK at the beginning, we are having issues with model mapping of Embedded fields. All the Embedded models are just NULL with in the parent object. After struggling for few days, we found that renaming embedded field's root element to same of its parent(In our case its "Content") solved the issue. But We have some existing schema with multiple embedded fields and we can't rename both embedded fields to "Content". Tried specifying Semantic property to the embeded models but still no joy :(
[SemanticEntity(Vocab = CoreVocabulary, EntityName = "ContentType", Prefix = "s")]
I tried debugging the DXA code and I could see an issue with mapping on DefaultModelBuilder
-> MapFieldValues()
-> MapEmbeddedFields()
-> GetFieldFromSemantics()
. The xpath is always taking Content\Content\
insted of Content\ContentType\
even after specifying the the entity name on Semantic property.
To me, this seems to be a mapping issue with DXA 1.8. Can someone confirm? Is there any other way to address the embedded mapping issue?
EDIT Here is the complete schema.json
{
"Id": 30241,
"RootElement": "Content",
"Fields": [{
"Name": "title",
"Path": "/Content/title",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "title"
}
],
"Fields": []
}, {
"Name": "description",
"Path": "/Content/description",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "description"
}
],
"Fields": []
}, {
"Name": "first_name_label",
"Path": "/Content/first_name_label",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "first_name_label"
}
],
"Fields": []
}, {
"Name": "first_name_placeholder",
"Path": "/Content/first_name_placeholder",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "first_name_placeholder"
}
],
"Fields": []
}, {
"Name": "first_name_required_message",
"Path": "/Content/first_name_required_message",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "first_name_required_message"
}
],
"Fields": []
}, {
"Name": "last_name_label",
"Path": "/Content/last_name_label",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "last_name_label"
}
],
"Fields": []
}, {
"Name": "last_name_placeholder",
"Path": "/Content/last_name_placeholder",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "last_name_placeholder"
}
],
"Fields": []
}, {
"Name": "last_name_required_message",
"Path": "/Content/last_name_required_message",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "last_name_required_message"
}
],
"Fields": []
}, {
"Name": "email_label",
"Path": "/Content/email_label",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "email_label"
}
],
"Fields": []
}, {
"Name": "email_placeholder",
"Path": "/Content/email_placeholder",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "email_placeholder"
}
],
"Fields": []
}, {
"Name": "email_required_message",
"Path": "/Content/email_required_message",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "email_required_message"
}
],
"Fields": []
}, {
"Name": "subscription_types",
"Path": "/Content/subscription_types",
"IsMultiValue": true,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "subscription_types"
}
],
"Fields": [{
"Name": "title",
"Path": "/Content/subscription_types/title",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "SubscriptionType",
"Property": "title"
}
],
"Fields": []
}, {
"Name": "description",
"Path": "/Content/subscription_types/description",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "SubscriptionType",
"Property": "description"
}
],
"Fields": []
}, {
"Name": "newsletter_id",
"Path": "/Content/subscription_types/newsletter_id",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "SubscriptionType",
"Property": "newsletter_id"
}
],
"Fields": []
}
]
}, {
"Name": "summary",
"Path": "/Content/summary",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "summary"
}
],
"Fields": []
}, {
"Name": "gdpr_consent_text_pm",
"Path": "/Content/gdpr_consent_text_pm",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "gdpr_consent_text_pm"
}
],
"Fields": []
}, {
"Name": "cta_text",
"Path": "/Content/cta_text",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "cta_text"
}
],
"Fields": []
}, {
"Name": "thank_you_link",
"Path": "/Content/thank_you_link",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "thank_you_link"
}
],
"Fields": []
}, {
"Name": "error_link",
"Path": "/Content/error_link",
"IsMultiValue": false,
"Semantics": [{
"Prefix": "tri",
"Entity": "Content",
"Property": "error_link"
}
],
"Fields": []
}
],
"Semantics": [{
"Prefix": "tri",
"Entity": "Content"
}
]
}
And sematic entity is always content
. It is supposed to be SubscriptionType
, isn't it?
Any help appreciated!
Issue Resolved
As per Rick's comment, For some reason publish settigns was pointing to old version of DXA and after registering embedded type everthign worked like charm!
BinaryData/xyz/system/mappings/schemas.json
and find the relevants Schemas there. Also have a look at the DXA log file with DEBUG logging enabled.schemas.json
is up-to-date)