module SoberSwag::Reporting::Input::Interface
Module for interface methods.
Public Instance Methods
add_schema_key(base, addition)
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 103 def add_schema_key(base, addition) if base.key?(:$ref) { allOf: [base] }.merge(addition) else base.merge(addition) end end
call!(value)
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 77 def call!(value) res = call(value) raise Report::Error.new(res) if res.is_a?(Report::Base) # rubocop:disable Style/RaiseArgs res end
described(desc)
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 61 def described(desc) Described.new(self, desc) end
enum(*cases)
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 65 def enum(*cases) Enum.new(self, cases) end
format(format)
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 57 def format(format) Format.new(self, format) end
in_range(range)
click to toggle source
Constrained values: must be in range. @return [InRange]
# File lib/sober_swag/reporting/input/interface.rb, line 41 def in_range(range) raise ArgumentError, "need a range, not a #{range.class}" unless range.is_a?(Range) InRange.new(self, range) end
list()
click to toggle source
A list of this input.
@return [List] the new input.
# File lib/sober_swag/reporting/input/interface.rb, line 34 def list List.new(self) end
mapped(&block)
click to toggle source
Map a function after this input runs.
@return [Mapped] the new input.
# File lib/sober_swag/reporting/input/interface.rb, line 73 def mapped(&block) Mapped.new(self, block) end
modify_schema(base, addition)
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 92 def modify_schema(base, addition) schema, found = base.swagger_schema merged = if schema.key?(:$ref) { allOf: [schema] } else schema end.merge(addition) [merged, found] end
multiple_of(number)
click to toggle source
Constrained values: must be a multiple of the given number
# File lib/sober_swag/reporting/input/interface.rb, line 49 def multiple_of(number) MultipleOf.new(self, number) end
optional()
click to toggle source
This, or null.
@return [Either] an either type of this or nil.
# File lib/sober_swag/reporting/input/interface.rb, line 26 def optional self | Null.new end
or(other)
click to toggle source
Make a new input that is either this type or the argument.
@argument other [Interface] other input type @return [Either] this input, or some other input.
# File lib/sober_swag/reporting/input/interface.rb, line 12 def or(other) Either.new(self, other) end
referenced(name)
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 53 def referenced(name) Referenced.new(self, name) end
swagger_path_schema()
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 84 def swagger_path_schema raise InvalidSchemaError::InvalidForPathError.new(self) # rubocop:disable Style/RaiseArgs end
swagger_query_schema()
click to toggle source
# File lib/sober_swag/reporting/input/interface.rb, line 88 def swagger_query_schema raise InvalidSchemaError::InvalidForQueryError.new(self) # rubocop:disable Style/RaiseArgs end
|(other)
click to toggle source
@see {#or}
# File lib/sober_swag/reporting/input/interface.rb, line 18 def |(other) Either.new(self, other) end