RESOStandards / reso-certification-utils

NodeJS package with reference artifacts and ETL processes for Certification.
Other
2 stars 1 forks source link

#175: Change handling of expansion related errors #176

Closed mohit-s96 closed 2 months ago

mohit-s96 commented 2 months ago

closes #175

This fixes the main issue from #175 and also adds the new fields sourceModel and sourceModelField to the schema validation error report. Errors in expanded items will now be reported using these new fields so it's clear which field failed and for which model.

For eg. this is what an error in Property->ListAgent(Member type)->MemberEmail would look like:

{
    "description": "RESO Common Format Schema Validation Summary",
    "generatedOn": "2024-08-28T14:10:31.557Z",
    "version": "2.0",
    "totalErrors": 1,
    "totalWarnings": 0,
    "items": [
        {
            "resourceName": "Property",
            "fieldName": "ListAgent",
            "errors": [
                {
                    "message": "MUST be string or null but found integer",
                    "occurrences": [
                        {
                            "count": 1,
                            "fileName": "payload.json",
                            "sourceModel": "Member",
                            "sourceModelField": "MemberEmail"
                        }
                    ]
                }
            ],
            "warnings": []
        }
    ]
}