nickel icon indicating copy to clipboard operation
nickel copied to clipboard

`nickel doc` should recognize record contracts as fields

Open vkleen opened this issue 1 year ago • 1 comments

Currently, for a Nickel program like { field | { foo } }, the JSON documentation generated by nickel doc contains a pretty printed { foo, } as a string in the contracts field:

❯ nickel doc --format json --stdout <<<'{ field | { foo } }'
{"field":{"fields":null,"type":null,"contracts":["{ foo, }"],"documentation":null}}

This feels quite silly. We're already able to recognize the fields of a record contract as subfields in the customize mode CLI. We should do the same here.

vkleen avatar Sep 27 '23 17:09 vkleen

I would prefer to express which parameters are available in my templates in #1498 as a contract on the parameters field, which would require this enhancement to be processed by nix at eval time as it is currently.

gkleen avatar Sep 29 '23 12:09 gkleen