func CheckFieldNames(payload jsonPayload) error {
	for fieldName, value := range payload {
		rune, _ := utf8.DecodeRuneInString(fieldName)
		if strings.ContainsAny(fieldName, "_- ") || !unicode.IsLower(rune) {
			return fmt.Errorf("%s field name is not lower-camel-cased; probably want be %q (BodyFieldNameIncorrectlyCasedError)", fieldName, strcase.ToLowerCamel(fieldName))
		}
		if nested, ok := value.(map[string]interface{}); ok {
			if err := CheckFieldNames(nested); err != nil {
				return fmt.Errorf("%s.%s", fieldName, err)
			}
		}
	}
	return nil
}
CheckFieldNames checks that the field names in the JSON request body are properly formatted
(lower-camel-cased).
package resttools
import (
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"strconv"
	"strings"
	"unicode"
	"unicode/utf8"
	"github.com/iancoleman/strcase"
	"google.golang.org/protobuf/reflect/protoreflect"
)
func CheckRequestFormat(jsonReader io.Reader, request *http.Request, message protoreflect.Message) error {
	header := request.Header
	if err := CheckAPIClientHeader(header); err != nil {
		return err
	}
	if jsonReader == nil {
		return nil
	}
	if err := CheckContentType(header); err != nil {
		return err
	}
	jsonBytes, err := ioutil.ReadAll(jsonReader)
	if err != nil {
		return err
	}
	if (request.Method == http.MethodGet || request.Method == http.MethodDelete) && request.Body != nil {
		return fmt.Errorf("(UnexpectedRequestBodyError) non-zero body for HTTP %q", request.Method)
	}
	var payload jsonPayload
	json.Unmarshal(jsonBytes, &payload)
	if err := CheckFieldNames(payload); err != nil {
		return err
	}
	enumFields := GetEnumFields(message)
	return CheckJSONEnumFields(payload, enumFields)
}