Skip to content

Releases: gabbhack/deser

v0.3.2

11 Apr 16:01
326df8d
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.3.1...v0.3.2

v0.3.1

05 Feb 15:34
Compare
Choose a tag to compare

v0.3.0

04 Feb 16:35
Compare
Choose a tag to compare

Breaks

  • Aliases, like type Foo = Bar, no longer supported by makeDe\Serializable macros. You should call make* macro on original type.
  • nil now serialized as the None token instead of dereference error. How to serialize the None token is up to each library. deser_json, for example, serializes it as null. You can skip serializing nil with the skipSerializeIf pragma.

Features

  • Inheritance support. Now all fields of parent objects are serialized together with the fields of child objects. Since the feature is called inheritance, the pragmas are "inherited" from parent objects.
  • renamed, renameSerialize, renameDeserialize can now accept RenameCase enum. Example:
type Foo = object
   firstName {.renamed(SnakeCase).}: string
  • Objects with more than one case on the same level are now supported. An example of how Message deserialization from the Telegram Bot API might look:
type
  MessageContentType = enum
    Text, Audio
  Message {.renameAll(SnakeCase).} = object
    case contentType {.untagged.}: MessageContentType
    of Text:
      text: string
    of Audio:
     audio: Audio

    case isForward {.untagged.}: bool
    of true:
      forwardFrom: User
    of false:
      discard
  • New {.aliases.} pragma. Deserialize field from the given names or from its Nim name. Accepts strings and RenameCase values.
type
  User = object
    nickName {.aliases("username", "login", SnakeCase).}: string
type
  User {.skipPrivate.} = object
    id*: int
    name*: string
    passwordHash: string

Fixes

  • Pragmas that take no arguments can now be used without brackets: {.defaultValue().} -> {.defaultValue.}
  • Correct code generation for case objects having of with multiple conditions
type Foo = object
  case kind: bool
  of true, false:
    discard

v0.2.1

24 Aug 15:54
7346b07
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.2.0...v0.2.1

v0.2.0

24 Aug 11:11
Compare
Choose a tag to compare

Deser is completely rewritten and backwards incompatible. The release is incomplete, the API may break.

v0.1.7

05 Nov 09:02
Compare
Choose a tag to compare
v0.1.7 Pre-release
Pre-release
Tests run on push and PR, docs on release

v0.1.5

26 Oct 14:58
Compare
Choose a tag to compare
v0.1.5 Pre-release
Pre-release

Rewritten serialization

v0.1.4

21 Dec 15:13
Compare
Choose a tag to compare
v0.1.4 Pre-release
Pre-release
  • Avoid generating an extra isSkip check - c1ce60f

v0.1.3

15 Dec 16:33
Compare
Choose a tag to compare
v0.1.3 Pre-release
Pre-release
  • Fix bug with break statement

v0.1.2

14 Dec 06:51
Compare
Choose a tag to compare
v0.1.2 Pre-release
Pre-release
[skip-docs] Up version