| 44 | } |
| 45 | |
| 46 | VersionedJson VersionedJson::fromJson(Json const& source) { |
| 47 | // Old versions of VersionedJson used '__' to distinguish between actual |
| 48 | // content and versioned content, but this is no longer necessary or |
| 49 | // relevant. |
| 50 | auto id = source.optString("id").orMaybe(source.optString("__id")); |
| 51 | auto version = source.optUInt("version").orMaybe(source.optUInt("__version")); |
| 52 | auto content = source.opt("content").orMaybe(source.opt("__content")); |
| 53 | return {*id, (VersionNumber)*version, *content}; |
| 54 | } |
| 55 | |
| 56 | bool VersionedJson::empty() const { |
| 57 | return content.isNull(); |