in src/AutoRest.CSharp/Mgmt/Decorator/Transformer/OmitOperationGroups.cs [100:146]
private static void AddDependantSchemasRecursively(Dictionary<Schema, HashSet<OperationGroup>> setToProcess)
{
Queue<Schema> sQueue = new Queue<Schema>(setToProcess.Keys);
HashSet<Schema> handledSchemas = new HashSet<Schema>();
while (sQueue.Count > 0)
{
var cur = sQueue.Dequeue();
handledSchemas.Add(cur);
if (cur is ObjectSchema curSchema)
{
foreach (var property in curSchema.Properties)
{
var propertySchema = property.Schema;
if (propertySchema is ObjectSchema || propertySchema is ChoiceSchema || propertySchema is SealedChoiceSchema)
{
if (!handledSchemas.Contains(propertySchema))
{
sQueue.Enqueue(propertySchema);
setToProcess.AddSchema(propertySchema, setToProcess[cur].ToArray());
}
}
else if (propertySchema is ArraySchema arraySchema && arraySchema.ElementType is ObjectSchema arrayPropertySchema)
{
if (!handledSchemas.Contains(arrayPropertySchema))
{
sQueue.Enqueue(arrayPropertySchema);
setToProcess.AddSchema(arrayPropertySchema, setToProcess[cur].ToArray());
}
}
}
if (curSchema.Parents != null)
{
foreach (var parent in curSchema.Parents.Immediate)
{
if (parent is ObjectSchema parentSchema)
{
if (!handledSchemas.Contains(parentSchema))
{
sQueue.Enqueue(parentSchema);
setToProcess.AddSchema(parentSchema, setToProcess[cur].ToArray());
}
}
}
}
}
}
}