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.
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.
- Keep lines 118 characters or shorter. Obviously sometimes you can't, but please try. Use 115 characters for Markdown files, though.
- I mark types using the form
T/....
. For example,T/SOME-NEAT-TYPE
. For predicates on these, useSOME-NEAT-TYPE-P
. - No tabs. Only spaces.
How do I contribute?
- Go to https://chiselapp.com/user/MistressRemilia/repository/cl-remimarshal and clone the Fossil repository.
- Create a new branch for your feature.
- Push locally to the new branch.
- Create a bundle with Fossil that contains your changes.
- Get in contact with me.
Contributors
- Remilia Scarlet - creator and maintainer
- Homepage: https://remilia.sdf.org/
- Mastodon: @MistressRemilia@social.sdf.org
- Email: zremiliaz@postzeoz.jpz My real address does not contain Z's
Links and Licenses
CL-RemiMarshal is under the GNU Affero General Public License version 3.