class R2OAS::Schema::V3::Components::SchemaObject

Public Class Methods

new(route_data, path, opts = {}) click to toggle source
Calls superclass method R2OAS::Schema::V3::BaseObject::new
# File lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb, line 10
def initialize(route_data, path, opts = {})
  super(opts)
  @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]
  # MEMO:
  # Allow primitive types that cannot be passed by reference to be passed by reference
  # This is Compromise
  @ref          = { schema_name: @schema_name, tag_name: @tag_name, verb: @verb }
end

Public Instance Methods

to_doc() click to toggle source
# File lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb, line 24
def to_doc
  create_doc
  doc
end

Private Instance Methods

_components_schema_name(_http_status) click to toggle source
# File lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb, line 44
def _components_schema_name(_http_status)
  @schema_name
end
create_doc() click to toggle source
# File lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb, line 31
def create_doc
  result = {
    'type' => 'object',
    'properties' => {
      'id' => {
        'type' => 'integer',
        'format' => 'int64'
      }
    }
  }
  doc.merge!(result)
end