/cl-transit

Transit format for Common Lisp

Primary LanguageCommon LispMIT LicenseMIT

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 type Write accepts Read returns
null 'null 'null
string string string
boolean boolean boolean
integer fixnum integer
decimal float float
keyword keyword keyword
symbol symbol symbol
big integer integer integer
big decimal long-float long-float
time lt:timestamp lt:timestamp or clt:tr-timestamp
uri quri:uri quri:uri
uuid uuid:uuid uuid:uuid
char character character
array vector vector
list list list
set fset:set fset:set
map hash-table hash-table
link clt:tr-link clt:tr-link
ratio ratio ratio

Contributing

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

Copyright and License

Copyright © 2023, 2024 Jan Sulmont

License: MIT