-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c952f9
commit f0c2bf5
Showing
20 changed files
with
434 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md | ||
!**/.gitignore | ||
!.git/HEAD | ||
!.git/config | ||
!.git/packed-refs | ||
!.git/refs/heads/** |
242 changes: 168 additions & 74 deletions
242
src/Saunter/AttributeProvider/AttributeDocumentProvider.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using LEGO.AsyncAPI.Models; | ||
using Saunter.Options.Filters; | ||
|
||
public interface IOperationFilter | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
using System.Reflection; | ||
using Saunter.AttributeProvider.Attributes; | ||
|
||
public class OperationFilterContext | ||
namespace Saunter.Options.Filters | ||
{ | ||
public OperationFilterContext(MethodInfo method, OperationAttribute operation) | ||
public class OperationFilterContext | ||
{ | ||
Method = method; | ||
Operation = operation; | ||
} | ||
public OperationFilterContext(MethodInfo method, OperationAttribute operation) | ||
{ | ||
Method = method; | ||
Operation = operation; | ||
} | ||
|
||
public MethodInfo Method { get; } | ||
public MethodInfo Method { get; } | ||
|
||
public OperationAttribute Operation { get; } | ||
public OperationAttribute Operation { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/Saunter/SharedKernel/Interfaces/IAsyncApiSchemaGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using LEGO.AsyncAPI.Models; | ||
|
||
namespace Saunter.SharedKernel.Interfaces | ||
{ | ||
public interface IAsyncApiSchemaGenerator | ||
{ | ||
AsyncApiSchema? Generate(Type? type); | ||
GeneratedSchemas? Generate(Type? type); | ||
} | ||
|
||
public readonly record struct GeneratedSchemas(AsyncApiSchema Root, IReadOnlyCollection<AsyncApiSchema> All); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 | ||
# Run "dotnet publish -c Release" before building this image | ||
COPY bin/Release/net6.0/publish/ App/ | ||
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | ||
WORKDIR /app | ||
EXPOSE 80 | ||
EXPOSE 443 | ||
|
||
WORKDIR /App | ||
EXPOSE 5000 | ||
ENTRYPOINT ["dotnet", "Saunter.IntegrationTests.ReverseProxy.dll"] | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | ||
ARG BUILD_CONFIGURATION=Release | ||
WORKDIR /src | ||
COPY ["test/Saunter.IntegrationTests.ReverseProxy/Saunter.IntegrationTests.ReverseProxy.csproj", "test/Saunter.IntegrationTests.ReverseProxy/"] | ||
COPY ["src/Saunter/Saunter.csproj", "src/Saunter/"] | ||
RUN dotnet restore "./test/Saunter.IntegrationTests.ReverseProxy/Saunter.IntegrationTests.ReverseProxy.csproj" | ||
COPY . . | ||
WORKDIR "/src/test/Saunter.IntegrationTests.ReverseProxy" | ||
RUN dotnet build "./Saunter.IntegrationTests.ReverseProxy.csproj" -c $BUILD_CONFIGURATION -o /app/build | ||
|
||
FROM build AS publish | ||
ARG BUILD_CONFIGURATION=Release | ||
RUN dotnet publish "./Saunter.IntegrationTests.ReverseProxy.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
ENTRYPOINT ["dotnet", "Saunter.IntegrationTests.ReverseProxy.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
test/Saunter.IntegrationTests.ReverseProxy/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/Saunter.Tests/AttributeProvider/DocumentGenerationTests/AssertAsyncApiDocumentHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using LEGO.AsyncAPI.Models; | ||
using Shouldly; | ||
|
||
namespace Saunter.Tests.AttributeProvider.DocumentGenerationTests | ||
{ | ||
internal static class AssertAsyncApiDocumentHelper | ||
{ | ||
public static AsyncApiChannel AssertAndGetChannel(this AsyncApiDocument document, string key, string description) | ||
{ | ||
document.Channels.Count.ShouldBe(1); | ||
document.Channels.ShouldContainKey(key); | ||
|
||
var channel = document.Channels[key]; | ||
channel.ShouldNotBeNull(); | ||
channel.Description.ShouldBe(description); | ||
|
||
return channel; | ||
} | ||
|
||
public static void AssertByMessage(this AsyncApiDocument document, AsyncApiOperation operation, params string[] messageIds) | ||
{ | ||
operation.Message.Count.ShouldBe(messageIds.Length); | ||
operation.Message.ShouldAllBe(c => c.Reference.Type == ReferenceType.Message); | ||
|
||
foreach (var messageId in messageIds) | ||
{ | ||
operation.Message.ShouldContain(m => m.Reference.Id == messageId); | ||
document.Components.Messages.ShouldContainKey(messageId); | ||
|
||
var message = document.Components.Messages[messageId]; | ||
document.Components.Schemas.ContainsKey(message.Payload.Reference.Id); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.