Skip to content

Commit

Permalink
Move Cue validation to Rake tasks in dev/
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpgross committed Jan 31, 2025
1 parent 5756ade commit 8cfa003
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions dev/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,44 @@ Rake::TestTask.new do |t|
t.libs << "test"
t.pattern = "test/integration/**/*_test.rb"
end

namespace :schema do
desc "Check if cue is installed and install it if not"
task :ensure_cue do
unless system("which cue > /dev/null 2>&1")
puts "Installing cue CLI..."
system("brew install cue-lang/tap/cue") or abort("Failed to install cue")
end
end

desc "Validate all schemas"
task vet: [:ensure_cue, :vet_data, :vet_dist]

desc "Validate data schemas"
task vet_data: :ensure_cue do
puts "Validating attributes schema"
system("cue vet schema/data/attributes_schema.cue ../data/attributes.yml") or abort

puts "Validating categories schema"
system("cue vet schema/data/categories_schema.cue -d '#schema' ../data/categories/*.yml") or abort

puts "Validating values schema"
system("cue vet schema/data/values_schema.cue -d '#schema' ../data/values.yml") or abort
end

desc "Validate distribution schemas"
task vet_dist: :ensure_cue do
puts "Validating attributes.json schema"
system("cue vet schema/dist/attributes_schema.cue ../dist/en/attributes.json") or abort

puts "Validating categories.json schema"
system("cue vet schema/dist/categories_schema.cue ../dist/en/categories.json") or abort

puts "Validating taxonomy.json schema"
system("cue vet schema/dist/attributes_schema.cue ../dist/en/taxonomy.json") or abort
system("cue vet schema/dist/categories_schema.cue ../dist/en/taxonomy.json") or abort

puts "Validating mappings.json schema"
system("cue vet schema/dist/mappings_schema.cue ../dist/en/integrations/all_mappings.json") or abort
end
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8cfa003

Please sign in to comment.