janhommes / o.js

o.js - client side oData lib.
https://janhommes.github.io/o.js/example/
MIT License
241 stars 58 forks source link

opertionMapping is dangerous #18

Closed IceOnFire closed 8 years ago

IceOnFire commented 8 years ago

Operation mapping is a nice feature, but can be dangerous in some contexts: I had to disable it when dealing with dates, since they contain dashes ('-'). This results in a date like '2016-03-01' being processed as '2016sub03sub01'.

Maybe we need a smarter jsToOdata function, or remove operation mapping support completely for arithmetic operations.

Antony

janhommes commented 8 years ago

Yes we need a smarter jsToOdata function. I am aware of it and I was looking into http://jsep.from.so/, but it was to much work to do right now.

For the next release: Would it be enough if we remove the following mappings?

        '+': 'add',
        '-': 'sub',
        '.': '/'
IceOnFire commented 8 years ago

Hi Jan,

I commented out the three mappings in my pull request. Filters on dates work pretty fine now.

Antony

janhommes commented 8 years ago

Mappings that are dangerous are remove in #21.

Leave this open to remember that it would be good to have a full expression parser (e.g. http://jsep.from.so/)

janhommes commented 8 years ago

will fix in #26