Skip to content

Commit

Permalink
function: Allow functions and function parameters to have English-lan…
Browse files Browse the repository at this point in the history
…guage descriptions
  • Loading branch information
dbanck committed Oct 19, 2022
1 parent d271633 commit 31869a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cty/function/argument.go
Expand Up @@ -10,6 +10,9 @@ type Parameter struct {
// value, but callers may use it for documentation, etc.
Name string

// Description is an optional description for the argument.
Description string

// A type that any argument for this parameter must conform to.
// cty.DynamicPseudoType can be used, either at top-level or nested
// in a parameterized type, to indicate that any type should be
Expand Down
8 changes: 8 additions & 0 deletions cty/function/function.go
Expand Up @@ -14,6 +14,9 @@ type Function struct {
// Spec is the specification of a function, used to instantiate
// a new Function.
type Spec struct {
// Description is an optional description for the function specification.
Description string

// Params is a description of the positional parameters for the function.
// The standard checking logic rejects any calls that do not provide
// arguments conforming to this definition, freeing the function
Expand Down Expand Up @@ -344,3 +347,8 @@ func (f Function) VarParam() *Parameter {
ret := *f.spec.VarParam
return &ret
}

// Description returns a human-readable description of the function.
func (f Function) Description() string {
return f.spec.Description
}

0 comments on commit 31869a5

Please sign in to comment.