(meth *Method, path string)
| 246 | } |
| 247 | |
| 248 | func (r *Registry) newParam(meth *Method, path string) (Parameter, error) { |
| 249 | msg := meth.RequestType |
| 250 | fields, err := r.resolveFieldPath(msg, path, true) |
| 251 | if err != nil { |
| 252 | return Parameter{}, err |
| 253 | } |
| 254 | l := len(fields) |
| 255 | if l == 0 { |
| 256 | return Parameter{}, fmt.Errorf("invalid field access list for %s", path) |
| 257 | } |
| 258 | target := fields[l-1].Target |
| 259 | switch target.GetType() { |
| 260 | case descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, descriptorpb.FieldDescriptorProto_TYPE_GROUP: |
| 261 | if grpclog.V(2) { |
| 262 | grpclog.Infoln("found aggregate type:", target, target.TypeName) |
| 263 | } |
| 264 | if IsWellKnownType(*target.TypeName) { |
| 265 | if grpclog.V(2) { |
| 266 | grpclog.Infoln("found well known aggregate type:", target) |
| 267 | } |
| 268 | } else { |
| 269 | return Parameter{}, fmt.Errorf("%s.%s: %s is a protobuf message type. Protobuf message types cannot be used as path parameters, use a scalar value type (such as string) instead", meth.Service.GetName(), meth.GetName(), path) |
| 270 | } |
| 271 | } |
| 272 | return Parameter{ |
| 273 | FieldPath: FieldPath(fields), |
| 274 | Method: meth, |
| 275 | Target: fields[l-1].Target, |
| 276 | }, nil |
| 277 | } |
| 278 | |
| 279 | func (r *Registry) newBody(meth *Method, path string) (*Body, error) { |
| 280 | switch path { |
no test coverage detected