4

I have an issue in DXA 1.7 that when the Schema field XML Name contains an 's' at the end. The published JSON is correct and does contain the content.

This does not occur with multi-value fields without the trailing 's'.

What is the functionality within DXA that expects a multi-value field to not contain an 's', and is there a way to disable or remove this behaviour?

If not, I understand I can add an addition 's' to the end of the property name, so my new property would be called component_linkss

5

The DXA semantic mapping logic tries to "de-pluralize" List-type property names. For example, if a List-type View Model property is called "Articles" (plural), it implicitly maps to a CM field called "article" (singular).

The rationale behind this de-pluralization is that it is a common practice in CM to give multi-value fields a singular name; the field name is used as the XML element name and XML elements are used for each field value.

However, it has become clear by now that this de-pluralization logic is not obvious and causes a lot of confusion for people. Furthermore, the implementation is oversimplified (it simply removes the trailing "s" if any) and hence only works properly for some english names. For example, a List-type property called "Buses" will implicitly map to a CM field called "buse" (rather than "bus").

So: it seems the "smartness" in the implicit mapping is doing more harm than good; I think it makes sense to report this as an issue on GitHub.

However, there is an easy work-around for this issue: don't rely on the implicit mapping, but use explicit semantic mapping. For example:

[SemanticProperty("bus")] List<Bus> Buses

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.