From 6d927132074ec2aeac1b93ea4054bf46f836960c Mon Sep 17 00:00:00 2001 From: Jeffrey Alvarez Date: Mon, 7 Aug 2017 20:07:39 -0400 Subject: [PATCH 1/2] Fixed saving/displaying incomplete descriptions of body parameters. Fixed repeating the last description in each parameter description. --- lib/swaggard/swagger/parameters/body.rb | 4 ++-- lib/swaggard/swagger/type.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/swaggard/swagger/parameters/body.rb b/lib/swaggard/swagger/parameters/body.rb index 3f17375..b11e46e 100644 --- a/lib/swaggard/swagger/parameters/body.rb +++ b/lib/swaggard/swagger/parameters/body.rb @@ -38,7 +38,7 @@ class Property attr_reader :id - def initialize(string) + def initialize(string)git parse(string) end @@ -52,7 +52,7 @@ def to_doc # Example: [Array] status(required) Filter by status. (e.g. status[]=1&status[]=2&status[]=3) # Example: [Integer] media[media_type_id] ID of the desired media type. def parse(string) - data_type, name, description = string.split + data_type, name, description = string.split(' ', 3) # Fix to data_type.gsub!('[', '').gsub!(']', '') diff --git a/lib/swaggard/swagger/type.rb b/lib/swaggard/swagger/type.rb index 5d63b9a..e7b58a7 100644 --- a/lib/swaggard/swagger/type.rb +++ b/lib/swaggard/swagger/type.rb @@ -46,7 +46,7 @@ def parse(types) def type_tag_and_name if basic_type? - BASIC_TYPES[@name.downcase] + BASIC_TYPES[@name.downcase].clone # Clone this since we don't want this hash instance to be changed globally else { '$ref' => "#/definitions/#{name}" } end From fe29d639d0b6005f264fdc5491a7566a556156f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Alvarez Date: Mon, 7 Aug 2017 20:07:39 -0400 Subject: [PATCH 2/2] Fixed saving/displaying incomplete descriptions of body parameters. Fixed repeating the last description in each parameter description. --- lib/swaggard/swagger/parameters/body.rb | 2 +- lib/swaggard/swagger/type.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/swaggard/swagger/parameters/body.rb b/lib/swaggard/swagger/parameters/body.rb index 3f17375..5530f4c 100644 --- a/lib/swaggard/swagger/parameters/body.rb +++ b/lib/swaggard/swagger/parameters/body.rb @@ -52,7 +52,7 @@ def to_doc # Example: [Array] status(required) Filter by status. (e.g. status[]=1&status[]=2&status[]=3) # Example: [Integer] media[media_type_id] ID of the desired media type. def parse(string) - data_type, name, description = string.split + data_type, name, description = string.split(' ', 3) # Fix to data_type.gsub!('[', '').gsub!(']', '') diff --git a/lib/swaggard/swagger/type.rb b/lib/swaggard/swagger/type.rb index 5d63b9a..e7b58a7 100644 --- a/lib/swaggard/swagger/type.rb +++ b/lib/swaggard/swagger/type.rb @@ -46,7 +46,7 @@ def parse(types) def type_tag_and_name if basic_type? - BASIC_TYPES[@name.downcase] + BASIC_TYPES[@name.downcase].clone # Clone this since we don't want this hash instance to be changed globally else { '$ref' => "#/definitions/#{name}" } end