diff --git a/lib/apipie_bindings/param.rb b/lib/apipie_bindings/param.rb index 684a25f..65e993e 100644 --- a/lib/apipie_bindings/param.rb +++ b/lib/apipie_bindings/param.rb @@ -13,12 +13,18 @@ def initialize(param) @description = param[:description].gsub(/<\/?[^>]+?>/, "") @required = !!param[:required] @validator = param[:validator] + # We expect a value from API param docs, but in case it's not there, we want to show it in help by default + @show = param[:show].nil? ? true : param[:show] end def required? @required end + def show? + @show + end + def to_s "" end diff --git a/test/unit/param_test.rb b/test/unit/param_test.rb index 2d87d89..29cc0f6 100644 --- a/test/unit/param_test.rb +++ b/test/unit/param_test.rb @@ -16,7 +16,18 @@ "full_name" => "architecture[name]", "name" => "name", "required" => false, - "validator" => "Must be String" + "validator" => "Must be String", + "show" => true + }, + { + "allow_nil" => false, + "description" => "", + "expected_type" => "integer", + "full_name" => "architecture[hidden]", + "name" => "hidden", + "required" => false, + "validator" => "Must be Integer", + "show" => false } ], @@ -54,4 +65,9 @@ param.inspect.must_equal "" end + it "should have show?" do + param.show?.must_equal true + param.params.first.show?.must_equal true + param.params.last.show?.must_equal false + end end