Upgrade to Mx10 gives new error in OData: The exposed name cannot be the same as the exposed name of the containing entity

0
Hi community, When I try to upgrade my Mx 9 project to Mx 10, I get a new error in my existing published OData service. It states "The exposed name cannot be the same as the exposed name of the containing entity". This error is clear to me, as it points me to multiple instances where the attribute name is the same as the entity name. So resolving can be easily achieved by renaming either the entity or attribute. My question: Why is this an issue all of a sudden? Do you see any good reason for this? I'm still using OData 3. Let's say I use an entity for Status having an attribute Status and an association to link an item to its Status. Why is the exposed attribute Status an invalid attribute name and should I rename this? Hopefully someone knows this!
asked
2 answers
1

Response from Mendix Support (Sep '24):

We checked the OData v3 spec and can see that it forbids this scenario too:

https://www.odata.org/documentation/odata-version-3-0/common-schema-definition-language-csdl/ subsection 6 "Entity Type Constructs":

  • Properties MUST NOT have the same name as the declaring entity type.

 The release notes of Mendix 10.0.0 contain the following note:

  • For published OData Services, Studio Pro now gives a consistency error when the exposed name of an attribute or association is the same as the exposed name of its entity, because that is not valid according to the OData standard.
answered
1

We had the same issue and did find an easy workaround with changing capitals which had no effect for our consumers: for example if the original attribute is "STATUS" change it to "Status". May not look nice in the definition, may not work for all kind of consumers, but for us the error was gone and our consumers didn't need to do any changes.

answered