Skip to content

Commit

Permalink
#40: fix empty resource in report for invalid files
Browse files Browse the repository at this point in the history
added placeholder name for a payload where resource can't be determined
  • Loading branch information
mohit-s96 committed Sep 20, 2023
1 parent a3679a6 commit 336cdca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/schema/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ addFormats(ajv);
ajvErrors(ajv);

const addPayloadError = (resource, fileName, message, payloadErrors) => {
resource = resource || '_INVALID_';
if (!payloadErrors[resource]) {
payloadErrors[resource] = {};
}
Expand Down Expand Up @@ -62,9 +63,9 @@ function validatePayload({ payloads = {}, schema, resourceNameFromArgs = '', ver
ddVersion;
let validPayload = true;
try {
//TODO: 1. Not all payloads will contain this property - it will either by @reso.context or have at least one top-level @odata. property...
// but in the OData case the version needs to be passed in from the command line and the resource name passed as well
// 2. We also need to be able to take a passed-in version
// 1. Not all payloads will contain this property - it will either by @reso.context or have at least one top-level @odata. property...
// but in the OData case the version needs to be passed in from the command line and the resource name passed as well
// 2. We also need to be able to take a passed-in version

if (!payload['@reso.context']) {
if (!versionFromArgs) {
Expand Down

0 comments on commit 336cdca

Please sign in to comment.