apache / apache/fory

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

Open
#3,904 1 comment 0 reactions 0 assignees View on GitHub
good first issue question
Dominant language
Java
Stars
4.5k
Forks
443
Avg merge
6h 3m
Merged PRs (30d)
74

Description

### 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];

// Standard rules handle simple single-field checks.
uint64 amount = 6 [(buf.validate.field).uint64.gt = 0];
uint64 balance = 7;

// CEL produces a dynamic error message with runtime values.
option (buf.validate.message).cel = {
id: "transfer.sufficient_balance"
expression:
"this.amount <= this.balance ? ''"
": 'cannot transfer ' + string(this.amount)"
" + ' with a balance of ' + string(this.balance)"
};
}

```

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked protobuf IDL support documentation and comparing it with the FDL question and validation examples. Confirm whether field and message validation are supported, then document the supported scope or limitations in the issue or relevant documentation.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.