Skip to content

Releases: gabbhack/deser

v0.3.2

Choose a tag to compare

@gabbhack gabbhack released this 11 Apr 16:01
326df8d

What's Changed

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

v0.3.1

Choose a tag to compare

@gabbhack gabbhack released this 05 Feb 15:34

v0.3.0

Choose a tag to compare

@gabbhack gabbhack released this 04 Feb 16:35

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

Choose a tag to compare

@gabbhack gabbhack released this 24 Aug 15:54
7346b07

What's Changed

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

v0.2.0

Choose a tag to compare

@gabbhack gabbhack released this 24 Aug 11:11

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

v0.1.7

v0.1.7 Pre-release
Pre-release

Choose a tag to compare

@gabbhack gabbhack released this 05 Nov 09:02
Tests run on push and PR, docs on release

v0.1.5

v0.1.5 Pre-release
Pre-release

Choose a tag to compare

@gabbhack gabbhack released this 26 Oct 14:58

Rewritten serialization

v0.1.4

v0.1.4 Pre-release
Pre-release

Choose a tag to compare

@gabbhack gabbhack released this 21 Dec 15:13
  • Avoid generating an extra isSkip check - c1ce60f

v0.1.3

v0.1.3 Pre-release
Pre-release

Choose a tag to compare

@gabbhack gabbhack released this 15 Dec 16:33
  • Fix bug with break statement

v0.1.2

v0.1.2 Pre-release
Pre-release

Choose a tag to compare

@gabbhack gabbhack released this 14 Dec 06:51
[skip-docs] Up version