diff --git a/Swashbuckle.OData.Tests/Fixtures/ODataQueryOptionsTests.cs b/Swashbuckle.OData.Tests/Fixtures/ODataQueryOptionsTests.cs index 4ed1e19..e65fe8f 100644 --- a/Swashbuckle.OData.Tests/Fixtures/ODataQueryOptionsTests.cs +++ b/Swashbuckle.OData.Tests/Fixtures/ODataQueryOptionsTests.cs @@ -49,6 +49,8 @@ public async Task It_supports_controller_with_single_get_method_with_odataqueryo swaggerDocument.paths.TryGetValue("/odata/Products3({Id})", out pathItem2); pathItem.Should().NotBeNull(); pathItem.get.Should().NotBeNull(); + // Verify that ODataQueryOptions types are not in the definition + swaggerDocument.definitions.ContainsKey("ApplyQueryOption").Should().BeFalse(); await ValidationUtils.ValidateSwaggerJson(); } diff --git a/Swashbuckle.OData/Descriptions/ODataActionDescriptorMapperBase.cs b/Swashbuckle.OData/Descriptions/ODataActionDescriptorMapperBase.cs index 4f8bd01..e7e0cea 100644 --- a/Swashbuckle.OData/Descriptions/ODataActionDescriptorMapperBase.cs +++ b/Swashbuckle.OData/Descriptions/ODataActionDescriptorMapperBase.cs @@ -162,7 +162,11 @@ protected List CreateParameterDescriptions(HttpActionDe { foreach (var parameterBinding in parameterBindings) { - Contract.Assume(parameterBinding != null); + Contract.Assume(parameterBinding != null || parameterBinding.Descriptor != null); + if(parameterBinding.Descriptor.IsODataLibraryType()) + { + continue; + } parameterDescriptions.Add(CreateParameterDescriptionFromBinding(parameterBinding)); } }