Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ However, this name can be overridden using `[assembly: ImmediateAssemblyIdentifi
### Customizing the endpoints
#### AsParameters

By default on POST and PUT requests Immediate.Apis will assume that your request class should be treated as a `[FromBody]`. Sometimes, however, this is not desired. For example imagine a PUT request that sits at a route `/api/todos/{id}` and updates a TODO with a given ID. We would want to get the `id` from the route and the properties to update from the body. To do so, we need to create the following request command class:
By default on POST, PUT, and PATCH requests Immediate.Apis will assume that your request class should be treated as a `[FromBody]`. Sometimes, however, this is not desired. For example imagine a PUT request that sits at a route `/api/todos/{id}` and updates a TODO with a given ID. We would want to get the `id` from the route and the properties to update from the body. To do so, we need to create the following request command class:

```cs
public sealed record Command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public sealed class CustomizeGroupUsageAnalyzer : DiagnosticAnalyzer
new(
id: DiagnosticIds.IAPI0011CustomizeGroupInvalid,
title: "`CustomizeGroup` requires a specific definition",
messageFormat: "`CustomizeGroup` must be `private static void CustomizeEndpoint(RouteGroupBuilder group)`",
messageFormat: "`CustomizeGroup` must be `private static void CustomizeGroup(RouteGroupBuilder group)`",
category: "ImmediateApis",
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true,
Expand Down
1 change: 0 additions & 1 deletion src/Immediate.Apis.Analyzers/DiagnosticIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ internal static class DiagnosticIds
public const string IAPI0007MissingTransformResultMethod = "IAPI0007";
public const string IAPI0008HandlerShouldNotDependOnEndpoint = "IAPI0008";
public const string IAPI0009EndpointHasBeenSpecifiedMultipleTimes = "IAPI0009";
public const string IAPI0010InvalidRouteGroupName = "IAPI0010";
public const string IAPI0011CustomizeGroupInvalid = "IAPI0011";
public const string IAPI0012MissingCustomizeGroupMethod = "IAPI0012";
public const string IAPI0013InvalidMapGroupTarget = "IAPI0013";
Expand Down
17 changes: 0 additions & 17 deletions tests/Immediate.Apis.Tests/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,6 @@ public static TheoryData<string> Methods() =>
"Delete",
];

public static TheoryData<string> ValidRouteGroupNames =>
[
"_TestGroup",
"Test_Group",
"Test123Group",
"123TestGroup",
];

public static TheoryData<string> InvalidRouteGroupNames =>
[
"",
"Test.Group",
"Test Group",
"Test@Group",
"Test#Group",
];

public static SettingsTask VerifyIgnoreImmediateHandlers(GeneratorDriverRunResult result, [CallerFilePath] string sourceFile = "") =>
Verify(result, sourceFile: sourceFile)
.IgnoreGeneratedResult(gsr => ImmediateHandlersHintName().IsMatch(Path.GetFileName(gsr.HintName)))
Expand Down