lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb in adiwg-mdtranslator-2.9.2 vs lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb in adiwg-mdtranslator-2.10.0

- old
+ new

@@ -34,57 +34,57 @@ # parse mdJson file begin hMdJson = JSON.parse(file) rescue JSON::JSONError => err - hResponseObj[:readerStructureMessages] << 'Parsing mdJson Failed - see following message(s):\n' + hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: Parsing mdJson Failed - see following message(s):\n' hResponseObj[:readerStructureMessages] << err.to_s.slice(0, 300) hResponseObj[:readerStructurePass] = false return {} end # file must contain an mdJson object if hMdJson.empty? - hResponseObj[:readerStructureMessages] << 'mdJson object is empty' + hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: object is empty' hResponseObj[:readerStructurePass] = false return {} end # schema - (required) unless hMdJson.has_key?('schema') - hResponseObj[:readerStructureMessages] << 'mdJson is missing schema object' + hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: schema definition is missing ' hResponseObj[:readerStructurePass] = false return {} end # schema - name (required) (must = 'mdJson') unless hMdJson['schema'].has_key?('name') - hResponseObj[:readerStructureMessages] << 'mdJson schema:name attribute is missing' + hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: schema element is missing' hResponseObj[:readerStructurePass] = false return {} end schemaName = hMdJson['schema']['name'] if schemaName.nil? || schemaName == '' - hResponseObj[:readerStructureMessages] << 'mdJson schema name is missing' + hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: schema name is missing' hResponseObj[:readerStructurePass] = false return {} end unless schemaName.downcase == 'mdjson' - hResponseObj[:readerStructureMessages] << "mdJson schema name is '#{schemaName}', should be mdJson" + hResponseObj[:readerStructureMessages] << "ERROR: mdJson reader: schema name is '#{schemaName}', should be mdJson" hResponseObj[:readerStructurePass] = false return {} end # schema - version (required) unless hMdJson['schema'].has_key?('version') - hResponseObj[:readerStructureMessages] << 'mdJson schema:version attribute is missing' + hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: schema version element is missing' hResponseObj[:readerStructurePass] = false return {} end requestedVersion = hMdJson['schema']['version'] if requestedVersion.nil? || requestedVersion == '' - hResponseObj[:readerStructureMessages] << 'mdJson schema version is missing' + hResponseObj[:readerStructureMessages] << 'ERROR: mdJson reader: schema version is missing' hResponseObj[:readerStructurePass] = false return {} end # schema - 2.0.0 =< requested version =< current version @@ -99,11 +99,11 @@ approved = true end end unless approved approvedVersion = aCurVersion[0] + '.0.0' - hResponseObj[:readerStructureMessages] << "mdJson schema version '#{requestedVersion}' is not supported" - hResponseObj[:readerStructureMessages] << "mdJson versions '#{approvedVersion}' to '#{currentVersion}' are supported" + hResponseObj[:readerStructureMessages] << "ERROR: mdJson reader: schema version '#{requestedVersion}' is not supported" + hResponseObj[:readerStructureMessages] << "... mdTranslator supports mdJson schema version '#{approvedVersion}' through '#{currentVersion}'" hResponseObj[:readerStructurePass] = false return {} end # validate file against mdJson schema definition