mirror of
https://github.com/bitwarden/server.git
synced 2026-01-31 14:13:18 +08:00
Update Swashbuckle and improve generated OpenAPI files (#6066)
* Improve generated OpenAPI files * Nullable * Fmt * Correct powershell command * Fix name * Add some tests * Fmt * Switch to using json naming policy
This commit is contained in:
23
test/SharedWeb.Test/GitCommitDocumentFilterTest.cs
Normal file
23
test/SharedWeb.Test/GitCommitDocumentFilterTest.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Bit.SharedWeb.Swagger;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace SharedWeb.Test;
|
||||
|
||||
public class GitCommitDocumentFilterTest
|
||||
{
|
||||
[Fact]
|
||||
public void AddsGitCommitExtensionIfAvailable()
|
||||
{
|
||||
var doc = new OpenApiDocument();
|
||||
var context = new DocumentFilterContext(null, null, null);
|
||||
var filter = new GitCommitDocumentFilter();
|
||||
filter.Apply(doc, context);
|
||||
|
||||
Assert.True(doc.Extensions.ContainsKey("x-git-commit"));
|
||||
var ext = doc.Extensions["x-git-commit"] as Microsoft.OpenApi.Any.OpenApiString;
|
||||
Assert.NotNull(ext);
|
||||
Assert.False(string.IsNullOrEmpty(ext.Value));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user