rbeauchamp / Swashbuckle.OData

Extends Swashbuckle with OData v4 support!
Other
129 stars 96 forks source link

enum as model key causes exception #108

Closed will-chan-sage closed 7 years ago

will-chan-sage commented 8 years ago

Are enum as keys supported in Swashbuckle.OData? Currently an exception occurs in the class: ODataSwaggerUtilities.cs as the resulting variable 'keyDefinition' is null because it is not a primitive type. To my understanding, System.Web.Odata does allow enum types as keys (https://github.com/OData/WebApi/commit/6323639f24e3198074cee887090c0203c055f6ab)

From this patch, it seems we can enable enum type as keys if we get the enums underlying type "diff" for Swashbuckle.OData/Descriptions/ODataSwaggerUtilities.cs ODataSwaggerUtilities.cs.patch.zip

will-chan-sage commented 7 years ago

The previous attached patch was incorrect. I believe the attached one here is more correct. EnumAsModelKeyException.zip