Skip to content

Relax requirements for vibe.data.json using toJson? #17

@vpanteleev-sym

Description

@vpanteleev-sym

Currently, vibe.data.json will only call toJson if both toJson and fromJson is defined.

However, not all applications require both serialization and deserialization.

I'm also wondering if it would make sense to simply check if something called toJson exists on the object. The reason is that the current method, which performs speculative compilation, hides any errors in the implementation of toJson and fromJson - if the method exists, but the speculative call fails for any reason, then it is treated as if it's absent, which usually leads to incorrect serialization instead of an explicit error. This is especially relevant when these methods are templated, which can be useful when we have many types, out of which only some will actually need to be serialized, to reduce the total amount of compiled code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions