Sha256: 5ce00f3ebc2b59dcf2d7e6145fcd735f10026e8e18ef850766583420025c41b6

Contents?: true

Size: 904 Bytes

Versions: 40

Compression:

Stored size: 904 Bytes

Contents

# list object loader
class OpenAPIParser::SchemaLoader::ListLoader < OpenAPIParser::SchemaLoader::Creator
  # @param [OpenAPIParser::Schemas::Base] target_object
  # @param [Hash] raw_schema
  # @return [Array<OpenAPIParser::Schemas::Base>, nil]
  def load_data(target_object, raw_schema)
    create_attr_list_object(target_object, raw_schema[ref_name_base.to_s])
  end

  private

    def create_attr_list_object(target_object, array_schema)
      unless array_schema
        variable_set(target_object, variable_name, nil)
        return
      end

      data = array_schema.map.with_index do |s, idx|
        ref = build_object_reference_from_base(target_object.object_reference, [ref_name_base, idx])
        build_openapi_object_from_option(target_object, ref, s)
      end

      variable_set(target_object, variable_name, data)
      data
    end

    alias_method :ref_name_base, :schema_key
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
openapi_parser-2.2.2 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-2.2.1 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-2.2.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-2.1.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-2.0.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser_firetail-1.0.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-1.0.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-1.0.0.beta1 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.15.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.14.1 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.14.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.13.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.12.1 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.12.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.11.2 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.11.1 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.11.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.10.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.9.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb
openapi_parser-0.8.0 lib/openapi_parser/concerns/schema_loader/list_loader.rb