Class: Blufin::YmlResourceValidator
- Inherits:
-
YmlValidatorBase
- Object
- YmlValidatorBase
- Blufin::YmlResourceValidator
- Defined in:
- lib/core/yml/resource/yml_resource_validator.rb
Constant Summary collapse
- CONFIG =
'config'
- CONFIG_INTERNAL =
'internal'
- CONFIG_OAUTH =
'oauth'
- STRUCTURE =
[ { :section_name => CONFIG, :section_type => Blufin::YmlValidatorBase::SECTION_TYPE_FIXED, :section_data => { CONFIG_INTERNAL => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA, :required => false, :section_data => { 'GET' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false }, 'POST' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false }, 'PATCH' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false }, 'DELETE' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false } } }, CONFIG_OAUTH => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA, :required => false, :section_data => { 'GET' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false }, 'POST' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false }, 'PATCH' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false }, 'DELETE' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, :required => false } } } } }, { # TODO - 12/20/18 - I'm pretty sure this is all wrong... :section_name => 'request', :section_type => Blufin::YmlValidatorBase::SECTION_TYPE_DYNAMIC, :section_data => { :section_alphabetical => false, :section_regex => /\A(app\.|common\.|config\.|mock\.)*[a-z_]+(\[\]|\[link\])*\z/, :section_fields => { 'type' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, :required => false }, 'flag' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, :required => false }, 'fkey' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, :required => false }, 'default' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, :required => false }, 'encrypted' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, :required => false }, 'description' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, :required => false }, 'required_if' => { :type => Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, :required => false }, } } } ]
Constants inherited from YmlValidatorBase
Blufin::YmlValidatorBase::FIELD_TYPE_ARRAY, Blufin::YmlValidatorBase::FIELD_TYPE_BLANK, Blufin::YmlValidatorBase::FIELD_TYPE_BOOLEAN, Blufin::YmlValidatorBase::FIELD_TYPE_FILE, Blufin::YmlValidatorBase::FIELD_TYPE_FLOAT, Blufin::YmlValidatorBase::FIELD_TYPE_NESTED_DATA, Blufin::YmlValidatorBase::FIELD_TYPE_TEXT, Blufin::YmlValidatorBase::SECTION_MATCHES_FILENAME, Blufin::YmlValidatorBase::SECTION_TYPE_ARRAY, Blufin::YmlValidatorBase::SECTION_TYPE_DYNAMIC, Blufin::YmlValidatorBase::SECTION_TYPE_FIXED
Instance Method Summary collapse
-
#initialize(site, error_handler) ⇒ Object
constructor
Initialize the class.
Methods inherited from YmlValidatorBase
#validate, #validate_single_file
Constructor Details
#initialize(site, error_handler) ⇒ Object
Initialize the class.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/core/yml/resource/yml_resource_validator.rb', line 102 def initialize(site, error_handler) @site = Blufin::SiteResolver::validate_site(site) @site_path = Blufin::SiteResolver::get_site_location(@site) @site_name = Blufin::SiteResolver::get_site_name(@site) @error_handler = error_handler # Create resource folder if it doesn't exist. resource_folder = "#{Blufin::SiteResolver::get_site_location(@site)}/yml/api/resources" Blufin::Files::create_directory(resource_folder) unless Blufin::Files::path_exists(resource_folder) # Loop through the array of files. Blufin::Files.get_files_in_dir(resource_folder).each { |file| scan_file(file) } end |