All Projects → borkdude → spartan.spec

borkdude / spartan.spec

Licence: EPL-1.0 license
A spartan version of clojure.spec compatible with babashka

Programming Languages

clojure
4091 projects
shell
77523 projects

Projects that are alternatives of or similar to spartan.spec

clausejs
Write contract once. Get data & function validators & conformers, an accurate & readable project contract, auto-generated API documentation, generative test coverage, plus more. A tool that enables a more predictable workflow for developing your JavaScript projects.
Stars: ✭ 29 (+0%)
Mutual labels:  clojure-spec
ffclj
Clojure ffmpeg wrapper
Stars: ✭ 42 (+44.83%)
Mutual labels:  babashka
nota
Static Markdown Blog/Site using Fulcro & Pathom with no backend
Stars: ✭ 35 (+20.69%)
Mutual labels:  babashka
defn-spec
Define Clojure specs inline with your function definitions
Stars: ✭ 67 (+131.03%)
Mutual labels:  clojure-spec
talltale
A Clojure/ClojureScript Fake Data Generator Library
Stars: ✭ 62 (+113.79%)
Mutual labels:  clojure-spec
jirazzz
A jira rest client for the command line, written in clojure as a babashka script.
Stars: ✭ 26 (-10.34%)
Mutual labels:  babashka
specialist-server
Spec-driven Clojure GraphQL server
Stars: ✭ 68 (+134.48%)
Mutual labels:  clojure-spec
swagger-spec
Spec for Swagger 2.0 definition
Stars: ✭ 17 (-41.38%)
Mutual labels:  clojure-spec
babashka-sql-pods
Babashka pods for SQL databases
Stars: ✭ 64 (+120.69%)
Mutual labels:  babashka
corona cases
🦠 Coronavirus Information on Telegram Chatbot
Stars: ✭ 19 (-34.48%)
Mutual labels:  babashka
holy-lambda
The extraordinary simple, performant, and extensible custom AWS Lambda runtime for Clojure.
Stars: ✭ 318 (+996.55%)
Mutual labels:  babashka
piggy
Test for spec compatibility and breaking changes.
Stars: ✭ 45 (+55.17%)
Mutual labels:  clojure-spec
meta-schema
Little DSL to make data processing sane with clojure.spec and spec-tools
Stars: ✭ 25 (-13.79%)
Mutual labels:  clojure-spec
advent-of-cljc
Cross platform Clojure Advent of Code solutions
Stars: ✭ 44 (+51.72%)
Mutual labels:  clojure-spec
Babashka
Native, fast starting Clojure interpreter for scripting
Stars: ✭ 2,462 (+8389.66%)
Mutual labels:  babashka
process
Shell out in Clojure with simplicity and ease
Stars: ✭ 116 (+300%)
Mutual labels:  babashka
bb-clis
Babashka CLIs
Stars: ✭ 46 (+58.62%)
Mutual labels:  babashka
scoop-clojure
Install Clojure on Windows with Scoop
Stars: ✭ 73 (+151.72%)
Mutual labels:  babashka
nbb
Scripting in Clojure on Node.js using SCI.
Stars: ✭ 461 (+1489.66%)
Mutual labels:  babashka

spartan.spec

project chat

This project is archived in favor of babashka/spec.alpha.

A spartan implementation of clojure.spec.alpha compatible with babashka (>= 0.2.5) and Clojure.

Rationale

Currently babashka doesn't have a built-in implementation of clojure.spec.alpha. This library can be used meanwhile. If the application of spec in scripting turns out to be useful, babashka will probably bundle a built-in implementation of spec2 at some point which will be more performant than this interpreted version.

Differences with clojure.spec.alpha

  • No generators (yet)
  • No fdef (yet)

Usage:

Usage in a deps.edn project:

borkdude/spartan.spec {:git/url "https://github.com/borkdude/spartan.spec"
                       :sha "12947185b4f8b8ff8ee3bc0f19c98dbde54d4c90"}

Requiring spartan.spec will create a namespace clojure.spec.alpha for compatibility.

Example

This is an example that you can run with babashka:

(ns expound
  (:require [babashka.deps :as deps]))

(deps/add-deps
 '{:deps {borkdude/spartan.spec {:git/url "https://github.com/borkdude/spartan.spec"
                                 :sha "12947185b4f8b8ff8ee3bc0f19c98dbde54d4c90"}
          expound/expound {:mvn/version "0.8.9"}}})

;; Loading spartan.spec will create a namespace clojure.spec.alpha for compatibility:
(require 'spartan.spec)
(alias 's 'clojure.spec.alpha)

;; Expound expects some vars to be there, like `with-gen`. Spartan prints warnings that these are used, but doesn't implement them yet.
(require '[expound.alpha :as expound])

(s/def ::a (s/cat :i int? :j string?))

(expound/expound ::a [1 2])

Output:

-- Spec failed --------------------

  [... 2]
       ^

should satisfy

  string?

-- Relevant specs -------

:expound/a:
  (clojure.spec.alpha/cat :i clojure.core/int? :j clojure.core/string?)

-------------------------

Tests

Install babashka and deps.clj. Then run script/test.

License

Copyright © 2020 Michiel Borkent

Distributed under the EPL License. See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].