Class: R2OAS::Schema::V3::Squeezer

Inherits:
BaseSqueezer show all
Defined in:
lib/r2-oas/schema/v3/squeezer.rb

Constant Summary

Constants inherited from Base

Base::SUPPORT_COMPONENTS_OBJECTS

Instance Method Summary collapse

Methods inherited from BaseSqueezer

#initialize

Methods inherited from Base

#support_components_objects

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from R2OAS::Schema::V3::BaseSqueezer

Instance Method Details

#squeeze_docsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/r2-oas/schema/v3/squeezer.rb', line 11

def squeeze_docs
  except_paths_schema = @schema_data.except('paths', 'tags', 'components')
  components_schemas = @schema_data.slice('components')

  path_squeezer = PathSqueezer.new(@schema_data, many_paths_file_paths: many_paths_file_paths)
  tag_squeezer = TagSqueezer.new(@schema_data, many_paths_file_paths: many_paths_file_paths)

  # To make components merge after paths
  slice_schemas = [
    tag_squeezer.squeeze_docs,
    path_squeezer.squeeze_docs,
    components_schemas
  ]
  slice_schemas.each_with_object(except_paths_schema) { |slice_schema, result| result.deep_merge!(slice_schema) }
end