haxetink / tink_querystring

Macro powered query string parsing and composition.
The Unlicense
10 stars 7 forks source link

Handle optional final fields #22

Closed kevinresol closed 3 years ago

kevinresol commented 3 years ago

2nd attempt on optional final fields.

Note that this is technically a breaking change. Because in the past optional fields are not created when the querystring being parsed does not contain the entry. But now, they will be set to null instead.

i.e. for the example code: Reflect.hasField(parse(('foo=1':{foo:Int, ?bar:Int})), 'bar'); was: false now: true

back2dos commented 3 years ago

Because in the past optional fields are not created when the querystring being parsed does not contain the entry.

Personally I don't mind, but weren't you working with document stores that start deleting data if an update object has a null field rather than a non-existent one?

kevinresol commented 3 years ago

Yeah, but in tink_json we resorted to use Option to deal with that. I think we can do the same here.

back2dos commented 3 years ago

Oh, totally forgot about that. Ok, cool then, I suppose ;)