458
459
460
461
462
463
464
465
466
|
# File 'lib/insights/api/common/open_api/generator.rb', line 458
def run(graphql = false)
new_content = openapi_contents.dup
new_content["paths"] = build_paths.sort.to_h
new_content["components"] ||= {}
new_content["components"]["schemas"] = schemas.merge(schema_overrides).sort.each_with_object({}) { |(name, val), h| h[name] = val || openapi_contents["components"]["schemas"][name] || {} }
new_content["components"]["parameters"] = parameters.sort.each_with_object({}) { |(name, val), h| h[name] = val || openapi_contents["components"]["parameters"][name] || {} }
File.write(openapi_file, JSON.pretty_generate(new_content) + "\n")
Insights::API::Common::GraphQL::Generator.generate(api_version, new_content) if graphql
end
|