class R2OAS::Schema::V3::BaseBuilder

Attributes

opts[RW]
output[RW]
output?[RW]
skip_load_dot_paths[RW]
unit_paths_file_path[RW]
use_plugin[RW]
use_plugin?[RW]

Public Class Methods

new(opts = {}) click to toggle source
Calls superclass method R2OAS::Base::new
# File lib/r2-oas/schema/v3/builder/base_builder.rb, line 14
def initialize(opts = {})
  super

  opts.keys.each do |key|
    send("#{key}=", opts[key])
  end

  @opts = opts
  @glob_schema_paths = create_glob_schema_paths
end

Private Instance Methods

create_glob_schema_paths() click to toggle source
# File lib/r2-oas/schema/v3/builder/base_builder.rb, line 40
def create_glob_schema_paths
  exclude_paths_regexp_paths               = ["#{schema_save_dir_path}/**.yml"]
  components_security_schemes_regexp_paths = ["#{schema_save_dir_path}/components/securitySchemes/**/**.yml"]

  # components/securitySchemes is not referenced in $ ref.
  exclude_paths_regexp_paths + many_paths_file_paths + many_components_file_paths + components_security_schemes_regexp_paths
end
many_components_file_paths() click to toggle source
# File lib/r2-oas/schema/v3/builder/base_builder.rb, line 62
def many_components_file_paths
  @many_components_file_paths ||= many_paths_file_paths.each_with_object([]) do |unit_paths_path, result|
    file_manager = PathItemFileManager.new(unit_paths_path, :full)
    components_file_paths_at_path = file_manager.descendants_ref_paths
    result.push(*components_file_paths_at_path)
  end.uniq
end
many_paths_file_paths() click to toggle source
# File lib/r2-oas/schema/v3/builder/base_builder.rb, line 52
def many_paths_file_paths
  if unit_paths_file_path.present? && !skip_load_dot_paths
    [unit_paths_file_path]
  elsif !unit_paths_file_path.present? && !skip_load_dot_paths && paths_config.all_load_paths?
    paths_config.many_paths_file_paths
  else
    Dir.glob("#{schema_save_dir_path}/paths/**/**.yml")
  end
end
schema_file_do_not_exists?() click to toggle source
# File lib/r2-oas/schema/v3/builder/base_builder.rb, line 36
def schema_file_do_not_exists?
  schema_files_paths.count == 0
end
schema_files_paths() click to toggle source
# File lib/r2-oas/schema/v3/builder/base_builder.rb, line 48
def schema_files_paths
  Dir.glob(@glob_schema_paths)
end