spec-swagger icon indicating copy to clipboard operation
spec-swagger copied to clipboard

Swagger2 spec validator

Open ikitommi opened this issue 8 years ago • 4 comments

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"]})

ikitommi avatar May 07 '17 14:05 ikitommi

Why not just use the one in ring-swagger?

miikka avatar May 08 '17 05:05 miikka

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?

ikitommi avatar May 08 '17 06:05 ikitommi

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.

miikka avatar May 08 '17 08:05 miikka

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.

ikitommi avatar May 08 '17 09:05 ikitommi