Empty structs were being serialized as `null`, when they should have been serialized as `{}`.
This was due to the type inference on the serializer - where no calls to `field()` would result in the default `null` type.
To solve this, the `serialize(const void* object, const std::initializer_list<Field>&)` inline helper has been promoted to a virtual function (and renamed to `fields()`).
The JSON serializer implementation of this now first sets the object type to `object`, even if there are no fields to serialize.
Added test for this.
Fixes: #10
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| any_test.cpp | Loading commit data... | |
| chan.h | Loading commit data... | |
| chan_test.cpp | Loading commit data... | |
| content_stream.cpp | Loading commit data... | |
| content_stream.h | Loading commit data... | |
| content_stream_test.cpp | Loading commit data... | |
| dap_test.cpp | Loading commit data... | |
| io.cpp | Loading commit data... | |
| json_serializer.cpp | Loading commit data... | |
| json_serializer.h | Loading commit data... | |
| json_serializer_test.cpp | Loading commit data... | |
| network.cpp | Loading commit data... | |
| network_test.cpp | Loading commit data... | |
| optional_test.cpp | Loading commit data... | |
| protocol_events.cpp | Loading commit data... | |
| protocol_requests.cpp | Loading commit data... | |
| protocol_response.cpp | Loading commit data... | |
| protocol_types.cpp | Loading commit data... | |
| session.cpp | Loading commit data... | |
| session_test.cpp | Loading commit data... | |
| socket.cpp | Loading commit data... | |
| socket.h | Loading commit data... | |
| string_buffer.h | Loading commit data... | |
| typeof.cpp | Loading commit data... | |
| variant_test.cpp | Loading commit data... |