diff --git a/samples/aspnetcore/BasicSample/BasicSample.csproj b/samples/aspnetcore/BasicSample/BasicSample.csproj index 04cc4e18..eac9a6b3 100644 --- a/samples/aspnetcore/BasicSample/BasicSample.csproj +++ b/samples/aspnetcore/BasicSample/BasicSample.csproj @@ -3,6 +3,7 @@ net5.0 Microsoft.Examples + default diff --git a/samples/aspnetcore/ByNamespaceSample/ByNamespaceSample.csproj b/samples/aspnetcore/ByNamespaceSample/ByNamespaceSample.csproj index 04cc4e18..eac9a6b3 100644 --- a/samples/aspnetcore/ByNamespaceSample/ByNamespaceSample.csproj +++ b/samples/aspnetcore/ByNamespaceSample/ByNamespaceSample.csproj @@ -3,6 +3,7 @@ net5.0 Microsoft.Examples + default diff --git a/samples/aspnetcore/ConventionsSample/ConventionsSample.csproj b/samples/aspnetcore/ConventionsSample/ConventionsSample.csproj index 0559b984..0dc46a41 100644 --- a/samples/aspnetcore/ConventionsSample/ConventionsSample.csproj +++ b/samples/aspnetcore/ConventionsSample/ConventionsSample.csproj @@ -3,6 +3,7 @@ net5.0 Microsoft.Examples + default diff --git a/samples/aspnetcore/SwaggerSample/SwaggerSample.csproj b/samples/aspnetcore/SwaggerSample/SwaggerSample.csproj index 94390b39..34b772cc 100644 --- a/samples/aspnetcore/SwaggerSample/SwaggerSample.csproj +++ b/samples/aspnetcore/SwaggerSample/SwaggerSample.csproj @@ -1,9 +1,10 @@  - net5.0 + netcoreapp3.1 Microsoft.Examples bin\$(Configuration)\$(TargetFramework)\$(MSBuildThisFileName).xml + default diff --git a/samples/aspnetcore/SwaggerSample/V1/Controllers/OrdersController.cs b/samples/aspnetcore/SwaggerSample/V1/Controllers/OrdersController.cs index de861e68..cce1c6a7 100644 --- a/samples/aspnetcore/SwaggerSample/V1/Controllers/OrdersController.cs +++ b/samples/aspnetcore/SwaggerSample/V1/Controllers/OrdersController.cs @@ -42,5 +42,26 @@ public IActionResult Post( [FromBody] Order order ) order.Id = 42; return CreatedAtAction( nameof( Get ), new { id = order.Id }, order ); } + + /// + /// Updates an existing order. + /// + /// The order to update. + /// The created order. + /// The order was successfully updated. + /// The order is invalid. + /// The order does not exist. + [MapToApiVersion( "1.0" )] + [HttpPatch("{id:int}")] + [Produces("application/json")] + [Consumes("application/merge-patch+json")] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(404)] + public IActionResult Patch(int id, [FromBody] Order order) + { + order.Id = 1; // if id=1 then it is returned from V1 OrdersController.cs + return CreatedAtAction(nameof(Get), new { id = order.Id }, order); + } } } \ No newline at end of file diff --git a/samples/aspnetcore/SwaggerSample/V2/Controllers/OrdersController.cs b/samples/aspnetcore/SwaggerSample/V2/Controllers/OrdersController.cs index df50e890..f43568d3 100644 --- a/samples/aspnetcore/SwaggerSample/V2/Controllers/OrdersController.cs +++ b/samples/aspnetcore/SwaggerSample/V2/Controllers/OrdersController.cs @@ -63,5 +63,25 @@ public IActionResult Post( [FromBody] Order order ) order.Id = 42; return CreatedAtAction( nameof( Get ), new { id = order.Id }, order ); } + + /// + /// Updates an existing order. + /// + /// The order to update. + /// The created order. + /// The order was successfully updated. + /// The order is invalid. + /// The order does not exist. + [HttpPatch( "{id:int}" )] + [Produces( "application/json" )] + [Consumes( "application/merge-patch+json" )] + [ProducesResponseType( 204 )] + [ProducesResponseType( 400 )] + [ProducesResponseType( 404 )] + public IActionResult Patch( int id, [FromBody] Order order ) + { + order.Id = 2; // if id=2 then it is returned from V2 OrdersController.cs + return CreatedAtAction( nameof( Get ), new { id = order.Id }, order ); + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.csproj b/src/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.csproj index 8f706c64..a3269e91 100644 --- a/src/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.csproj @@ -8,6 +8,7 @@ ASP.NET Core MVC API explorer functionality for discovering metadata such as the list of API-versioned controllers and actions, and their URLs and allowed HTTP methods. Microsoft.AspNetCore.Mvc.ApiExplorer Microsoft;AspNet;AspNetCore;Versioning;ApiExplorer + default diff --git a/src/Microsoft.AspNetCore.Mvc.Versioning/Microsoft.AspNetCore.Mvc.Versioning.csproj b/src/Microsoft.AspNetCore.Mvc.Versioning/Microsoft.AspNetCore.Mvc.Versioning.csproj index 67d4ae64..bfe295d9 100644 --- a/src/Microsoft.AspNetCore.Mvc.Versioning/Microsoft.AspNetCore.Mvc.Versioning.csproj +++ b/src/Microsoft.AspNetCore.Mvc.Versioning/Microsoft.AspNetCore.Mvc.Versioning.csproj @@ -8,6 +8,7 @@ A service API versioning library for Microsoft ASP.NET Core. Microsoft.AspNetCore.Mvc Microsoft;AspNet;AspNetCore;Versioning + default diff --git a/test/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests.csproj b/test/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests.csproj index f6838bb6..e63d8f5c 100644 --- a/test/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests/Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.Tests.csproj @@ -4,6 +4,7 @@ netcoreapp3.1;net5.0 Microsoft.AspNetCore.Mvc.ApiExplorer true + default diff --git a/test/Microsoft.AspNetCore.Mvc.Versioning.Tests/Microsoft.AspNetCore.Mvc.Versioning.Tests.csproj b/test/Microsoft.AspNetCore.Mvc.Versioning.Tests/Microsoft.AspNetCore.Mvc.Versioning.Tests.csproj index efba2320..7d3cdf33 100644 --- a/test/Microsoft.AspNetCore.Mvc.Versioning.Tests/Microsoft.AspNetCore.Mvc.Versioning.Tests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Versioning.Tests/Microsoft.AspNetCore.Mvc.Versioning.Tests.csproj @@ -4,6 +4,7 @@ netcoreapp3.1;net5.0 Microsoft.AspNetCore.Mvc true + default