Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
domaindrivendev committed Aug 21, 2017
1 parent 0996fa3 commit a6cb1b4
Show file tree
Hide file tree
Showing 15 changed files with 310 additions and 18 deletions.
9 changes: 9 additions & 0 deletions .nuget/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit.ConsoleRunner" version="3.7.0" />
<package id="NUnit.Extension.NUnitProjectLoader" version="3.5.0" />
<package id="NUnit.Extension.NUnitV2Driver" version="3.6.0" />
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.5.0" />
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" />
<package id="NUnit.Extension.VSProjectLoader" version="3.5.0" />
</packages>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Swashbuckle
=========

[![Build status](https://ci.appveyor.com/api/projects/status/qoesh4nm6tb6diuk?svg=true)](https://ci.appveyor.com/project/domaindrivendev/swashbuckle)

Seamlessly adds a [Swagger](http://swagger.io/) to WebApi projects! Combines ApiExplorer and Swagger/swagger-ui to provide a rich discovery, documentation and playground experience to your API consumers.

In addition to its Swagger generator, Swashbuckle also contains an embedded version of [swagger-ui](https://github.com/swagger-api/swagger-ui) which it will automatically serve up once Swashbuckle is installed. This means you can complement your API with a slick discovery UI to assist consumers with their integration efforts. Best of all, it requires minimal coding and maintenance, allowing you to focus on building an awesome API!
Expand Down
2 changes: 1 addition & 1 deletion Swashbuckle.Dummy.Core/App_Start/SwaggerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static void Register(HttpConfiguration httpConfig)

private static string GetXmlCommentsPath()
{
return String.Format(@"{0}\XmlComments.xml", AppDomain.CurrentDomain.BaseDirectory);
return String.Format(@"{0}\XmlComments.foo.xml", AppDomain.CurrentDomain.BaseDirectory);
}

public static bool ResolveVersionSupportByRouteConstraint(ApiDescription apiDesc, string targetApiVersion)
Expand Down
1 change: 0 additions & 1 deletion Swashbuckle.Tests/HttpMessageHandlerTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace Swashbuckle.Tests
{
[TestFixture]
public abstract class HttpMessageHandlerTestBase<THandler>
where THandler : HttpMessageHandler
{
Expand Down
4 changes: 2 additions & 2 deletions Swashbuckle.Tests/Swagger/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,12 @@ public void It_errors_on_unknown_api_version_and_returns_status_not_found()
}

[Test]
[ExpectedException(typeof(NotSupportedException))]
public void It_errors_on_multiple_actions_with_same_path_and_method()
{
SetUpDefaultRouteFor<ConflictingActionsController>();

var swagger = GetContent<JObject>("http://tempuri.org/swagger/docs/v1");
Assert.Throws<NotSupportedException>(
delegate { GetContent<JObject>("http://tempuri.org/swagger/docs/v1"); });
}
}
}
4 changes: 2 additions & 2 deletions Swashbuckle.Tests/Swagger/SchemaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,12 @@ public void It_handles_recursion_if_called_again_within_a_filter()
}

[Test]
[ExpectedException(typeof(InvalidOperationException))]
public void It_errors_on_multiple_types_with_the_same_class_name()
{
SetUpDefaultRouteFor<ConflictingTypesController>();

var swagger = GetContent<JObject>("http://tempuri.org/swagger/docs/v1");
Assert.Throws<InvalidOperationException>(
delegate { GetContent<JObject>("http://tempuri.org/swagger/docs/v1"); });
}

[Test]
Expand Down
1 change: 1 addition & 0 deletions Swashbuckle.Tests/Swagger/TypeExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Swashbuckle.Swagger
{
[TestFixture]
public class TypeExtensionsTests
{
[TestCase(typeof(DateTime), "DateTime")]
Expand Down
11 changes: 5 additions & 6 deletions Swashbuckle.Tests/SwaggerUi/SwaggerUiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,16 @@ public void It_exposes_config_for_apiKey_name_and_location()
StringAssert.Contains("apiKeyIn: 'header'", content);
}

[TestCase("http://tempuri.org/swagger/ui/images/logo_small-png", Result = "image/png")]
[TestCase("http://tempuri.org/swagger/ui/css/typography-css", Result = "text/css")]
public string It_returns_correct_asset_mime_type(string resourceUri)
[TestCase("http://tempuri.org/swagger/ui/images/logo_small-png", "image/png")]
[TestCase("http://tempuri.org/swagger/ui/css/typography-css", "text/css")]
public void It_returns_correct_asset_mime_type(string resourceUri, string expectedMimeType)
{
var response = Get(resourceUri);

System.Diagnostics.Debug.WriteLine(string.Format("[{0}] {1} => {2}", response.StatusCode, resourceUri, response.Content.Headers.ContentType.MediaType));

Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);

return response.Content.Headers.ContentType.MediaType;
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
Assert.AreEqual(expectedMimeType, response.Content.Headers.ContentType.MediaType);
}

private void SetUpHandler(Action<SwaggerUiConfig> configure = null)
Expand Down
9 changes: 6 additions & 3 deletions Swashbuckle.Tests/Swashbuckle.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
Expand Down Expand Up @@ -108,7 +109,9 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Swashbuckle.Core\Swashbuckle.Core.csproj">
Expand Down
3 changes: 2 additions & 1 deletion Swashbuckle.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<package id="Microsoft.Owin.Testing" version="3.0.1" targetFramework="net45" />
<package id="Moq" version="4.0.10827" targetFramework="net4" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="NUnit" version="2.6.2" targetFramework="net4" />
<package id="NUnit" version="3.7.1" targetFramework="net45" />
<package id="NUnit.ConsoleRunner" version="3.7.0" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
</packages>
12 changes: 10 additions & 2 deletions Swashbuckle.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "swagger-ui", "http://localhost:55139", "{DDE07B02-DD45-4ABF-96D3-A4FBB144BBA1}"
ProjectSection(WebsiteProperties) = preProject
Expand Down Expand Up @@ -47,9 +47,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Swashbuckle.Dummy.SelfHost"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C63363AF-2303-4489-8287-95D94C414663}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ci", "ci", "{93EE20BB-2BE6-42DD-A221-8BF45CA3A93E}"
ProjectSection(SolutionItems) = preProject
ci\build.ps1 = ci\build.ps1
ci\test.ps1 = ci\test.ps1
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -92,5 +99,6 @@ Global
{E51BDA79-1942-490E-A1D4-E37235736D8A} = {6A2C69FA-6824-44F3-A1A5-1313050FA567}
{2DFE3931-747F-48C6-8530-B74710988095} = {6A2C69FA-6824-44F3-A1A5-1313050FA567}
{2D1F2F73-5828-413C-9FD0-6F81A964C82D} = {6A2C69FA-6824-44F3-A1A5-1313050FA567}
{93EE20BB-2BE6-42DD-A221-8BF45CA3A93E} = {C63363AF-2303-4489-8287-95D94C414663}
EndGlobalSection
EndGlobal
Loading

0 comments on commit a6cb1b4

Please sign in to comment.