Sha256: 52dd42bcd9f28961d097e392119514b35f99a1e61003d86edd3b688edece9b80
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
# frozen_string_literal: true require 'r2-oas/dynamic/schema/v3/object/from_routes/hookable_base_object' module R2OAS module Schema module V3 module Components class SchemaObject < R2OAS::Dynamic::Schema::V3::HookableBaseObject 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 def to_doc execute_before_create(@schema_name) create_doc execute_after_create(@schema_name) doc end # MEMO: # please override in inherited class. def components_schema_name(_doc, _path_component, _tag_name, _verb, _http_status, schema_name) schema_name end private def create_doc result = { 'type' => 'object', 'properties' => { 'id' => { 'type' => 'integer', 'format' => 'int64' } } } doc.merge!(result) end def _components_schema_name(http_status) components_schema_name(doc, @path_comp, @tag_name, @verb, http_status, @schema_name) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
r2-oas-0.4.1 | lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb |
r2-oas-0.4.0 | lib/r2-oas/schema/v3/object/from_routes/components/schema_object.rb |