Jaguar-dart / jaguar_serializer

Format (JSON, XML, protobuf, mongodb, etc) and platform (server, client) agnostic serialization framework
172 stars 34 forks source link

DynamicProcessor should not validate #143

Closed lejard-h closed 6 years ago

lejard-h commented 6 years ago

Dynamic processor should let pass everything

Iterable, DateTime, Object ...

The goal is to tell the serializer to not process the field.

lejard-h commented 6 years ago

same for const Field(dontEncode: true, dontDecode: true);

this should work.

final map = { 'date': new DateTime() };

final obj = serializer.fromMap(map);
tejainece commented 6 years ago

dontEncode and dontDecode mean ignore while encoding and ignore while decoding, respectively. They don't mean "just pass as it is".

tejainece commented 6 years ago

Should there be a PassAllProcessor?

DynamicProcessor processes dynamic fields by default, if no processor is set on it. It is supposed to only parse valid fields.

tejainece commented 6 years ago

Please reopen, if it is still an issue.

lejard-h commented 6 years ago

Yes it is an issue, for example, firebase provide partially decoded object with Datetime, like the example I provide

tejainece commented 6 years ago

Would a PassAllProcessor fit the need?

lejard-h commented 6 years ago

Something like that I guess

tejainece commented 6 years ago

Would you like to write the pull request?

I don't use firebase. It is probably easier for you to test that it works with firebase as well.

lejard-h commented 6 years ago

It won't be possible sorry, passing my test below is enough, it should work with any object

tejainece commented 6 years ago

Fixed by https://github.com/Jaguar-dart/jaguar_serializer/pull/145/commits/57ac08f53a822f5ba0d9a4a0812eb68d75037960

tejainece commented 6 years ago

Use PassProcessor by default for dynamic fields

tejainece commented 6 years ago

Fixed by https://github.com/Jaguar-dart/jaguar_serializer/commit/3d0619c24c65783a7189b57ce8ffdc722e79e2f7