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