OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/script/api/validate_spec

27 lines
558 B

#!/usr/bin/env ruby
require 'pathname'
require 'tempfile'
require 'psych'
require 'yaml'
load 'lib/api/open_api.rb'
assembled_path = "./tmp/oas-generated.yml"
spec_path = Pathname(__dir__).join("../../docs/api/apiv3/openapi-spec.yml")
full_spec = API::OpenAPI.send(:assemble_spec, spec_path).to_yaml
status = 1
begin
File.open(assembled_path, "w+") do |file|
file.puts full_spec
end
`npx @redocly/openapi-cli lint #{assembled_path}`
status = $?.exitstatus
ensure
FileUtils.rm assembled_path if File.exist? assembled_path
end
exit status