lib/github_bot/validator/base.rb
# Public: Validates for the provided file at a given hash point that the
# required and allowed fields are met
#
# @param file [Sawyer::Resource] The file for reference that is being evaluated
# @param ident [String/Symbol] The text identifier for the hash being evaluated
# @param hash [Hash] The hash to review keys
# @param required_fields [Array] An array of required elements
# @param allowed_fields [Array] An array of allowed fields
Validates for the provided file at a given hash point that the
required and allowed fields are met
Validates for the provided file at a given hash point that the required and allowed fields are met
def validate_fields(file:, ident:, hash:, required_fields:, allowed_fields:, **opts)
        unless hash
          feedback(
            path: file.filename,
            annotation_level: 'failure',
            message: 'Element is empty or nil'
          )
          return
        end
        validate_required_fields(
          file: file,
          ident: ident,
          hash: hash,
          required_fields: required_fields,
          **opts
        )
        validate_allowed_fields(
          file: file,
          ident: ident,
          hash: hash,
          allowed_fields: allowed_fields,
          **opts
        )
      end
def validate_fields ( file : , ident : , hash : , required_fields : , allowed_fields : , ** opts ) unless hash feedback ( path : file . filename , annotation_level : 'failure' , message : 'Element is empty or nil' ) return end validate_required_fields ( file : file , ident : ident , hash : hash , required_fields : required_fields , ** opts ) validate_allowed_fields ( file : file , ident : ident , hash : hash , allowed_fields : allowed_fields , ** opts ) end
Public: Validates for the provided file at a given hash point that the
required and allowed fields are met
Public : Validates for the provided file at a given hash point that the required and allowed fields are met
file
The file for reference that is being evaluated
The file for reference that is being evaluated
ident
The text identifier for the hash being evaluated
The text identifier for the hash being evaluated
hash
The hash to review keys
The hash to review keys
required_fields
An array of required elements
An array of required elements
allowed_fields
An array of allowed fields
An array of allowed fields
opts
<not_specific>