Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow introspecting contracts in the generated documentation #1718

Open
thufschmitt opened this issue Nov 17, 2023 · 0 comments
Open

Allow introspecting contracts in the generated documentation #1718

thufschmitt opened this issue Nov 17, 2023 · 0 comments

Comments

@thufschmitt
Copy link
Member

(the title of the issue is rather bad, apologies about that)

Is your feature request related to a problem? Please describe.

Given a Nickel expression like

let TypeOfFoo = { _: String } in
{
  foo | TypeOfFoo
}

the doc output will look like this:

foo

  • foo | TypeOfFoo

This is only marginally useful since I have no way of knowing what TypeOfFoo is without looking at the code.

Describe the solution you'd like

Anything that makes it possible to really understand the interface by just looking at the doc.

A few possibilities:

  1. Inline the contracts when can be. That would make the above be documented as:

    foo

    • foo | { _ : String }

    This is nicer in that example, but probably not always what we want (and might even lead to infinite recursion for cyclic contracts)

  2. Add hyperlinks to the documentation (and also document somewhere the non-exported fields that are needed). This could be rendered as:

    foo

    Non-exported fields:

    TypeOfFoo

    { _ : String }

    (where TypeOfFoo in the documentation of foo is a link to ## TypeOfFoo).

  3. Add hyperlinks, but only if the value is exported. So the example would render exactly as today, but

    {
    TypeOfFoo = { _: String },
    foo | TypeOfFoo
    }
    

    would render as

    foo

    TypeOfFoo

    { _ : String }

@thufschmitt thufschmitt changed the title The generated documentation doesn't allow introspecting contracts Allow introspecting contracts in the generated documentation Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant