Skip to content

Commit 3baa56f

Browse files
committed
Add enums to description
1 parent 3114f13 commit 3baa56f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

schema.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type schema struct {
2727
Properties map[string]*schema `json:"properties,omitempty"`
2828
Items *schema `json:"items,omitempty"`
2929
Definitions map[string]*schema `json:"definitions,omitempty"`
30+
Enum []string `json:"enum"`
3031
}
3132

3233
func newSchema(r io.Reader, workingDir string) (*schema, error) {
@@ -159,7 +160,13 @@ func printProperties(w io.Writer, s *schema) {
159160
required = "No"
160161
}
161162

162-
rows = append(rows, []string{fmt.Sprintf("`%s`", k), propType, required, p.Description})
163+
desc := p.Description
164+
165+
if len(p.Enum) > 0 {
166+
desc += " Possible values are: `" + strings.Join(p.Enum, "`, `") + "`."
167+
}
168+
169+
rows = append(rows, []string{fmt.Sprintf("`%s`", k), propType, required, strings.TrimSpace(desc)})
163170
}
164171

165172
// Sort by the required column, then by the name column.

0 commit comments

Comments
 (0)