Class: R2OAS::Schema::V3::Analyzer

Inherits:
BaseAnalyzer show all
Defined in:
lib/r2-oas/schema/v3/analyzer.rb

Constant Summary

Constants inherited from Base

Base::SUPPORT_COMPONENTS_OBJECTS

Instance Method Summary collapse

Methods inherited from BaseAnalyzer

#generate_from_existing_schema

Methods included from R2OAS::Sortable

#deep_sort

Methods inherited from Base

#support_components_objects

Constructor Details

#initialize(before_schema_data, after_schema_data, options = {}) ⇒ Analyzer

Returns a new instance of Analyzer.



13
14
15
16
17
18
# File 'lib/r2-oas/schema/v3/analyzer.rb', line 13

def initialize(before_schema_data, after_schema_data, options = {})
  super
  @path_analyzer       = PathAnalyzer.new(@before_schema_data, @after_schema_data, options)
  @tag_analyzer        = TagAnalyzer.new(@after_schema_data, options)
  @components_analyzer = ComponentsAnalyzer.new(@before_schema_data, @after_schema_data, options)
end

Instance Method Details

#analyze_docsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/r2-oas/schema/v3/analyzer.rb', line 20

def analyze_docs
  logger.info '[Analyze OAS file] start'
  @after_schema_data.keys.each do |schema_name|
    case schema_name
    when 'paths'
      logger.info '[Analyze OAS file (paths)] start'
      @path_analyzer.analyze_docs
      logger.info '[Analyze OAS file (paths)] end'
    when 'tags'
      logger.info '[Analyze OAS file (tags)] start'
      @tag_analyzer.analyze_docs
      logger.info '[Analyze OAS file (tags)] end'
    when 'components'
      logger.info '[Analyze OAS file (components)] start'
      @components_analyzer.analyze_docs
      logger.info '[Analyze OAS file (components)] end'
    else
      save_schema_when(schema_name)
    end
  end
  logger.info '[Analyze OAS file] end'
end