@@ -81,9 +81,6 @@ type FieldType struct {
8181
8282 // GetFrom retrieves the field value on the input object, if set.
8383 GetFrom ref.FieldGetter
84-
85- // Description provides a description of the field. Empty if no description available.
86- Description string
8784}
8885
8986// Registry provides type information for a set of registered types.
@@ -209,13 +206,26 @@ func (p *Registry) FindStructFieldType(structType, fieldName string) (*FieldType
209206 return nil , false
210207 }
211208 return & FieldType {
212- Type : fieldDescToCELType (field ),
213- IsSet : field .IsSet ,
214- GetFrom : field .GetFrom ,
215- Description : field .Documentation (),
209+ Type : fieldDescToCELType (field ),
210+ IsSet : field .IsSet ,
211+ GetFrom : field .GetFrom ,
216212 }, true
217213}
218214
215+ // FindStructFieldDescription returns documentation for a field if available.
216+ // Returns false if the field could not be found.
217+ func (p * Registry ) FindStructFieldDescription (structType , fieldName string ) (string , bool ) {
218+ msgType , found := p .pbdb .DescribeType (structType )
219+ if ! found {
220+ return "" , false
221+ }
222+ field , found := msgType .FieldByName (fieldName )
223+ if ! found {
224+ return "" , false
225+ }
226+ return field .Documentation (), true
227+ }
228+
219229// FindIdent takes a qualified identifier name and returns a ref.Val if one exists.
220230func (p * Registry ) FindIdent (identName string ) (ref.Val , bool ) {
221231 if t , found := p .revTypeMap [identName ]; found {
0 commit comments