You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "tempcomp123456789 (via GitHub)" <gi...@apache.org> on 2026/07/31 04:54:27 UTC

[I] [Question] Does Apache Fory support field validation inside *.fdl? [fory]

tempcomp123456789 opened a new issue, #3904:
URL: https://github.com/apache/fory/issues/3904

   ### Question
   
   **Hi.**
   
   **Does Apache Fory support field validation inside \*.fdl , similar to Protobuf tools (Protovalidate (CEL)/protoc-gen-validate (PGV))**  ❓
   
   ~https://fory.apache.org/docs/compiler/protobuf_idl_support/~
   
   
   ```proto
   syntax = "proto3";
   
   package v1.user;
   
   import "buf/validate/validate.proto";
   
   message UserProfile {
     string id = 1 [(buf.validate.field).string.uuid = true];
   
     // Numeric boundaries
     uint32 age = 2 [(buf.validate.field).uint32.gte = 18, (buf.validate.field).uint32.lte = 120];
   
     string email = 3 [(buf.validate.field).string.email = true];
   
     // Length constraints and regex pattern matching
     string username = 4 [
       (buf.validate.field).string.min_len = 3,
       (buf.validate.field).string.max_len = 30,
       (buf.validate.field).string.pattern = "^[a-zA-Z0-9_]+$"
     ];
   
     // Collection constraint (ensure list contains at least one item)
     repeated string roles = 5 [(buf.validate.field).repeated.min_items = 1];
   }
   
   ```


-- 
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: commits-unsubscribe@fory.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [Question] Does Apache Fory support field validation inside *.fdl? [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #3904:
URL: https://github.com/apache/fory/issues/3904#issuecomment-5140481309

   Thanks for raising this question.
   
   Currently, Apache Fory does not support field validation rules in FDL like Protovalidate or protoc-gen-validate.
   
   If added in the future, validation would likely be generated as a separate validator instead of being embedded into the serialization/deserialization path.
   
   For example:
   
   ```fdl
   struct User {
       string email @validate(email);
       int age @validate(gte=18);
   }
   ```
   
   could generate:
   
   ```
   User user = serializer.deserialize(bytes);
   validator.validate(user);
   ```
   
   This keeps Fory's serialization performance unchanged while allowing users to enable validation when needed.


-- 
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: commits-unsubscribe@fory.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org