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

- old
+ new

@@ -1,10 +1,10 @@ # unpack additional documentation # Reader - ADIwg JSON to internal data structure # History: -# Stan Smith 2018-02-18 refactored error and warning messaging +# Stan Smith 2018-06-13 refactored error and warning messaging # Stan Smith 2016-10-17 refactored for mdJson 2.0 # Stan Smith 2015-07-14 refactored to remove global namespace constants # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj) # Stan Smith 2014-12-30 added return if empty input # ... found & fixed error of method using associatedResource object instead of @@ -21,13 +21,15 @@ module AdditionalDocumentation def self.unpack(hAddDoc, responseObj) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + # return nil object if input is empty if hAddDoc.empty? - responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: additional documentation object is empty' + @MessagePath.issueWarning(1, responseObj) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new @@ -43,13 +45,11 @@ end end end end if intAddDoc[:resourceTypes].empty? - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: additional documentation is missing resource type' - responseObj[:readerExecutionPass] = false - return nil + @MessagePath.issueError(2, responseObj) end # additional documentation - citation [] (required) if hAddDoc.has_key?('citation') hAddDoc['citation'].each do |item| @@ -58,12 +58,10 @@ intAddDoc[:citation] << hDoc end end end if intAddDoc[:citation].empty? - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: additional documentation is missing citation' - responseObj[:readerExecutionPass] = false - return nil + @MessagePath.issueError(3, responseObj) end return intAddDoc end