OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
reuse existing code to get openapi spec yaml in validate_spec script
Christophe Bliard6ff08eacfa63
diff --git a/script/api/validate_spec b/script/api/validate_specindex 19cc20b6aa0..1dbe46074ed 100755--- a/script/api/validate_spec+++ b/script/api/validate_spec@@ -2,26 +2,21 @@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+openapi_yaml_spec_path = "./tmp/oas-generated.yml"+full_spec = `#{Pathname(__dir__).join('spec')} --format yaml`status = 1begin- File.open(assembled_path, "w+") do |file|+ File.open(openapi_yaml_spec_path, "w+") do |file|file.puts full_specend- `npx @redocly/openapi-cli lint #{assembled_path}`+ `npx @redocly/openapi-cli lint #{openapi_yaml_spec_path}`status = $?.exitstatusensure- FileUtils.rm assembled_path if File.exist? assembled_path+ FileUtils.rm_f openapi_yaml_spec_pathendexit status