metosin / spec-swagger

Master Swagger2 & OpenAPI3 specs with Clojure(Script) & clojure.spec
21 stars 2 forks source link

Swagger2 spec validator #7

Open ikitommi opened 7 years ago

ikitommi commented 7 years ago

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"]})
miikka commented 7 years ago

Why not just use the one in ring-swagger?

ikitommi commented 7 years ago

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?

miikka commented 7 years ago

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.

ikitommi commented 7 years ago

ok, so this could be the plan: 1) copy-paste the validator here to make spec-swagger independent for now. 2) modularize/split ring-swagger into parts when spec-swagger is "done". Parts could be something like core, routes, validator, schema, spec and a all. Like Ring.