Transit is a data format and set of libraries for conveying values between applications written in different languages. This library provides support for marshalling Transit data to/from ClojureDart.
- Transit Rationale
- Transit Specification
- [transit-cljd API docs] coming soon
This implementation's major.minor version number corresponds to the version of the Transit specification it supports.
NOTE: Transit is intended primarily as a wire protocol for transferring data between applications. If storing Transit data durably, readers and writers are expected to use the same version of Transit and you are responsible for migrating/transforming/re-storing that data when and if the transit format changes.
- Latest release: 0.8.18
As a git dep:
io.github.wevre/transit-cljd {:git/tag "v0.8.18" :git/sha "23812d9"}
(ns main
(:require [wevre.transit-cljd :as transit]
["dart:async" :as async]))
(defn main []
(let [codec (transit/json-codec)
objects ["foo" {:a [1 2]}]
_ (println "Object: " objects)
encoded (await
(-> (async/Stream.fromIterable objects)
(.transform (.-encoder codec))
.toList))
_ (println "Encoded: " encoded)
decoded (await
(-> (async/Stream.fromIterable encoded)
(. #/(cast String))
(.transform (.-decoder codec))
.toList))
_ (println "Decoded: " decoded)]))
Coming soon.
To run the roundtrip verification tests in transit-format
, first ensure
Dart>=2.19.4 and Java 8 are installed, then do the following:
- Set up a testing directory where
transit-format
andtransit-cljd
can be cloned side-by-side. We have a forktransit-format
that has support for testingtransit-cljd
all ready to go. Clone this to your test directory.
mkdir transit-test
cd transit-test
git clone https://github.com/wevre/transit-format.git
# Do something similar to the following to ensure Java 8.
jenv local 1.8
- From the
transit-format
directory, run the verify command.
bin/verify -impls cljd
NOTE: The above instructions might not quite work because of incompatibilities between Java 8 and later versions. ClojureDart has until very recently required Java 11. You might need to manually compile the 'wevre.roundtrip' namespace in Java 11, and then run verify with Java 8.
# Do this in the transit-test directory with Java 11.
git clone git@github.com:wevre/transit-cljd
cd transit-cljd
clj -M:cljd compile wevre.roundtrip
cd ../transit-format
bin/verify -impls cljd
Copyright © 2023 Michael J. Weaver
This library is a ClojureDart port of the Clojure version created and maintained by Cognitect.
Copyright © 2014-2020 Cognitect
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.