Skip to content

Commit 273967c

Browse files
committed
no random value for enums, the first by default
1 parent b57ca76 commit 273967c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/open_api_import.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,17 +716,19 @@ class << self
716716
end
717717

718718
if val.key?(:items) and val[:items].key?(:enum)
719+
#before we were getting in all these cases a random value from the enum, now we are getting the first position by default
720+
#the reason is to avoid confusion later in case we want to compare two swaggers and verify the changes
719721
if type==:only_value
720722
if val[:items][:enum][0].is_a?(String)
721-
example << " [\"" + val[:items][:enum].sample + "\"] "
723+
example << " [\"" + val[:items][:enum][0] + "\"] "
722724
else
723-
example << " [" + val[:items][:enum].sample + "] "
725+
example << " [" + val[:items][:enum][0] + "] "
724726
end
725727
else
726728
if val[:items][:enum][0].is_a?(String)
727-
example << " #{prop.to_sym}: [\"" + val[:items][:enum].sample + "\"], "
729+
example << " #{prop.to_sym}: [\"" + val[:items][:enum][0] + "\"], "
728730
else
729-
example << " #{prop.to_sym}: [" + val[:items][:enum].sample + "], "
731+
example << " #{prop.to_sym}: [" + val[:items][:enum][0] + "], "
730732
end
731733
end
732734
else

0 commit comments

Comments
 (0)