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
dbanck authored Oct 19, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
DigitalBrains1 Peter Lebbing
1 parent d271633 commit 31869a5
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cty/function/argument.go
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions cty/function/function.go
Original file line number Diff line number Diff line change
@@ -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
@@ -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.