khellang/Nancy.Swagger — pull request #47 by TimSchlechter (2014-08-26 19:36:19+00:00)
Title: Added a hook to post-process models

Here someting which was on my mind for a while, but I finally got a chance to implement it.

In #17 we talked a bit about some attributes with valuable metadata, like System.ComponentModel.DataAnnotations.RequiredAttribute or Newtonsoft.Json.Serialization.JsonProperty.

I suggest adding/using the following interface for this:
```csharp
public interface IModelPostprocessor
{
void Process(SwaggerModel model, SwaggerModelData data);
}
```

These processors are invoked after a SwaggerModel is created, giving you the chance to modify it.

Example implementation:
```csharp
public class JsonNetModelProcessor : IModelPostprocessor
{
public void Process(SwaggerModel model, SwaggerModelData data)
{
// Reflect the properties in data.ModelType to find
// JsonPropertyAttribute, and use this to modify
// the property's name for example
}
}
```