data.gov icon indicating copy to clipboard operation
data.gov copied to clipboard

Add warning/error handling to DCATUS writer for required properties.

Open rshewitt opened this issue 6 months ago • 1 comments

User Story

In order to correctly process information according to the DCATUS schema, datagov wants to add warning/error handling to the DCATUS writer for required properties

Acceptance Criteria

[ACs should be clearly demoable/verifiable whenever possible. Try specifying them using BDD.]

  • [ ] GIVEN the DCATUS writer
    AND the v1.1 schema WHEN a required property is missing
    THEN the writer fails to process
    AND the error/warning is appended to the writer messages array.

Background

  • the DCATUS writer doesn't check for required properties which is a standard practice for MDTranslator reader/writers. these checks need to be added.

Security Considerations (required)

[Any security concerns that might be implicated in the change. "None" is OK, just be explicit here!]

Sketch

  • dcatus v1.1 schema doc
  • for all required properties add a check in the associated module to handle when the property is nil/empty. for example, title is required. if that value doesn't exist then handle it like...
    # ...
    metadataInfo = intObj[:metadata][:metadataInfo]
    resourceInfo = intObj[:metadata][:resourceInfo]
    citation = resourceInfo[:citation]
    
    title = citation[:title]
    if title.nil? 
      responseObj[:writerPass] = false
      responseObj[:writerMessages] << "title is missing"
      return 
    end
    # ...
    

rshewitt avatar Aug 14 '24 16:08 rshewitt