Typely
GitHub
  • Overview
    • πŸ‘Welcome!
  • Validations
    • πŸ“Common
    • πŸ”’Number
    • βš–οΈComparable
    • ✏️String
  • Customize errors
    • 🌎Localization
    • πŸ”Sensitive data
  • General
    • 🧩Class VS Struct
    • πŸ–ΌοΈSupported frameworks
    • πŸš€Benchmarks
    • ⚠️Limitations
  • Design decisions
    • πŸ”„Conversions
    • ℹ️Use of interfaces
    • πŸ€Έβ€β™‚οΈUnderlying type comparison
    • πŸ’‚Validations
Powered by GitBook
On this page
  • InclusiveBetween Validator
  • ExclusiveBetween Validator
Edit on GitHub
  1. Validations

Number

Common validations to number types

InclusiveBetween Validator

Ensures that the number is within the specified range, including both limits.

Example:

builder.OfInt().For("Age").InclusiveBetween(18, 120);

Example error: 'Age' must be between 18 and 120, including both limits.

String format args:

  • Name: Name of the type being validated

  • Value: Current value of the property

  • Min: Minimum value of the range

  • Max: Maximum value of the range

ExclusiveBetween Validator

Ensures that the number is within the specified range, excluding both limits.

Example:

builder.OfInt().For("Age").ExclusiveBetween(18, 120);

Example error: 'Age' must be between 18 and 120, excluding both limits.

String format args:

  • Name: Name of the type being validated

  • Value: Current value of the property

  • Min: Minimum value of the range

  • Max: Maximum value of the range

PreviousCommonNextComparable

Last updated 2 years ago

πŸ”’