File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/core/EdFi.DataManagementService.Core Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -290,12 +290,18 @@ public JsonArray GetDependencies()
290
290
foreach ( JsonNode projectSchemaNode in projectSchemaNodes )
291
291
{
292
292
293
- var resourceSchemasObj = projectSchemaNode [ "resourceSchemas" ] ! . AsObject ( ) . Select ( x => new ResourceSchema ( x . Value ! ) ) ;
293
+ var resourceSchemas = projectSchemaNode [ "resourceSchemas" ] ? . AsObject ( ) . Select ( x => new ResourceSchema ( x . Value ! ) ) . ToList ( ) ;
294
+ if ( resourceSchemas == null )
295
+ {
296
+ string errorMessage = "No resourceSchemas found, ApiSchema.json is invalid" ;
297
+ _logger . LogCritical ( errorMessage ) ;
298
+ throw new InvalidOperationException ( errorMessage ) ;
299
+ }
294
300
295
301
Dictionary < string , List < string > > dependencies =
296
- resourceSchemasObj ! . ToDictionary ( rs => rs . ResourceName . Value , rs => new List < string > ( ) ) ;
302
+ resourceSchemas . ToDictionary ( rs => rs . ResourceName . Value , rs => new List < string > ( ) ) ;
297
303
298
- foreach ( var resourceSchema in resourceSchemasObj )
304
+ foreach ( var resourceSchema in resourceSchemas )
299
305
{
300
306
foreach ( var documentPath in resourceSchema . DocumentPaths . Where ( d => d . IsReference ) )
301
307
{
@@ -317,7 +323,7 @@ public JsonArray GetDependencies()
317
323
318
324
int RecursivelyDetermineDependencies ( string resourceName , int depth )
319
325
{
320
-
326
+ // Code Smell here:
321
327
// These resources are similar to abstract base classes, so they are not represented in the resourceSchemas
322
328
// portion of the schema document. This is a rudimentary replacement with the most specific version of the resource
323
329
if ( resourceName == "EducationOrganization" )
You can’t perform that action at this time.
0 commit comments