Open ThisIsDemetrio opened 7 months ago
I'm interested in this issue. The main problem is that we need to potentially change our data model to avoid this limitation. It could be a very nice addition for the crud. Also: if the console would allow us to specify nested objects data models graphically, it would be even better
Feature Description
Working with the CRUD Service, we noticed that all the values included in request body are casted to the relative type, accordingly to the JSON Schema definition, but this works only on first-level fields.
As example, taking into account the books collection definition, the
publishDate
property have typeDate
because I want it to be transformed from a string to an ISODate. The same doesn't happen from the propertydate
insideeditionDates
, which is a{ type: "string", format: "date-time" }
but it is located inside an array, and any POST/PUT/PATCH operation will save the value as a regular string (or whatever it is included in the request body).Desired solution
The function
QueryParser.traverseBody
is used to transform values of every field defined in the JSON Schema definition.It would be great if the method would be recursive, and operates inside objects and arrays.
The property
fieldDefinition
already contains the definitions also for nested types (after #252), so that part is already done.Possible alternatives
Unfortunately there are no alternative for this issue, other than having these fields at root level. If a property must be included into an array, however, the problem persist.