Open miikka opened 4 years ago
Hi! As you said in #205 the current implementation only honors the draft-04 contract therefore I thought of only adding a simple function like
(defn- add-schema-key
"As discussed in issue #205 the new drafts are not backward-compatible.
That said, we can only add this new key with the correct value as-is."
[schema]
(assoc schema :$schema "http://json-schema.org/draft-04/schema#"))
And call it in the same places where maybe-with-titles
is used. Is that appropriate? I can open a new PR with this inclusion.
That sounds like a good solution, a PR would be certainly welcome.
As pointed out in #205, the JSON Schema output does not have a top-level key
"$schema"
. According to the draft-04 spec:Since there are now multiple versions of JSON Schema in production use, it'd be wise to include
"$schema"
in spec-tools's output: