Class: Vkit::CLI::Commands::PolicyValidateCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/vkit/cli/commands/policy_validate_command.rb

Instance Method Summary collapse

Instance Method Details

#call(bundle_path:, schema_path:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vkit/cli/commands/policy_validate_command.rb', line 7

def call(bundle_path:, schema_path:)
  bundle_path = File.expand_path(bundle_path)
  raise "Bundle not found: #{bundle_path}" unless File.exist?(bundle_path)

  schema_path ||= default_schema_path
  raise "Schema not found: #{schema_path}" unless File.exist?(schema_path)

  validator = Vkit::CLI::PolicyBundleValidator.new(
    schema_path: schema_path
  )

  validator.validate!(bundle_path)

  puts "✅ Policy bundle is valid"
end