spec-swagger
spec-swagger copied to clipboard
Swagger2 spec validator
Should be available for Clojure in a separate ns just like it's in ring-swagger.
(require '[spec-swagger.swagger2.validator :as v])
(v/validate {:swagger "2.0"})
; ({:level "error",
; :schema {:loadingURI "#", :pointer ""},
; :instance {:pointer ""},
; :domain "validation",
; :keyword "required",
; :message "object has missing required properties ([\"info\",\"paths\"])",
; :required ["info" "paths" "swagger"],
; :missing ["info" "paths"]})
Why not just use the one in ring-swagger?
yes. As long as these are separate libs, would be cool not to need to depend on ring-swagger from spec-side. Lots of deps. ring-swagger 1.0.0 could be a modularized version supporting both schema & spec, as modules, some how... is this sound?
Well, it should be easy enough to split out the validator from ring-swagger. It adds a bit of maintenance burden, but on the other hand, I think the validator has been quite stable compared to the other parts of ring-swagger.
ok, so this could be the plan:
- copy-paste the validator here to make spec-swagger independent for now.
- modularize/split ring-swagger into parts when spec-swagger is "done". Parts could be something like
core,routes,validator,schema,specand aall. Like Ring.