From eb95ed4f7d089d240e623181a954b68db3ecbcc7 Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Tue, 11 Oct 2022 17:35:12 +0200 Subject: [PATCH 1/2] Add a description field to the function spec --- cty/function/function.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cty/function/function.go b/cty/function/function.go index c00a0e7f..565f9ce3 100644 --- a/cty/function/function.go +++ b/cty/function/function.go @@ -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 +} From 35c34cb1650dbda660cdc98d884eeff1eaacc9c5 Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Tue, 11 Oct 2022 17:35:43 +0200 Subject: [PATCH 2/2] Add a description field to function parameters --- cty/function/argument.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cty/function/argument.go b/cty/function/argument.go index 5a26c275..61a1cf97 100644 --- a/cty/function/argument.go +++ b/cty/function/argument.go @@ -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