Skip to content

Commit

Permalink
release library (#1)
Browse files Browse the repository at this point in the history
* release library
  • Loading branch information
ZEXSM authored Aug 14, 2022
1 parent 7d06348 commit 3dd5aaa
Show file tree
Hide file tree
Showing 53 changed files with 2,176 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"minicover": {
"version": "3.4.1",
"commands": [
"minicover"
]
}
}
}
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: csharp
dotnet: 3.1
dotnet: 5.0
mono: none
solution: Swagger.Documentation.sln
branches:
Expand All @@ -9,11 +9,15 @@ before_script:
- dotnet restore
script:
- dotnet build
- dotnet test ./test/Swagger.Documentation.Test -c $CONFIGURATION -f netcoreapp3.1
- dotnet test ./test/Swagger.Documentation.ExceptionTest -c $CONFIGURATION -f net5.0
- dotnet test ./test/Swagger.Documentation.VersionTest -c $CONFIGURATION -f net5.0
- dotnet test ./test/Swagger.Documentation.Test -c $CONFIGURATION -f net5.0
after_success:
- dotnet minicover instrument
- dotnet minicover reset
- dotnet test --no-build ./test/Swagger.Documentation.Test -c $CONFIGURATION -f netcoreapp3.1
- dotnet test --no-build ./test/Swagger.Documentation.ExceptionTest -c $CONFIGURATION -f net5.0
- dotnet test --no-build ./test/Swagger.Documentation.VersionTest -c $CONFIGURATION -f net5.0
- dotnet test --no-build ./test/Swagger.Documentation.Test -c $CONFIGURATION -f net5.0
- dotnet minicover uninstrument
- dotnet minicover report
- dotnet minicover coverallsreport --output "coveralls.json" --service-name "travis-ci" --service-job-id $TRAVIS_JOB_ID
Expand Down
84 changes: 84 additions & 0 deletions Swagger.Documentation.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F8025343-BDFB-429E-A143-E73A09C51B50}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{722A9F3A-65E6-4D71-95EA-4D242B78E107}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swagger.Documentation", "src\Swagger.Documentation\Swagger.Documentation.csproj", "{6FC96219-71A2-4755-8671-E9D6C8E1CDD7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swagger.Documentation.Test", "test\Swagger.Documentation.Test\Swagger.Documentation.Test.csproj", "{1DD26821-68C9-4B01-9E57-CCEB54B2397F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "items", "items", "{DE00FEDE-BC74-4876-8F2E-EC7D26EBE602}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
.travis.yml = .travis.yml
example.png = example.png
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{FF4F3CAA-5EF4-42DD-AC2C-8732D74DBD0F}"
ProjectSection(SolutionItems) = preProject
.config\dotnet-tools.json = .config\dotnet-tools.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{12156B4A-40FB-4D1D-AD75-E507CB2AE558}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleSwaggerDocumentation", "samples\SampleSwaggerDocumentation\SampleSwaggerDocumentation.csproj", "{030EF24D-1150-451C-B0F3-816BC8CA2AB3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleSwaggerDocumentationVersion", "samples\SampleSwaggerDocumentationVersion\SampleSwaggerDocumentationVersion.csproj", "{AAD9BB32-C674-4741-977D-CBC3B35651CC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swagger.Documentation.VersionTest", "test\Swagger.Documentation.VersionTest\Swagger.Documentation.VersionTest.csproj", "{C292E5E4-E56A-4366-BDCF-C9D8C1B9F8C4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swagger.Documentation.ExceptionTest", "test\Swagger.Documentation.ExceptionTest\Swagger.Documentation.ExceptionTest.csproj", "{7008C0AB-95DB-43FC-90B6-8D766E4B007D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6FC96219-71A2-4755-8671-E9D6C8E1CDD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6FC96219-71A2-4755-8671-E9D6C8E1CDD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FC96219-71A2-4755-8671-E9D6C8E1CDD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FC96219-71A2-4755-8671-E9D6C8E1CDD7}.Release|Any CPU.Build.0 = Release|Any CPU
{1DD26821-68C9-4B01-9E57-CCEB54B2397F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DD26821-68C9-4B01-9E57-CCEB54B2397F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DD26821-68C9-4B01-9E57-CCEB54B2397F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DD26821-68C9-4B01-9E57-CCEB54B2397F}.Release|Any CPU.Build.0 = Release|Any CPU
{030EF24D-1150-451C-B0F3-816BC8CA2AB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{030EF24D-1150-451C-B0F3-816BC8CA2AB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{030EF24D-1150-451C-B0F3-816BC8CA2AB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{030EF24D-1150-451C-B0F3-816BC8CA2AB3}.Release|Any CPU.Build.0 = Release|Any CPU
{AAD9BB32-C674-4741-977D-CBC3B35651CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAD9BB32-C674-4741-977D-CBC3B35651CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAD9BB32-C674-4741-977D-CBC3B35651CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAD9BB32-C674-4741-977D-CBC3B35651CC}.Release|Any CPU.Build.0 = Release|Any CPU
{C292E5E4-E56A-4366-BDCF-C9D8C1B9F8C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C292E5E4-E56A-4366-BDCF-C9D8C1B9F8C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C292E5E4-E56A-4366-BDCF-C9D8C1B9F8C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C292E5E4-E56A-4366-BDCF-C9D8C1B9F8C4}.Release|Any CPU.Build.0 = Release|Any CPU
{7008C0AB-95DB-43FC-90B6-8D766E4B007D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7008C0AB-95DB-43FC-90B6-8D766E4B007D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7008C0AB-95DB-43FC-90B6-8D766E4B007D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7008C0AB-95DB-43FC-90B6-8D766E4B007D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{6FC96219-71A2-4755-8671-E9D6C8E1CDD7} = {F8025343-BDFB-429E-A143-E73A09C51B50}
{1DD26821-68C9-4B01-9E57-CCEB54B2397F} = {722A9F3A-65E6-4D71-95EA-4D242B78E107}
{FF4F3CAA-5EF4-42DD-AC2C-8732D74DBD0F} = {DE00FEDE-BC74-4876-8F2E-EC7D26EBE602}
{030EF24D-1150-451C-B0F3-816BC8CA2AB3} = {12156B4A-40FB-4D1D-AD75-E507CB2AE558}
{AAD9BB32-C674-4741-977D-CBC3B35651CC} = {12156B4A-40FB-4D1D-AD75-E507CB2AE558}
{C292E5E4-E56A-4366-BDCF-C9D8C1B9F8C4} = {722A9F3A-65E6-4D71-95EA-4D242B78E107}
{7008C0AB-95DB-43FC-90B6-8D766E4B007D} = {722A9F3A-65E6-4D71-95EA-4D242B78E107}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {267B9DBE-00E4-4AED-8E9B-9A8CDFC062AB}
EndGlobalSection
EndGlobal
Binary file added example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@startuml
autonumber "<b>[00]"
Participant "this service" as S
Participant "integration-service" as IS #f0f0f0

S [#red]-> IS
S <--[#red] IS
@enduml
12 changes: 12 additions & 0 deletions samples/SampleSwaggerDocumentation/ApiDocs/WeatherForecast/Get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<details>
<summary>Details</summary>

## Note

## Schema

![Sequence diagram](Diagrams/main.svg)

## Algorithm

</details>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SampleSwaggerDocumentation.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

private readonly ILogger<WeatherForecastController> _logger;

public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}

[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}
20 changes: 20 additions & 0 deletions samples/SampleSwaggerDocumentation/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace SampleSwaggerDocumentation
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
31 changes: 31 additions & 0 deletions samples/SampleSwaggerDocumentation/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64156",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"SampleSwaggerDocumentation": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Swagger.Documentation\Swagger.Documentation.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="ApiDocs\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
70 changes: 70 additions & 0 deletions samples/SampleSwaggerDocumentation/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using Swagger.Documentation;
using System;

namespace SampleSwaggerDocumentation
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{

services.AddControllers();
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "ToDo API",
Description = "An ASP.NET Core Web API for managing ToDo items",
TermsOfService = new Uri("https://example.com/terms"),
Contact = new OpenApiContact
{
Name = "Example Contact",
Url = new Uri("https://example.com/contact")
},
License = new OpenApiLicense
{
Name = "Example License",
Url = new Uri("https://example.com/license")
}
});
options.OperationFilter<WriteMarkdownToDescriptionOperationFilter>();
});
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseSwagger();
app.UseSwaggerUISupportMarkdown();

app.UseRouting();

app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
15 changes: 15 additions & 0 deletions samples/SampleSwaggerDocumentation/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace SampleSwaggerDocumentation
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string Summary { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
10 changes: 10 additions & 0 deletions samples/SampleSwaggerDocumentation/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Loading

0 comments on commit 3dd5aaa

Please sign in to comment.