ServiceStack/ServiceStack — pull request #853 by connectassist (2013-10-23 05:38:09+00:00)
Title: Swagger ParseModel fixes/improvements

Hi Mythz,

I've made some fixes/improvements to Swagger `ParseModel(IDictionary models, Type modelType)`.

- Added an attribute `[ApiModel(IsRequred = bool, Description = string]` to override whether a field is determined optional or not rather than just using `IsNullable(Type)`

I think this is most useful in scenarios where you have types like `Enum?` or `DateTime?`. Often, we use these on required fields, then validate that they're `NotNull()` on requests, rather than them being initialised to default values. Plus it gives explicit control in general, where desired.

I also combined the `Description` property into the `[ApiModel]` attribute for convenience, so both can be set in a single attribute.

- Made `ParseModel(...)` adhere to `DataMember(Order = int)` when `[DataContract]` and `[DataMember]`(s) are defined

To do this I grabbed the `OrderedDictionary` from `ServiceStack.Redis.Support`.

If any of these changes seem out of scope, I'm happy to submit another fork that allow an override of ParseModel, implemented in a way of your choosing.

Happy to contribute further to this great product! We'll be purchasing licenses when it's commercial for sure. :)

Thanks