Class: R2OAS::Schema::V3::PathsObject
- Inherits:
-
Dynamic::Schema::V3::HookableBaseObject
- Object
- BaseObject
- Dynamic::Schema::V3::HookableBaseObject
- R2OAS::Schema::V3::PathsObject
- Defined in:
- lib/r2-oas/schema/v3/object/from_routes/paths_object.rb
Instance Attribute Summary
Attributes inherited from Dynamic::Schema::V3::HookableBaseObject
Instance Method Summary collapse
- #create_doc ⇒ Object
-
#initialize(routes_data, opts = {}) ⇒ PathsObject
constructor
A new instance of PathsObject.
Methods inherited from Dynamic::Schema::V3::HookableBaseObject
execute_hook, has_hook?, hook, hook=, hooks, inherited, off, on, #to_doc, #use_superclass_hook
Methods inherited from BaseObject
#components_object_class, #components_request_body_object_class, #components_schema_object_class, #external_document_object_class, #info_object_class, #path_item_object_class, #paths_object_class
Constructor Details
#initialize(routes_data, opts = {}) ⇒ PathsObject
Returns a new instance of PathsObject.
10 11 12 13 14 |
# File 'lib/r2-oas/schema/v3/object/from_routes/paths_object.rb', line 10 def initialize(routes_data, opts = {}) super(opts) @routes_data = routes_data define_hookable_tmp_object_class end |
Instance Method Details
#create_doc ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/r2-oas/schema/v3/object/from_routes/paths_object.rb', line 16 def create_doc if unit_paths_file_path.present? unit_paths_data = YAML.load_file(unit_paths_file_path)['paths'] result = unit_paths_data.each_with_object({}) do |(path, path_item_doc), docs| docs[path] = HookableTmpObjectClass.new(path_item_doc, path, @opts).to_doc end else result = path_item_docs.each_with_object({}) do |(path, path_item_doc), docs| docs[path] = path_item_doc end end doc.merge!(result) end |