Class: R2OAS::Schema::V3::Components::SchemaObject
- Inherits:
-
Plugins::Schema::V3::HookableBaseObject
- Object
- BaseObject
- Plugins::Schema::V3::HookableBaseObject
- R2OAS::Schema::V3::Components::SchemaObject
- Defined in:
- lib/r2-oas/schema/v3/object/components/schema_object.rb
Instance Attribute Summary
Attributes inherited from Plugins::Schema::V3::HookableBaseObject
Instance Method Summary collapse
-
#components_schema_name(_doc, _path_component, _tag_name, _verb, _http_status, schema_name) ⇒ Object
MEMO: please override in inherited class.
- #create_doc ⇒ Object
-
#initialize(route_data, path) ⇒ SchemaObject
constructor
A new instance of SchemaObject.
- #to_doc ⇒ Object
Methods inherited from Plugins::Schema::V3::HookableBaseObject
execute_hook, has_hook?, hook, hook=, hooks, inherited, off, on, #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(route_data, path) ⇒ SchemaObject
10 11 12 13 14 15 16 17 18 |
# File 'lib/r2-oas/schema/v3/object/components/schema_object.rb', line 10 def initialize(route_data, path) super() @path_comp = Routing::PathComponent.new(path) @path = @path_comp.symbol_to_brace @route_data = route_data @verb = route_data[:verb] @tag_name = route_data[:tag_name] @schema_name = route_data[:schema_name] end |
Instance Method Details
#components_schema_name(_doc, _path_component, _tag_name, _verb, _http_status, schema_name) ⇒ Object
MEMO: please override in inherited class.
42 43 44 |
# File 'lib/r2-oas/schema/v3/object/components/schema_object.rb', line 42 def components_schema_name(_doc, _path_component, _tag_name, _verb, _http_status, schema_name) schema_name end |
#create_doc ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/r2-oas/schema/v3/object/components/schema_object.rb', line 27 def create_doc result = { 'type' => 'object', 'properties' => { 'id' => { 'type' => 'integer', 'format' => 'int64' } } } doc.merge!(result) end |
#to_doc ⇒ Object
20 21 22 23 24 25 |
# File 'lib/r2-oas/schema/v3/object/components/schema_object.rb', line 20 def to_doc execute_before_create(@schema_name) create_doc execute_after_create(@schema_name) doc end |