Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/readme.graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,20 @@ directive:
let errorDetailsRegex = /(ErrorDetails\s*=\s*)(new.*ErrorDetails\(message\).*)/gmi
$ = $.replace(errorDetailsRegex, '$1await this.GetErrorDetailsAsync((await response)?.Error, responseMessage)');

// Prevents null response objects to the output stream for scenarios where response is a model type
let responseTypeRegex = /global::System.Threading.Tasks.Task<Microsoft.Graph(.|.Beta.)PowerShell.Models.\w*> \w*\)[^]*?(WriteObject.*(await response).*;)/gm
var writeObjectRegex = /(WriteObject.*(await response).*;)/gm
var responseTypeRegexMatch = $.match(responseTypeRegex);
if(responseTypeRegexMatch){
responseTypeRegexMatch.forEach((item)=>{
var writeObjectRegexMatch = writeObjectRegex.exec($);
if(writeObjectRegexMatch){
var newContent = item.replace(writeObjectRegex, `var result = ${writeObjectRegexMatch[2]}; if(result!=null){WriteObject(result);}`)
$ = $.replace(item, newContent);
}
});
}

return $;
}

Expand Down