Login
cl-remimarshal
Login

CL-RemiMarshal

CL-RemiMarshal is a library for Common Lisp that allows automatic marshalling/serializing of JSON and YAML data to and from CLOS classes.

CL-RemiMarshal is entirely written and maintained by one person, Remilia Scarlet! If you want to support her and CL-RemiMarshal, you can buy her a coffee on Ko-Fi, or support her through Liberapay. Support is greatly appreciated for this volunteer effort ^_^

Buy Me a Coffee at ko-fi.com Donate using Liberapay

How do I get set up?

Most dependencies can be installed via Quicklisp. Check the .asd file to see what you'll need. The CL-SDM and CL-RemiYaml dependencies cannot, however, be installed from Quicklisp at the time of writing. This can instead be obtained from:

Once you have CL-SDM and CL-RemiYaml, put it (and this library) somewhere where ASDF can find them, then run this in a REPL:

(asdf:load-system :cl-remimarshal)

Usage

(asdf:load-system :cl-remimarshal)

(defclass data-config ()
  ((store-data?
    :initarg :store-data?
    :initform nil
    :yaml-type :bool
    :accessor data-config-store-data-p))
  (:metaclass cl-remimarshal-yaml:yaml-unmarshalable))

(defclass config ()
  ((username
    :initarg :username
    :initform ""
    :yaml-type :string
    :accessor config-username)

   (hostname
    :initarg :hostname
    :initform nil
    :key-name "host"
    :yaml-type :string?
    :accessor config-hostname)
    
   (data-config
    :initform (make-instance 'data-config)
    :key-name "data"
    :yaml-type (:class data-config)))
  (:metaclass cl-remimarshal-yaml:yaml-unmarshalable))

;; Read a file into a new CONFIG instance.
(cl-remimarshal:unmarshal #P"/path/to/config.yaml" 'config)

;; Marshal a new instance to a string.
(cl-remimarshal:marshal-to-string (make-instance 'config))

Development

Style info

I use a slightly unorthodox style for my code. Aside from these differences, please use normal Lisp formatting.

How do I contribute?

  1. Go to https://chiselapp.com/user/MistressRemilia/repository/cl-remimarshal and clone the Fossil repository.
  2. Create a new branch for your feature.
  3. Push locally to the new branch.
  4. Create a bundle with Fossil that contains your changes.
  5. Get in contact with Remilia via email, Fediverse, or open a ticket.

Contributors

Links and Licenses

CL-RemiMarshal is under the GNU Affero General Public License version 3.