Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepeatedFieldLimitError ¶
func (*RepeatedFieldLimitError) Error ¶
func (e *RepeatedFieldLimitError) Error() string
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func Compile ¶
func Compile(root protoreflect.MessageDescriptor, fieldLimits map[protoreflect.FullName]int) (*Validator, error)
The returned Validator is stateful and must not be used concurrently.
Assumptions and Limitations:
- No recursive schemas: the compiler rejects cyclic message descriptor graphs.
- No map fields: map fields are rejected at compile time because their wire representation (repeated synthetic entry messages) would require special handling, and we don't use them in our schemas.
- No repeated packable scalars (except bool): packed encoding merges multiple values into a single length-delimited record, making wire-level element counting inaccurate. Rather than adding complexity, we forbid these field types.
- No field numbers above maxAllowedFieldNumber to keep memory footprint small.
- See also the comment on Validator.
Click to show internal directories.
Click to hide internal directories.