feat: document plain values (#12)

* feat: document plain values

Adds `d.val` to attach type and help information to plain Jsonnet
values, apart from specially treated `fn` and `obj`.

* feat: defaults
This commit is contained in:
sh0rez 2020-07-27 16:59:04 +02:00 committed by GitHub
parent 4c6f532e05
commit 2f9dcb2d21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 99 additions and 11 deletions

View file

@ -73,6 +73,18 @@
'#arg': self.argument['#new'] + self.func.withHelp('`arg` is a shorthand for `argument.new`'),
arg:: self.argument.new,
"#value": d.obj("Utilities for documenting plain Jsonnet values (primitives)"),
value:: {
"#new": d.fn("new creates a new object of given type, optionally with description and default value", [d.arg("type", d.T.string), d.arg("help", d.T.string), d.arg("default", d.T.any)]),
new(type, help='', default=null): { 'value': {
help: help,
type: type,
default: default,
} }
},
'#val': self.value['#new'] + self.func.withHelp('`val` is a shorthand for `value.new`'),
val: self.value.new,
// T contains constants for the Jsonnet types
T:: {
string: 'string',