in tools/DeploymentsSchemaTests/TestSchemaCache.cs [34:55]
private TestSchemaCache(ResultWithErrors<ResourceTypeSchema[]> schemaResults)
{
if (schemaResults.Errors.Any())
{
var errors = schemaResults.Errors
.Where(err => !SchemaLoader.CircularReferenceSchemas.Contains(err.Target))
.ToArray();
if (errors.Any())
{
var errorsJson = JsonConvert.SerializeObject(errors, Formatting.Indented);
throw new InvalidOperationException($"Found errors building normalized cache: {errorsJson}");
}
}
this.schemaCache = schemaResults.Value
.GroupByOrdinalInsensitively(schema => schema.ResourceProviderNamespace)
.ToDictionary(
keySelector: grouping => grouping.Key,
elementSelector: grouping => grouping.ToLookupOrdinalInsensitively(schema => schema.FullyQualifiedResourceType),
comparer: StringComparer.OrdinalIgnoreCase);
}