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

Feature Request: Comment based parameter description #1688

Closed
JustinGrote opened this issue Mar 2, 2021 · 3 comments
Closed

Feature Request: Comment based parameter description #1688

JustinGrote opened this issue Mar 2, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@JustinGrote
Copy link

JustinGrote commented Mar 2, 2021

Is your feature request related to a problem? Please describe.
parameters should always have descriptions to make it easy for someone to construct a parameter.json file and understand what is happening, however there is still far too much boilerplate to add a description to a parameter when they should be present for nearly all parameter definitions, not to mention losing the terse default syntax.

param MyString string {
  metadata: {
    description: 'String required for this module.'
  }
  default: 'test'
}

Describe the solution you'd like
Take a page from C# and Powershell Comment Based Help and allow comments directly above the parameters to be picked up as description. Maybe require a keyword DESCRIPTION: to distinguish from random comments to avoid user confusion.

The below would produce the same result as above:

// String required for this module
param MyString string = 'test'

It could also be sameline, which is already used in examples like https://github.com/Azure/bicep/blob/main/docs/tutorial/01-simple-template.md, though it is preferred as a separate like so that pull requests/etc. can update documentation without affecting a parameter line.

param MyString string = 'test' // String required for this module
@JustinGrote JustinGrote added the enhancement New feature or request label Mar 2, 2021
@ghost ghost added the Needs: Triage 🔍 label Mar 2, 2021
@anthony-c-martin
Copy link
Member

Note that you can (as of Bicep 0.3) use decorators to accomplish this:

@description('String required for this module')
param MyString string = 'test'

With #1665 we should show this information in hovers in VSCode.

@JustinGrote
Copy link
Author

JustinGrote commented Mar 2, 2021

@anthony-c-martin totally whiffed the decorators announcement. Thanks, I'll take this approach for now, but will leave the issue open as an alternative to decorators if the team wants to consider.

@alex-frankel
Copy link
Collaborator

We are going to go with the @doc decorator, so we are not going to plan to do this as well. Closing for now. Let us know if there are any concerns.

@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants