Class: ArchiveValidator::SchemaValidator

Inherits:
BaseValidator show all
Defined in:
lib/archive_validator/schema_validator.rb

Constant Summary collapse

JSON_SCHEMA =
"lib/schemas/archive-format.json"

Instance Attribute Summary

Attributes inherited from BaseValidator

#archive_hash

Instance Method Summary collapse

Methods inherited from BaseValidator

#initialize, #messages, #valid?

Methods included from ArchiveImporter::ArchiveHelper

#archive_author_diaspora_id, #contact_groups, #contacts, #others_relayables, #person, #post_subscriptions, #posts, #private_key, #relayables, #serialized_private_key

Constructor Details

This class inherits a constructor from ArchiveValidator::BaseValidator

Instance Method Details

#validateObject


7
8
9
10
11
# File 'lib/archive_validator/schema_validator.rb', line 7

def validate
  return if JSON::Validator.validate(JSON_SCHEMA, archive_hash)

  messages.push("Archive schema validation failed")
end