cl-transit

2024-10-12

Transit library for Common Lisp

Upstream URL

github.com/jsulmont/cl-transit

Author

Jan Sulmont <lisp@janks.dev>

License

MIT, BSD
README

cl-transit: Transit format for Common Lisp

À tout Seigneur tout Honneur !

About Transit

The Transit format has been introduced by Cognitect and defined here.

About cl-transit

  • The library decodes all three official transit format: JSON, JSON-VERBOSE and MESSAGE-PACK.
    • JSON-VERBOSE and JSON are decoded indistinctively
  • The library does not support encoding to JSON-VERBOSE

how to use

TODO a few examples

Runing tests.

The library is able to process all the tests of the official test-suite. It has been developped and tested with SBCL but should work on other CL implementations.

Prerequisites:

  • install SBCL (homebrew, apt-get ...)
  • install quicklisp
  • until this commit has made it to quicklisp (monthly), you need manually clone JZON to your local quicklisp directory e.g.,
$ mkdir -p ~/quicklisp/local-projects
$ cd ~/quicklisp/local-projects
$ git clone https://github.com/Zulu-Inuoe/jzon
  • until this commit has made it to quicklisp (monthly), you need manually clone cl-messagepack to your local quicklisp directory e.g.,
$ mkdir -p ~/quicklisp/local-projects
$ cd ~/quicklisp/local-projects
$ git clone https://github.com/mbrezu/cl-messagepack

then

% make test
sbcl --non-interactive \
		--load run-tests.lisp
This is SBCL 2.3.6.110-c6fdc82a8-WIP, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
To load "cl-transit-tests":
  Load 1 ASDF system:
    cl-transit-tests
; Loading "cl-transit-tests"
.............................


Running test suite TEST-EXAMPLAR
 Running test JSON-VERBOSE-MP-DECODE-TO-SAME ..................................................................................................................................
 Running test DECODE-MARSHALABLE ........................................................................................................................................................................
 Running test RND-TRIP-MARSHALABE ................................................................................................................
 Running test ONE-URI .....
 Running test URIS .....
 Running test ONE-UUID .....
 Running test UUIDS .....
 Running test ONE-DATE .....
 Running test SET-EMPTY .....
 Running test SET-SIMPLE .....
 Running test SET-NESTED .....
 Running test SET-MIXED .....
 Running test MAPS-UNROCOGNIZED-KEYS .....
 Running test TRANSIT-LINK ..
 Running test RATIO ....
 Running test DOTTED-PAIR ..
 Did 468 checks.
    Pass: 468 (100%)
    Skip: 0 ( 0%)
    Fail: 0 ( 0%)

Default Type Mapping

clt is short for cl-transit lt short for local-time and see here for fset:set.

Transit typeWrite acceptsRead returns
null'null'null
stringstringstring
booleanbooleanboolean
integerfixnuminteger
decimalfloatfloat
keywordkeywordkeyword
symbolsymbolsymbol
big integerintegerinteger
big decimallong-floatlong-float
timelt:timestamplt:timestamp or clt:tr-timestamp
uriquri:uriquri:uri
uuiduuid:uuiduuid:uuid
charcharactercharacter
arrayvectorvector
listlistlist
setfset:setfset:set
maphash-tablehash-table
linkclt:tr-linkclt:tr-link
ratioratioratio

Contributing

Happy to take contributions, and any kind of improvments (performance, coding style ...)

Copyright and License

Copyright © 2023, 2024 Jan Sulmont

License: MIT

Dependencies (14)

  • alexandria
  • bit-smasher
  • cl-frugal-uuid
  • cl-marshal
  • cl-messagepack
  • dexador
  • fiveam
  • flexi-streams
  • fset
  • jzon
  • local-time
  • parse-float
  • quri
  • serapeum

Dependents (0)

    • GitHub
    • Quicklisp