-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into release/v0-12-0
- Loading branch information
Showing
26 changed files
with
186 additions
and
22 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
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
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
2 changes: 1 addition & 1 deletion
2
src/recipe/Baked.Recipe.Service.Application/Business/BusinessConfigurator.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,3 +1,3 @@ | ||
namespace Baked.Business; | ||
|
||
public class BusinessConfigurator { } | ||
public class BusinessConfigurator; |
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
2 changes: 1 addition & 1 deletion
2
src/recipe/Baked.Recipe.Service.Application/Business/CasterAttribute.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,4 +1,4 @@ | ||
namespace Baked.Business; | ||
|
||
[AttributeUsage(AttributeTargets.Class)] | ||
public class CasterAttribute : Attribute { } | ||
public class CasterAttribute : Attribute; |
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
2 changes: 1 addition & 1 deletion
2
src/recipe/Baked.Recipe.Service.Application/Business/ExternalAttribute.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,4 +1,4 @@ | ||
namespace Baked.Business; | ||
|
||
[AttributeUsage(AttributeTargets.Method)] | ||
public class ExternalAttribute : Attribute { } | ||
public class ExternalAttribute : Attribute; |
2 changes: 1 addition & 1 deletion
2
src/recipe/Baked.Recipe.Service.Application/Business/LocatableAttribute.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,4 +1,4 @@ | ||
namespace Baked.Business; | ||
|
||
[AttributeUsage(AttributeTargets.Class)] | ||
public class LocatableAttribute : Attribute { } | ||
public class LocatableAttribute : Attribute; |
8 changes: 8 additions & 0 deletions
8
src/recipe/Baked.Recipe.Service.Application/Business/NamespaceAttribute.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,8 @@ | ||
namespace Baked.Business; | ||
|
||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] | ||
public class NamespaceAttribute(string value) | ||
: Attribute | ||
{ | ||
public string Value { get; } = value; | ||
} |
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
10 changes: 10 additions & 0 deletions
10
...Service.Application/CodingStyle/NamespaceAsRoute/NamespaceAsRouteCodingStyleExtensions.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,10 @@ | ||
using Baked.CodingStyle; | ||
using Baked.CodingStyle.NamespaceAsRoute; | ||
|
||
namespace Baked; | ||
|
||
public static class NamespaceAsRouteCodingStyleExtensions | ||
{ | ||
public static NamespaceAsRouteCodingStyleFeature NamespaceAsRoute(this CodingStyleConfigurator _) => | ||
new(); | ||
} |
14 changes: 14 additions & 0 deletions
14
...pe.Service.Application/CodingStyle/NamespaceAsRoute/NamespaceAsRouteCodingStyleFeature.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,14 @@ | ||
using Baked.Architecture; | ||
|
||
namespace Baked.CodingStyle.NamespaceAsRoute; | ||
|
||
public class NamespaceAsRouteCodingStyleFeature : IFeature<CodingStyleConfigurator> | ||
{ | ||
public void Configure(LayerConfigurator configurator) | ||
{ | ||
configurator.ConfigureApiModelConventions(conventions => | ||
{ | ||
conventions.Add(new UseNamespaceForBaseRouteConvention(), order: int.MaxValue - 10); | ||
}); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...pe.Service.Application/CodingStyle/NamespaceAsRoute/UseNamespaceForBaseRouteConvention.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,20 @@ | ||
using Baked.RestApi.Configuration; | ||
|
||
namespace Baked.CodingStyle.NamespaceAsRoute; | ||
|
||
public class UseNamespaceForBaseRouteConvention | ||
: IApiModelConvention<ActionModelContext> | ||
{ | ||
public void Apply(ActionModelContext context) | ||
{ | ||
if (!context.Controller.MappedType.TryGetNamespace(out var @namespace)) { return; } | ||
|
||
var baseRoute = @namespace.Split("."); | ||
|
||
context.Action.RouteParts.InsertRange(0, baseRoute); | ||
foreach (var routeParameter in context.Action.Parameters.Where(pm => pm.FromRoute)) | ||
{ | ||
routeParameter.RoutePosition += baseRoute.Length; | ||
} | ||
} | ||
} |
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
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
14 changes: 14 additions & 0 deletions
14
test/recipe/Baked.Test.Recipe.Service.Test/CodingStyle/RoutingByNamespace.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,14 @@ | ||
using System.Net; | ||
|
||
namespace Baked.Test.CodingStyle; | ||
|
||
public class RoutingByNamespace : TestServiceNfr | ||
{ | ||
[TestCase("Post", "coding-style/namespace-as-route/route-sample/method")] | ||
public async Task Namespace_is_used_as_base_route_for_the_methods_under_certain_namespace(string method, string action) | ||
{ | ||
var response = await Client.SendAsync(new(HttpMethod.Parse(method), $"/{action}")); | ||
|
||
response.StatusCode.ShouldNotBe(HttpStatusCode.NotFound); | ||
} | ||
} |
Oops, something went wrong.