Skip to content

Commit

Permalink
Prepare for release 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Beauchamp committed Dec 7, 2015
1 parent 801f5c2 commit 7163d50
Show file tree
Hide file tree
Showing 39 changed files with 76 additions and 5,573 deletions.
16 changes: 16 additions & 0 deletions License.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,19 @@ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPO
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

------------------------------------------------------------------------------------------------------------------------------

Certain portions of this code is Copyright (c) 2013, Richard Morris - All rights reserved.

For those portions, the following license applies:

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHA
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Swashbuckle.OData

Extends Swashbuckle with WebApi OData v4 support!

Implements a custom Swagger Provider that converts an Entity Data Model to a Swagger Document.

### <a href="http://swashbuckleodata.azurewebsites.net/swagger/" target="_blank">Try it out!</a> ###

## Getting Started ##
Expand Down
4 changes: 2 additions & 2 deletions Swashbuckle.OData.Nuget/Swashbuckle.OData.NuGet.nuproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
<Owners>Richard Beauchamp</Owners>
<Summary>Extends Swashbuckle with WebApi OData v4 support!</Summary>
<Description>Extends Swashbuckle with WebApi OData v4 support!</Description>
<ReleaseNotes>Simplified configuration, upgraded to .NET 4.5, fixed metadata path in Swagger UI, uses correct OData route prefix</ReleaseNotes>
<ReleaseNotes>Now supports customization of generated swagger docs via SwaggerConfig, Verifies entity data model against the OData API, Customize output with ApiExplorer-supported attributes</ReleaseNotes>
<ProjectUrl>https://github.com/rbeauchamp/Swashbuckle.OData</ProjectUrl>
<LicenseUrl>https://github.com/rbeauchamp/Swashbuckle.OData/blob/master/License.txt</LicenseUrl>
<Copyright>Copyright 2015</Copyright>
<Tags>Swashbuckle Swagger SwaggerUi OData Documentation Discovery Help WebApi AspNet AspNetWebApi Docs WebHost IIS</Tags>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Swashbuckle.OData\Swashbuckle.OData.csproj" />
Expand Down
13 changes: 13 additions & 0 deletions Swashbuckle.OData.Tests/ApplyDocumentVendorExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Web.Http.Description;
using Swashbuckle.Swagger;

namespace Swashbuckle.OData.Tests
{
public class ApplyDocumentVendorExtensions : IDocumentFilter
{
public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer)
{
swaggerDoc.host = "foo";
}
}
}
33 changes: 33 additions & 0 deletions Swashbuckle.OData.Tests/Fixtures/ODataSwaggerProviderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Threading.Tasks;
using FluentAssertions;
using Microsoft.Owin.Hosting;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using Swashbuckle.Application;
using Swashbuckle.OData.Tests.WebHost;
using Swashbuckle.Swagger;

namespace Swashbuckle.OData.Tests
{
[TestFixture]
public class ODataSwaggerProviderTests
{
[Test]
public async Task It_applies_document_filters()
{
// Arrange
Action<SwaggerDocsConfig> config = c => c.DocumentFilter<ApplyDocumentVendorExtensions>();
var httpClient = HttpClientUtils.GetHttpClient();

using (WebApp.Start(TestWebApiStartup.BaseAddress, appBuilder => new TestWebApiStartup().Configuration(appBuilder, config)))
{
// Act
var swaggerDocument = await httpClient.GetJsonAsync<SwaggerDocument>("swagger/docs/v1");

// Assert
swaggerDocument.host.Should().Be("foo");
}
}
}
}
2 changes: 2 additions & 0 deletions Swashbuckle.OData.Tests/Swashbuckle.OData.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApplyDocumentVendorExtensions.cs" />
<Compile Include="ContentType.cs" />
<Compile Include="Fixtures\ODataSwaggerProviderTests.cs" />
<Compile Include="Fixtures\PostTests.cs" />
<Compile Include="Fixtures\PatchTests.cs" />
<Compile Include="Fixtures\PutTests.cs" />
Expand Down
10 changes: 7 additions & 3 deletions Swashbuckle.OData.Tests/WebHost/TestWebApiStartup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Web.Http;
using System;
using System.Web.Http;
using Owin;
using Swashbuckle.Application;
using SwashbuckleODataSample;
Expand All @@ -10,11 +11,12 @@ public class TestWebApiStartup
public const string BaseAddress = "http://localhost:8347/";

/// <summary>
/// This code configures Web API.
/// This code configures Web API.
/// The TestWebApiStartup class is specified as a type parameter in the WebApp.Start method.
/// </summary>
/// <param name="appBuilder">The application builder.</param>
public void Configuration(IAppBuilder appBuilder)
/// <param name="unitTestConfigs">Additional unit test configurations.</param>
public void Configuration(IAppBuilder appBuilder, Action<SwaggerDocsConfig> unitTestConfigs = null)
{
var httpConfiguration = new HttpConfiguration();

Expand All @@ -34,6 +36,8 @@ public void Configuration(IAppBuilder appBuilder)
// alternative implementation for ISwaggerProvider with the CustomProvider option.
//
c.CustomProvider(defaultProvider => new ODataSwaggerProvider(defaultProvider, c, () => httpConfiguration));
unitTestConfigs?.Invoke(c);
})
.EnableSwaggerUi();

Expand Down
3 changes: 2 additions & 1 deletion Swashbuckle.OData.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FF286327-C783-4F7A-AB73-9BCBAD0D4460}") = "Swashbuckle.OData.NuGet", "Swashbuckle.OData.Nuget\Swashbuckle.OData.NuGet.nuproj", "{5CD33FC5-9E4C-48E3-A69D-EF5F0BAC2162}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swashbuckle.OData", "Swashbuckle.OData\Swashbuckle.OData.csproj", "{AA7B6C37-092E-46EC-81A3-9865EFD646F1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EF4A9CB1-3309-4630-9980-10A5E11D4101}"
ProjectSection(SolutionItems) = preProject
License.txt = License.txt
README.md = README.md
EndProjectSection
EndProject
Expand Down
Loading

0 comments on commit 7163d50

Please sign in to comment.