kitazith/validation

Types

A structured validation error for webhook payload builders.

pub type ValidationError {
  ValidationError(path: String, reason: ValidationReason)
}

Constructors

The reason a webhook payload validation failed.

pub type ValidationReason {
  StringLengthOutOfRange(min: Int, max: Int, actual: Int)
  StringLengthExceeded(max: Int, actual: Int)
  ListLengthExceeded(max: Int, actual: Int, item_label: String)
  AggregateCharacterLimitExceeded(
    limit_label: String,
    max: Int,
    actual: Int,
  )
  AggregateComponentLimitExceeded(max: Int, actual: Int)
  ComponentCountOutOfRange(
    min: Int,
    max: Int,
    actual: Int,
    item_label: String,
  )
  NumericMaximumExceeded(max: Int, actual: Int, unit: String)
  NumericOutOfRange(
    min: Int,
    max: Int,
    actual: Int,
    unit: String,
  )
  MissingAttachmentReference(filename: String)
  AttachmentReferenceMissingFilename
  AttachmentReferenceRequired
  DuplicateAttachmentFilename(
    filename: String,
    indexes: List(Int),
  )
  DuplicateComponentId(id: Int, paths: List(String))
  MutuallyExclusiveWith(other_path: String)
  RequiresFlag(flag_name: String)
}

Constructors

  • StringLengthOutOfRange(min: Int, max: Int, actual: Int)
  • StringLengthExceeded(max: Int, actual: Int)
  • ListLengthExceeded(max: Int, actual: Int, item_label: String)
  • AggregateCharacterLimitExceeded(
      limit_label: String,
      max: Int,
      actual: Int,
    )
  • AggregateComponentLimitExceeded(max: Int, actual: Int)
  • ComponentCountOutOfRange(
      min: Int,
      max: Int,
      actual: Int,
      item_label: String,
    )
  • NumericMaximumExceeded(max: Int, actual: Int, unit: String)
  • NumericOutOfRange(min: Int, max: Int, actual: Int, unit: String)
  • MissingAttachmentReference(filename: String)
  • AttachmentReferenceMissingFilename
  • AttachmentReferenceRequired
  • DuplicateAttachmentFilename(filename: String, indexes: List(Int))
  • DuplicateComponentId(id: Int, paths: List(String))
  • MutuallyExclusiveWith(other_path: String)
  • RequiresFlag(flag_name: String)

Values

pub fn message(error: ValidationError) -> String
Search Document