-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
17 changed files
with
77 additions
and
57 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
src/Tochka.JsonRpc.OpenRpc/Services/JsonSchemaBuilderExtensions.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,16 @@ | ||
using Json.Schema; | ||
|
||
namespace Tochka.JsonRpc.OpenRpc.Services; | ||
|
||
internal static class JsonSchemaBuilderExtensions | ||
{ | ||
public static JsonSchemaBuilder TryAppendTitle(this JsonSchemaBuilder builder, string? propertySummary) | ||
{ | ||
if (propertySummary is { Length: > 0 }) | ||
{ | ||
builder.Title(propertySummary); | ||
} | ||
|
||
return builder; | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/tests/Tochka.JsonRpc.ApiExplorer.Tests/ClassWithEmptyConstructor.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,7 @@ | ||
namespace Tochka.JsonRpc.ApiExplorer.Tests; | ||
|
||
public record ClassWithEmptyConstructor | ||
{ | ||
public string A { get; init; } | ||
public object B { get; init; } | ||
} |
3 changes: 3 additions & 0 deletions
3
src/tests/Tochka.JsonRpc.ApiExplorer.Tests/ClassWithoutEmptyConstructor.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,3 @@ | ||
namespace Tochka.JsonRpc.ApiExplorer.Tests; | ||
|
||
public record ClassWithoutEmptyConstructor(string A, object B); |
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,3 @@ | ||
namespace Tochka.JsonRpc.ApiExplorer.Tests; | ||
|
||
internal sealed record NonPublicClass; |
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,3 @@ | ||
namespace Tochka.JsonRpc.ApiExplorer.Tests; | ||
|
||
public sealed record SealedClass; |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Tochka.JsonRpc.TestUtils; | ||
|
||
public enum TestEnum | ||
{ | ||
One, | ||
Two, | ||
ThreeFour | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/tests/Tochka.JsonRpc.Tests.WebApplication/Controllers/ModelValidator.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,12 @@ | ||
using FluentValidation; | ||
using JetBrains.Annotations; | ||
|
||
namespace Tochka.JsonRpc.Tests.WebApplication.Controllers; | ||
|
||
[UsedImplicitly] | ||
public class ModelValidator : AbstractValidator<ValidationModel> | ||
{ | ||
public ModelValidator() => RuleFor(static m => m.Str).NotEmpty().WithMessage(Error); | ||
|
||
internal const string Error = "Str is empty"; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/tests/Tochka.JsonRpc.Tests.WebApplication/Controllers/StringValidator.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,12 @@ | ||
using FluentValidation; | ||
using JetBrains.Annotations; | ||
|
||
namespace Tochka.JsonRpc.Tests.WebApplication.Controllers; | ||
|
||
[UsedImplicitly] | ||
public class StringValidator : AbstractValidator<string> | ||
{ | ||
public StringValidator() => RuleFor(static x => x).MinimumLength(3).WithMessage(Error); | ||
|
||
internal const string Error = "Str is too short"; | ||
} |
6 changes: 6 additions & 0 deletions
6
src/tests/Tochka.JsonRpc.Tests.WebApplication/Controllers/TestObject.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,6 @@ | ||
namespace Tochka.JsonRpc.Tests.WebApplication.Controllers; | ||
|
||
public class TestObject | ||
{ | ||
public TimeSpan Ts { get; set; } = DateTime.Now.TimeOfDay; | ||
} |
3 changes: 3 additions & 0 deletions
3
src/tests/Tochka.JsonRpc.Tests.WebApplication/Controllers/ValidationModel.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,3 @@ | ||
namespace Tochka.JsonRpc.Tests.WebApplication.Controllers; | ||
|
||
public record ValidationModel(string? Str); |