Class: Apiture::Swagger::Parameter

Inherits:
DataTypeField show all
Defined in:
lib/apiture/swagger/parameter.rb

Constant Summary collapse

VALID_TYPES =
%w(
  string
  number
  integer
  boolean
  array
  file
)

Instance Attribute Summary

Attributes inherited from Node

#errors

Instance Method Summary collapse

Methods inherited from Node

attribute, attribute_names, #collect_errors, collect_errors, #extensions, hash, hash_names, inherited, #initialize, list, list_names, #serializable_hash, #to_json, #valid?

Methods included from Utils::Inflections

acronym_regex, acronyms, #camelize, #constantize, #underscore

Constructor Details

This class inherits a constructor from Apiture::Swagger::Node

Instance Method Details

#schema?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/apiture/swagger/parameter.rb', line 21

def schema?
  !!schema
end

#validateObject



25
26
27
28
29
30
31
32
# File 'lib/apiture/swagger/parameter.rb', line 25

def validate
  if self.in.nil?
    errors << "in attribute is required"
  end
  if self.in == :path && !required?
    errors << "Path parameters must be defined as required"
  end
end