Skip to content

Commit

Permalink
Update API references and build configurations
Browse files Browse the repository at this point in the history
Several updates have been made in this commit. Argument string defaults have been set for both 'nuget_api_key' and 'github_token' in build.cake. A configuration for 'Release' has been added in 'build-deploy.yml'. Also, the key 'application/json-patch+json' has been replaced with the constant 'MediaTypeNames.Application.JsonPatch' in JsonPatchDocumentFilter.cs across multiple solutions.
  • Loading branch information
Gary Woodfine committed Jan 16, 2024
1 parent 0053d7f commit 1e6b115
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ jobs:
arguments: |
nuget_api_key: ${{ secrets.NUGET_API_KEY }}
github_token: ${{ github.token }}
configuration: Release
7 changes: 2 additions & 5 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var nuget_api_key = Argument<string>("nuget_api_key");
var github_token = Argument<string>("github_token");
var nuget_api_key = Argument<string>("nuget_api_key" , "");
var github_token = Argument<string>("github_token", "");

string version = String.Empty;
//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -121,9 +121,6 @@ Task("PublishNuget")
}
}
});



//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 4 additions & 3 deletions src/Solution-MSSQL/src/Api/Helpers/JsonPatchDocumentFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.OpenApi.Models;
using System.Net.Mime;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;

public class JsonPatchDocumentFilter : IDocumentFilter
Expand Down Expand Up @@ -33,10 +34,10 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
foreach (var path in swaggerDoc.Paths.SelectMany(p => p.Value.Operations)
.Where(p => p.Key == Microsoft.OpenApi.Models.OperationType.Patch))
{
foreach (var item in path.Value.RequestBody.Content.Where(c => c.Key != "application/json-patch+json"))
foreach (var item in path.Value.RequestBody.Content.Where(c => c.Key != MediaTypeNames.Application.JsonPatch))
path.Value.RequestBody.Content.Remove(item.Key);

var response = path.Value.RequestBody.Content.SingleOrDefault(c => c.Key == "application/json-patch+json");
var response = path.Value.RequestBody.Content.SingleOrDefault(c => c.Key == MediaTypeNames.Application.JsonPatch);

response.Value.Schema = new OpenApiSchema
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.OpenApi.Models;
using System.Net.Mime;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;

public class JsonPatchDocumentFilter : IDocumentFilter
Expand Down Expand Up @@ -33,10 +34,10 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
foreach (var path in swaggerDoc.Paths.SelectMany(p => p.Value.Operations)
.Where(p => p.Key == Microsoft.OpenApi.Models.OperationType.Patch))
{
foreach (var item in path.Value.RequestBody.Content.Where(c => c.Key != "application/json-patch+json"))
foreach (var item in path.Value.RequestBody.Content.Where(c => c.Key != MediaTypeNames.Application.JsonPatch))
path.Value.RequestBody.Content.Remove(item.Key);

var response = path.Value.RequestBody.Content.SingleOrDefault(c => c.Key == "application/json-patch+json");
var response = path.Value.RequestBody.Content.SingleOrDefault(c => c.Key == MediaTypeNames.Application.JsonPatch);

response.Value.Schema = new OpenApiSchema
{
Expand Down
7 changes: 4 additions & 3 deletions src/Solution/src/Api/Helpers/JsonPatchDocumentFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.OpenApi.Models;
using System.Net.Mime;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;

public class JsonPatchDocumentFilter : IDocumentFilter
Expand Down Expand Up @@ -33,10 +34,10 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
foreach (var path in swaggerDoc.Paths.SelectMany(p => p.Value.Operations)
.Where(p => p.Key == Microsoft.OpenApi.Models.OperationType.Patch))
{
foreach (var item in path.Value.RequestBody.Content.Where(c => c.Key != "application/json-patch+json"))
foreach (var item in path.Value.RequestBody.Content.Where(c => c.Key != MediaTypeNames.Application.JsonPatch))
path.Value.RequestBody.Content.Remove(item.Key);

var response = path.Value.RequestBody.Content.SingleOrDefault(c => c.Key == "application/json-patch+json");
var response = path.Value.RequestBody.Content.SingleOrDefault(c => c.Key == MediaTypeNames.Application.JsonPatch);

response.Value.Schema = new OpenApiSchema
{
Expand Down

0 comments on commit 1e6b115

Please sign in to comment.