code: func ProtoToDiagnostics(ds []*proto.Diagnostic) tfdiags.Diagnostics {
  	var diags tfdiags.Diagnostics
  	for _, d := range ds {
  		var severity tfdiags.Severity
  
  		switch d.Severity {
  		case proto.Diagnostic_ERROR:
  			severity = tfdiags.Error
  		case proto.Diagnostic_WARNING:
  			severity = tfdiags.Warning
  		}
  
  		var newDiag tfdiags.Diagnostic
  
  		// if there's an attribute path, we need to create a AttributeValue diagnostic
  		if d.Attribute != nil {
  			path := AttributePathToPath(d.Attribute)
  			newDiag = tfdiags.AttributeValue(severity, d.Summary, d.Detail, path)
  		} else {
  			newDiag = tfdiags.WholeContainingBody(severity, d.Summary, d.Detail)
  		}
  
  		diags = diags.Append(newDiag)
  	}
  
  	return diags
  }
docs: // ProtoToDiagnostics converts a list of proto.Diagnostics to a tf.Diagnostics.