schema description should be a string [] instead of a string

307 views
Skip to first unread message

Scott Morgan

unread,
Jan 25, 2021, 7:09:22 PM1/25/21
to JSON Schema
Since one of the main purposes of schemas are to encode and communicate metadata,  several colleges and I believe that the JSON schema's description field should be an array of strings instead of a single string.
  This would greatly improve the human readability of the schemas themselves, by allowing multiple lines in many text editors that are NOT word wrapping by default.

{ "$id": "https://example.com/address.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", "description": "An address similar to http://microformats.org/wiki/h-card", "type": "object", 
 "properties": { 
    "post-office-box": { 
       "type": "string",
        "description": ["This is often a box at the post office",
            "that is paid for on a monthly or yearly basis.  ",
            "If you use a PO Box as your main address, google will NOT",
            "let you register your S-Corp on my google business, wtf,"]
     }, 
     "extended-address": { 
          "type": "string",
          "description ": "I can NOT read really long lines in JSON schemas that have to be on a single line in my json text editors and it's driving me NUTs!"
     },

Henry Andrews

unread,
Jan 25, 2021, 7:55:04 PM1/25/21
to JSON Schema
This mailing list is pretty sparsely monitored- for this kind of suggestion you are better off on GitHub or Slack.

However, I can tell you that a.) the current "description" keyword is unlikely to be changed because there is tons of code like documentation generators that rely on it, and b.) an array of strings keyword would be super-easy as an extension vocabulary in the latest draft, which supports extensions.

Personally, I write my JSON Schemas in YAML and have them converted to JSON as a build step as that's a lot easier than futzing about with an array of strings to me.

cheers,
-henry

--
You received this message because you are subscribed to the Google Groups "JSON Schema" group.
To unsubscribe from this group and stop receiving emails from it, send an email to json-schema...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/json-schema/c2978c2e-187a-476e-9092-771c9e0ef114n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages