Skip to content

ISIN

class Athena::Validator::Constraints::ISIN
inherits Athena::Validator::Constraint

Validates that a value is a valid International Securities Identification Number (ISIN). The underlying value is converted to a string via #to_s before being validated.

NOTE: As with most other constraints, nil and empty strings are considered valid values, in order to allow the value to be optional. If the value is required, consider combining this constraint with AVD::Constraints::NotBlank.

Configuration

Optional Arguments
message

Type: String Default: This value is not a valid International Securities Identification Number (ISIN).

The message that will be shown if the value is not a valid ISIN.

Placeholders

The following placeholders can be used in this message:

  • {{ value }} - The current (invalid) value.
groups

Type: Array(String) | String | Nil Default: nil

The validation groups this constraint belongs to. AVD::Constraint::DEFAULT_GROUP is assumed if nil.

payload

Type: Hash(String, String)? Default: nil

Any arbitrary domain-specific data that should be stored with this constraint. The payload is not used by Athena::Validator, but its processing is completely up to you.

Constants

INVALID_CHECKSUM_ERROR = "c7d37ffb-0273-4f57-91f7-f47bf49aad08"

INVALID_LENGTH_ERROR = "1d1c3fbe-5b6f-42be-afa5-6840655865da"

INVALID_PATTERN_ERROR = "0b6ba8c4-b6aa-44dc-afac-a6f7a9a2556d"

Class methods

.new(message : String = "This value is not a valid International Securities Identification Number (ISIN).", groups : Array(String) | String | Nil = nil, payload : Hash(String, String)? = nil)

Methods

#validated_by : AVD::ConstraintValidator.class

Returns the AVD::ConstraintValidator.class that should handle validating self.