      (is (= {:status 422
              :errors [{:path field-path
                        :errors errors}]}
+            (select-keys response [:status :errors]))))))
+
+(defn assert-invalid-schema
+  ([coll-attributes errors]
+   (assert-invalid coll-attributes errors nil))
+  ([coll-attributes errors options]
+   (let [response (d/ingest "PROV1" (dc/collection coll-attributes)
+                            (merge {:allow-failure? true} options))]
+     (is (= {:status 422
+             :errors [errors]}
             (select-keys response [:status :errors]))))))
 
 (defn assert-invalid-keywords

    (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                 (dc/psa {:name "bool2" :data-type :boolean :value true})]}))

  (testing "Enabling UMM-C JSON-Schema validation through Cmr-Validate-Umm-C header being true"
    ;; create collection valid against echo10 but invalid against schema
    (let [response (d/ingest "PROV1" (dc/collection {:product-specific-attributes
                                                     [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                      (dc/psa {:name "bool2" :data-type :boolean :value true})]})
                             {:allow-failure? true :validate-umm-c true})]
      (is (= {:status 422
              :errors ["object has missing required properties ([\"ProcessingLevel\",\"RelatedUrls\",\"ScienceKeywords\",\"SpatialExtent\"])"]}
             (select-keys response [:status :errors]))))
    (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                 (dc/psa {:name "bool2" :data-type :boolean :value true})]}))
  (testing "Enabling UMM-C JSON-Schema validation through Cmr-Validate-Umm-C header being false"
    ;; create collection valid against echo10 but invalid against schema
    (let [response (d/ingest "PROV1" (dc/collection {:product-specific-attributes
                                                     [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                      (dc/psa {:name "bool2" :data-type :boolean :value true})]})
                             {:allow-failure? true :validate-umm-c false})]
      (is (= {:status 200}
             (select-keys response [:status :errors]))))
    (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                 (dc/psa {:name "bool2" :data-type :boolean :value true})]}))
  (testing "Enabling UMM-C JSON-Schema validation through Cmr-Validate-Umm-C header being absent"
    ;; create collection valid against echo10 but invalid against schema
    (let [response (d/ingest "PROV1" (dc/collection {:product-specific-attributes
                                                     [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                      (dc/psa {:name "bool2" :data-type :boolean :value true})]})
                             {:allow-failure? true})]
      (is (= {:status 200} 
             (select-keys response [:status :errors]))))
    (assert-valid {:product-specific-attributes [(dc/psa {:name "bool1" :data-type :boolean :value true})
                                                 (dc/psa {:name "bool2" :data-type :boolean :value true})]})) 
  
  (testing "Enabling UMM-Spec validation through Cmr-Validate-Umm-C header being true"
    ;; create a collection that's  valid against schema validation, but invalid against umm-spec validation
    (assert-invalid
      {:processing-level-id "1"
       :science-keywords [(dc/science-keyword {:category "upcase"
                                               :topic "Cool"
                                               :term "Mild"})]
       :spatial-coverage (dc/spatial {:gsr :cartesian})
       :related-urls [(dc/related-url {:type "type" :url "http://www.foo.com"})]
       :product-specific-attributes
       [(dc/psa {:name "bool" :data-type :boolean :value true})
        (dc/psa {:name "bool" :data-type :boolean :value true})]}
      ["AdditionalAttributes"]
      ["Additional Attributes must be unique. This contains duplicates named [bool]."]
      {:validate-umm-c true}))
  (testing "Enabling UMM-Spec validation through Cmr-Validate-Umm-C header being false"
    ;; create a collection that's  valid against schema validation, but invalid against umm-spec validation
    (assert-invalid
      {:processing-level-id "1"
       :science-keywords [(dc/science-keyword {:category "upcase"
                                               :topic "Cool"
                                               :term "Mild"})]
       :spatial-coverage (dc/spatial {:gsr :cartesian})
       :related-urls [(dc/related-url {:type "type" :url "http://www.foo.com"})]
       :product-specific-attributes
       [(dc/psa {:name "bool" :data-type :boolean :value true})
        (dc/psa {:name "bool" :data-type :boolean :value true})]}
      ["ProductSpecificAttributes"]
      ["Product Specific Attributes must be unique. This contains duplicates named [bool]."]
      {:validate-umm-c false}))
  (testing "Enabling UMM-Spec validation through Cmr-Validate-Umm-C header being absent"
    ;; create a collection that's  valid against schema validation, but invalid against umm-spec validation
    (assert-invalid
      {:processing-level-id "1"
       :science-keywords [(dc/science-keyword {:category "upcase"
                                               :topic "Cool"
                                               :term "Mild"})]
       :spatial-coverage (dc/spatial {:gsr :cartesian})
       :related-urls [(dc/related-url {:type "type" :url "http://www.foo.com"})]
       :product-specific-attributes
       [(dc/psa {:name "bool" :data-type :boolean :value true})
        (dc/psa {:name "bool" :data-type :boolean :value true})]}
      ["ProductSpecificAttributes"]
      ["Product Specific Attributes must be unique. This contains duplicates named [bool]."]))

  (side/eval-form `(icfg/set-return-umm-spec-validation-errors! true))


       [(dc/psa {:name "bool" :data-type :boolean :value true})
        (dc/psa {:name "bool" :data-type :boolean :value true})]}
      ["AdditionalAttributes"]
      ["Additional Attributes must be unique. This contains duplicates named [bool]."])) 
  (testing "Nested Path Validation"
    (assert-invalid
      {:platforms [(dc/platform {:instruments [(dc/instrument {:short-name "I1"})
