Sha256: 205abfd433068f09f6ddc3f3b3ac68d5a961776b719a52d8e089078c7aac79b5

Contents?: true

Size: 713 Bytes

Versions: 130

Compression:

Stored size: 713 Bytes

Contents

module Kontena::Cli::Stacks::YAML::Validations::CustomValidators
  class ExtendsValidator < HashValidator::Validator::Base
    def initialize
      super('stacks_valid_extends')
    end

    def validate(key, value, validations, errors)
      unless value.is_a?(String) || value.is_a?(Hash)
        errors[key] = 'extends must be string or hash'
        return
      end
      if value.is_a?(Hash)
        extends_validation = {
          'service' => 'string',
          'file' => HashValidator.optional('string'),
          'stack' => HashValidator.optional('string')
        }
        HashValidator.validator_for(extends_validation).validate(key, value, extends_validation, errors)
      end
    end
  end
end

Version data entries

130 entries across 130 versions & 2 rubygems

Version Path
krates-1.7.11 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.10 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.9 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.8 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.7 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.6 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.5 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.4 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.3 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.2 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.1 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.7.0 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.9 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.8 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.7 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.6 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.5 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.4 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.3 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb
krates-1.6.2 lib/kontena/cli/stacks/yaml/custom_validators/extends_validator.rb