Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 82373

Mendix 6 REST mapping implementation issue with boolean values because they are always default "false" and therefor included.

$
0
0

Default: do not send the empty values.

This does not apply to any boolean because it always either false or true, meaning it is ALWAYS included in your rest request.
Some API's reject this because the booleans are not always expected. To give an example

I have a service that expects me to send the definition of a list of buttons.
These are different types of buttons.
And for one of these expects a boolean value.
So in my model I have the "arrayOfButtons" object with a 1-* association to a button object that contains all the properties for these different types of buttons.
Including the boolean value. 
The problem is that if I now create buttons of this entity type. They always contain the boolean property. And therefor they are included in the REST action I'm doing.

Does anyone know a way to work around this issue?
 

Like for example if I make specializations of the buttons? Will mendix automatically detect the deepest level of specialization? Just tested this myself with the specializations that doesn't work because it will only accept one type of entity. Sending the specialization mixed with the generalized object doesn't get accepted. It will return the error: the given member name 'booleanName' has no corresponding member in this object of type for the objects that don't have the specialization.

Or can I for example restructure my JSON mappings in a way that I can start using the original REST module "primitive" object?


Viewing all articles
Browse latest Browse all 82373

Trending Articles