domaindrivendev/Swashbuckle — pull request #61 by chris-peterson (2014-07-30 20:30:07+00:00)
Title: Allow customizing sort order for API groups

Consider an API that has a specific workflow. I wish to communicate this workflow in the order of my API groups, e.g.
1.	Auth
2.	Search
3.	Purchase
4.	Download

Customize:
```c#
SwaggerSpecConfig.Customize(c =>
{
c.SortDeclarationsBy(new ApiGrouping());
});
```

Example customization:
```c#
private class ApiGrouping : IComparer
{
private readonly Dictionary _orderPreferences = new Dictionary();

public ApiGrouping()
{
int index = 0;
foreach (var str in new[] { "Auth", "Search", "Purchase", "Download" })
{
_orderPreferences.Add(str, index++);
}
}

public int Compare(string x, string y)
{
if (_orderPreferences.ContainsKey(x) && _orderPreferences.ContainsKey(y))
{
return _orderPreferences[x].CompareTo(_orderPreferences[y]);
}

return Comparer.Default.Compare(x, y);
}
}
```

Could consider adding a convenience:
```c#
c.PreferredApiGroupOrder("Auth", "Search", "Purchase", "Download" );
```