Login
cl-remimarshal
Login

CL-RemiMarshal

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

Wanna support Remilia? Buy me a coffee on Ko-Fi, or support me through Liberapay.

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

How do I get set up?

Most dependencies can be installed via Quicklisp. The CL-SDM dependency cannot, however. This can be obtained from:

Once you have CL-SDM, 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 me.

Contributors

Links and Licenses

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