lbovet / docson

Documentation for your JSON types
Apache License 2.0
491 stars 97 forks source link

Support of `required` keyword #72

Open sserhii-95 opened 6 years ago

sserhii-95 commented 6 years ago

Please add support of required keyword. It would be nice to have some little label near field name, that is in the 'required array'

cwalther commented 5 years ago

Unless I’m misunderstanding the request, this is already supported (and has been for a long time). Maybe the bold font used for it is not noticeable enough? One version I have lying around here adds an asterisk, but I can’t find that in any Git revision, so maybe I added it myself?

diff --git a/public/css/docson.css b/public/css/docson.css
index e315b22..803566a 100644
--- a/public/css/docson.css
+++ b/public/css/docson.css
@@ -181,8 +181,13 @@
 .docson .required {
     font-weight: bold;
 }

+.docson .required:after {
+   content: " *";
+   color: #880000;
+}
+
 .docson .type-keyword {
     font-size: 80%;
     color: dimgray;
 }
cwalther commented 5 years ago

Oh, and, probably a duplicate of #30.