From 668d84955122c2cd508666e2d10faaf2a6dba0f6 Mon Sep 17 00:00:00 2001 From: Sarah Ridge Date: Wed, 11 Nov 2020 20:03:59 -0700 Subject: [PATCH] Fix Schema Extraction for Arrays --- lib/rspec_api_documentation/writers/open_api_writer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec_api_documentation/writers/open_api_writer.rb b/lib/rspec_api_documentation/writers/open_api_writer.rb index ed5d0420..1c55149d 100644 --- a/lib/rspec_api_documentation/writers/open_api_writer.rb +++ b/lib/rspec_api_documentation/writers/open_api_writer.rb @@ -144,7 +144,7 @@ def extract_schema(fields) opts = {enum: field[:enum], minimum: field[:minimum], maximum: field[:maximum]} if current[:properties][field[:name]][:type] == :array - current[:properties][field[:name]][:items] = field[:items] || OpenApi::Helper.extract_items(field[:value][0], opts) + current[:properties][field[:name]][:items] = field[:items] || OpenApi::Helper.extract_items(field[:value], opts) else opts.each { |k, v| current[:properties][field[:name]][k] = v if v } end