binding: ignore unexpected field (#879)

pull/880/head
Cluas 4 years ago committed by GitHub
parent f33bd70d75
commit 8b875e43a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      transport/http/binding/proto.go

@ -4,7 +4,6 @@ import (
"encoding/base64"
"errors"
"fmt"
"log"
"strconv"
"strings"
"time"
@ -51,7 +50,7 @@ func populateFieldValues(v protoreflect.Message, fieldPath []string, values []st
if fd = fields.ByName(protoreflect.Name(fieldName)); fd == nil {
fd = fields.ByJSONName(fieldName)
if fd == nil {
log.Printf("field not found in %q: %q\n", v.Descriptor().FullName(), strings.Join(fieldPath, "."))
// ignore unexpected field.
return nil
}
}

Loading…
Cancel
Save