mirror of
https://github.com/TECHNOFAB11/docsonnet.git
synced 2026-02-02 07:35:11 +01:00
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:
parent
4c6f532e05
commit
2f9dcb2d21
8 changed files with 99 additions and 11 deletions
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue