You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by GitBox <gi...@apache.org> on 2022/09/06 03:05:36 UTC

[GitHub] [thrift] simon0-o commented on a diff in pull request #2469: THRIFT-5423: Support go parameter validation in IDL

simon0-o commented on code in PR #2469:
URL: https://github.com/apache/thrift/pull/2469#discussion_r963213079


##########
lib/go/thrift/application_exception.go:
##########
@@ -59,9 +62,35 @@ type TApplicationException interface {
 	Write(ctx context.Context, oprot TProtocol) error
 }
 
+type ValidationError struct {
+	message     string
+	check       string
+	fieldSymbol string
+}
+
+func (e *ValidationError) Check() string {
+	return e.check
+}
+
+func (e *ValidationError) Field() string {
+	if fs := strings.Split(e.fieldSymbol, "."); len(fs) > 1 {

Review Comment:
   `fieldSymbol` indicates a string like 'BasicTest.Double1', which means that the field is the 'Double1' in type 'BasicTest'. And similarly 'BasicTest.Map0.key' indicates that the field is the key of field 'Map0' in type 'BasicTest'.
   I also add a new method 'TypeName' to ValidationError to get the name of the type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@thrift.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org