Class: R2OAS::Schema::V3::PathAnalyzer
- Inherits:
-
BaseAnalyzer
- Object
- Base
- Base
- Base
- BaseAnalyzer
- R2OAS::Schema::V3::PathAnalyzer
- Defined in:
- lib/r2-oas/schema/v3/analyzer/path_analyzer.rb
Constant Summary collapse
- VERB =
%w[get put post delete options head patch trace].freeze
- NOT_VERB =
%w[$ref summary description servers parameters].freeze
Constants inherited from Base
Base::SUPPORT_COMPONENTS_OBJECTS
Instance Method Summary collapse
- #analyze_docs ⇒ Object
-
#initialize(before_schema_data, after_schema_data, options = {}) ⇒ PathAnalyzer
constructor
A new instance of PathAnalyzer.
Methods inherited from BaseAnalyzer
#generate_from_existing_schema
Methods included from R2OAS::Sortable
Methods inherited from Base
Constructor Details
#initialize(before_schema_data, after_schema_data, options = {}) ⇒ PathAnalyzer
Returns a new instance of PathAnalyzer.
16 17 18 19 |
# File 'lib/r2-oas/schema/v3/analyzer/path_analyzer.rb', line 16 def initialize(before_schema_data, after_schema_data, = {}) super = [] end |
Instance Method Details
#analyze_docs ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/r2-oas/schema/v3/analyzer/path_analyzer.rb', line 21 def analyze_docs sorted_schema = deep_sort(@after_schema_data, 'paths') edited_paths_schema = sorted_schema['paths'] (edited_paths_schema) do |tag_name, result| file_manager = PathItemFileManager.new("paths/#{tag_name}", :relative) file_manager.save(result.to_yaml) logger.info " Write schema file: \t#{file_manager.save_file_path(type: :relative)}" end # Automatically generated when there is no tag object in the read schema file if generate_tag_file? result = { 'tags' => V3::TagObject.new().to_doc } file_manager = FileManager.new('tags', :relative) file_manager.save(result.to_yaml) end end |