Sha256: 7ed6106a40c525c79dd3efa1c54eac6c0672f456bb1367ada4f2c99ac2ce7212

Contents?: true

Size: 743 Bytes

Versions: 100

Compression:

Stored size: 743 Bytes

Contents

module Kontena::Cli::Apps::YAML::Validations::CustomValidators
  class BuildValidator < HashValidator::Validator::Base
    def initialize
      super('valid_build')
    end

    def validate(key, value, validations, errors)
      unless value.is_a?(String) || value.is_a?(Hash)
        errors[key] = 'build must be string or hash'
        return
      end
      if value.is_a?(Hash)
        build_validation = {
          'context' => 'string',
          'dockerfile' => HashValidator.optional('string'),
          'args' => HashValidator.optional(-> (value) { value.is_a?(Array) || value.is_a?(Hash) })
        }
        HashValidator.validator_for(build_validation).validate(key, value, build_validation, errors)
      end
    end
  end
end

Version data entries

100 entries across 100 versions & 2 rubygems

Version Path
kontena-cli-1.3.5 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-plugin-app-command-0.1.0 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-plugin-app-command-0.1.0.rc1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.4.0.pre6 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.4.0.pre5 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.4.0.pre4 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.4.0.pre3 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.4.0.pre2 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.4.0.pre1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.4 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.4.rc1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.3 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.3.rc1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.2 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.2.rc2 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.2.rc1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.1.rc2 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb
kontena-cli-1.3.1.rc1 lib/kontena/cli/apps/yaml/custom_validators/build_validator.rb