Class: Diesel::Swagger::Parameter

Inherits:
DataTypeField show all
Defined in:
lib/diesel/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 Diesel::Swagger::Node

Instance Method Details

#schema?Boolean

Returns:

  • (Boolean)


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

def schema?
  !!schema
end

#validateObject



25
26
27
28
29
# File 'lib/diesel/swagger/parameter.rb', line 25

def validate
  if type == :path && !required?
    errors << "Path parameters must be defined as required"
  end
end