You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently trying to understand how to implement docsonnet into a library I'm building, but am having a lot of trouble troubleshooting it as pretty much every failure results in a very opaque error:
This error doesn't tell me what actually caused the error. It's obviously receiving an empty field somewhere, but as someone new to doscsonnet, I haven't got a clue how or why. docsonnet --raw outputs something that looks pretty sane to me, but I'm not familiar enough with the tool yet to know valid from invalid.
In this case I have two files:
main.libsonnet:
local d = import'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
{
'#':: d.pkg(
name='mypkg',
url='',
help='Opinionated templates'
),
templates: {
webservice:import'templates/webservicetest.libsonnet'
}
}
templates/webservicetest.libsonnet:
local d = import'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
{
'#':: d.pkg(
name='webservice',
url='',
help='foo'
),
'#new':: d.fn(help=||| `new` returns a new instance of the webservice template|||, args=[
d.arg('name', 'string', 'The name of the webservice'),
d.arg('image', 'string', 'The Docker image to run in the webservice'),
]),
new(name, image): {
name: name,
image: image
}
}
With docsonnet --raw main.libsonnet I get:
{
"#": {
"help": "Opinionated templates",
"import": "",
"name": "mypkg"
},
"templates": {
"webservice": {
"#": {
"help": "foo",
"import": "",
"name": "webservice"
},
"#new": {
"function": {
"args": [
{
"default": "The name of the webservice",
"name": "name",
"type": "string"
},
{
"default": "The Docker image to run in the webservice",
"name": "image",
"type": "string"
}
],
"help": "`new` returns a new instance of the webservice template\n"
}
}
}
}
}
I'm assuming that to someone that knows what they're doing it must be pretty obvious what's wrong there, but a bit more detail in the error messages would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
I'm currently trying to understand how to implement docsonnet into a library I'm building, but am having a lot of trouble troubleshooting it as pretty much every failure results in a very opaque error:
This error doesn't tell me what actually caused the error. It's obviously receiving an empty field somewhere, but as someone new to doscsonnet, I haven't got a clue how or why.
docsonnet --raw
outputs something that looks pretty sane to me, but I'm not familiar enough with the tool yet to know valid from invalid.In this case I have two files:
main.libsonnet:
templates/webservicetest.libsonnet:
With
docsonnet --raw main.libsonnet
I get:I'm assuming that to someone that knows what they're doing it must be pretty obvious what's wrong there, but a bit more detail in the error messages would be greatly appreciated.
The text was updated successfully, but these errors were encountered: