UnderstandLingBV / Tuktu

Big Data Science Swiss Army Knife - http://www.tuktu.io --
http://www.understandling.com
Other
60 stars 16 forks source link

tuktu.api.utils.fieldParser and .jsonParser should behave the same #49

Closed NTPape closed 8 years ago

NTPape commented 8 years ago

fieldParser returns null if no defaultValue is specified, jsonParser returns the "best match". (If best match really is needed sometimes, maybe make that a parameter for both instead.)

It may also be advisable to have both functions return Options instead of tossing any nulls around at all, because otherwise there's not really a way to distinguish between a null in the datum / JSON and non-existence of the path.

Moreover, the defaultValue for fieldParser should probably be of type Any. And once we make the switch to the jsonParser, we could use tuktu.api.utils.AnyToJsValue to convert it for the jsonParser.