        (testing (str "with spec " spec)
          (checking "JSON schema accepts the data generated by the spec gen" 100
            [x (s/gen spec)]
-           (is (nil? (validate x))))))))
+           (is (nil? (validate x)) (str x " (" spec ") does not conform to JSON Schema")))))))
 
-(s/def ::compound (s/keys :req-un [::int] :opt-un [::string]))
+(s/def ::compound (s/keys :req-un [::integer] :opt-un [::string]))
 
 #?(:clj
-   (deftest validating-test
-     (test-spec-conversion ::int)
-     (test-spec-conversion ::string)
-     (test-spec-conversion ::set)
-     (test-spec-conversion ::compound)
-     (test-spec-conversion (s/nilable ::string))
-     (test-spec-conversion (s/int-in 0 100))))
+    (deftest validating-test
+      (test-spec-conversion ::integer)
+      (test-spec-conversion ::string)
+      (test-spec-conversion ::set)
+      (test-spec-conversion ::compound)
+      (test-spec-conversion (s/nilable ::string))
+      (test-spec-conversion (s/int-in 0 100))))
 
 ;; Test the example from README
 

    (is (= (jsc/to-json #{1 2 3}) {:enum [1 3 2]})))
  (testing "clojure.spec predicates"
    (is (= (jsc/to-json (s/nilable ::string)) {:oneOf [{:type "string"} {:type "null"}]}))
    (is (= (jsc/to-json (s/int-in 1 10)) {:allOf [{:type "integer"} {:minimum 1 :maximum 10}]})))
  (testing "simple specs"
    (is (= (jsc/to-json ::int) {:type "integer"}))
    (is (= (jsc/to-json ::set) {:enum [1 3 2]})))
  (testing "composite objects"
    (is (= (jsc/to-json (s/keys :req-un [::int] :opt-un [::string]))
           {:type "object"
            :properties {"int" {:type "integer"} "string" {:type "string"}}
            :required ["int"]}))
    (is (= (jsc/to-json (s/tuple int? string?))
           {:type "array" :items [{:type "integer"} {:type "string"}] :minItems 2}))
    (is (= (jsc/to-json (s/* int?)) {:type "array" :items {:type "integer"}}))
    (is (= (jsc/to-json (s/+ int?)) {:type "array" :items {:type "integer"} :minItems 1}))
    ;; The following tests require the full qualifying of the predicates until
    ;; this is fixed: <http://dev.clojure.org/jira/browse/CLJ-2035>
    (is (= (jsc/to-json (s/every clojure.core/int?)) {:type "array" :items {:type "integer"}}))
    (is (= (jsc/to-json (s/map-of clojure.core/string? clojure.core/integer?))
           {:type "object" :additionalProperties {:type "integer"}})))
  (testing "composite specs"
    (is (= (jsc/to-json (s/or :int int? :string string?))
           {:anyOf [{:type "integer"} {:type "string"}]}))
    (is (= (jsc/to-json (s/and int? pos?))
           {:allOf [{:type "integer"} {:minimum 0 :exclusiveMinimum true}]}))))

#?(:clj

(ns spec-tools.json-schema-test
  (:require [clojure.test :refer [deftest testing is]]
            [clojure.spec :as s]
            [com.gfredericks.test.chuck.clojure-test :refer [checking]]
    #?(:clj
            [scjsv.core :as scjsv])
            [spec-tools.core :as st]
            [spec-tools.json-schema :as jsc]))

(s/def ::integer integer?)
(s/def ::string string?)
(s/def ::set #{1 2 3})

