lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb in adiwg-mdtranslator-2.13.0 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb in adiwg-mdtranslator-2.13.1

- old
+ new

@@ -1,10 +1,10 @@ # unpack schema # Reader - ADIwg JSON to internal data structure # History: -# Stan Smith 2018-02-19 refactored error and warning messaging +# Stan Smith 2018-06-25 refactored error and warning messaging # Stan Smith 2016-11-02 original script module ADIWG module Mdtranslator module Readers @@ -12,14 +12,15 @@ module Schema def self.unpack(hSchema, responseObj) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + # return nil object if input is empty if hSchema.empty? - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: schema object is empty' - responseObj[:readerExecutionPass] = false + @MessagePath.issueError(720, responseObj) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new @@ -28,22 +29,18 @@ # schema - name (required) if hSchema.has_key?('name') intSchema[:name] = hSchema['name'] end if intSchema[:name].nil? || intSchema[:name] == '' - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: schema name is missing' - responseObj[:readerExecutionPass] = false - return nil + @MessagePath.issueError(721, responseObj) end # schema - version (required) if hSchema.has_key?('version') intSchema[:version] = hSchema['version'] end if intSchema[:version].nil? || intSchema[:version] == '' - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: schema version is missing' - responseObj[:readerExecutionPass] = false - return nil + @MessagePath.issueWarning(722, responseObj) end return intSchema end