12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/zendesk_apps_support/validations/manifest.rb', line 12
def call(package)
return [ValidationError.new(:missing_manifest)] unless package.has_file?('manifest.json')
manifest = package.manifest_json
errors = []
errors << missing_keys_error(manifest)
errors << default_locale_error(manifest, package)
errors << oauth_error(manifest)
errors << parameters_error(manifest)
errors << invalid_hidden_parameter_error(manifest)
errors << invalid_type_error(manifest)
errors << name_as_parameter_name_error(manifest)
if manifest['requirementsOnly']
errors << ban_location(manifest)
errors << ban_framework_version(manifest)
else
errors << missing_location_error(package)
errors << invalid_location_error(package)
errors << duplicate_location_error(manifest)
errors << missing_framework_version(manifest)
errors << invalid_version_error(manifest, package)
end
errors.flatten.compact
rescue JSON::ParserError => e
return [ValidationError.new(:manifest_not_json, errors: e)]
end
|