Files
openproject/script/api/validate_spec
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
562 B
Ruby
Raw Normal View History

2021-06-29 15:06:57 +01:00
#!/usr/bin/env ruby
require "pathname"
require "tempfile"
2021-06-29 15:06:57 +01:00
openapi_yaml_spec_path = Pathname(__dir__).join("../../tmp/oas-generated.yml")
full_spec = `#{Pathname(__dir__).join("spec")} --format yaml`
status = $?.exitstatus
if status != 0
warn "failed to bundle the openapi spec yaml file"
exit status
end
status = 1
begin
File.open(openapi_yaml_spec_path, "w+") do |file|
file.puts full_spec
end
2026-02-11 14:11:20 +01:00
system("npx @redocly/cli lint #{openapi_yaml_spec_path}")
status = $?.exitstatus
ensure
FileUtils.rm_f openapi_yaml_spec_path
end
exit status