From ba0702d06e02301353a964e60aff8b0837a75cb4 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Thu, 28 Nov 2024 22:59:27 -0500 Subject: [PATCH] well things work now, lets see how ci goes --- .github/workflows/ci.yml | 14 +- .../Pages/Rockets/Delete.razor.cs | 4 +- .../Pages/Rockets/Edit.razor.cs | 4 +- .../Pages/Rockets/View.razor.cs | 2 +- .../LaunchRecords/DeleteLaunchRecord.cs | 11 +- .../LaunchRecords/GetLaunchRecord.cs | 11 +- .../Operations/Rockets/DeleteRocket.cs | 11 +- .../Operations/Rockets/GetRocket.cs | 11 +- sample/Sample.Minimal/CustomHostedService.cs | 11 + .../CustomHostedServiceOptions.cs | 15 + .../Sample.Minimal/LaunchRecordEndpoints.cs | 69 + sample/Sample.Minimal/Program.cs | 90 +- sample/Sample.Minimal/RocketEndpoints.cs | 58 + .../Pages/Rockets/Delete.cshtml.cs | 2 +- .../Sample.Pages/Pages/Rockets/View.cshtml.cs | 2 +- .../Sample.Restful.Client.csproj | 4 +- .../BetweenPropertyRule.cs | 27 + .../ComparisonPropertyRule.cs | 47 + .../Constants.cs | 8 + .../EmailPropertyRule.cs | 14 + .../Extensions.cs | 6 + ...luentValidationOpenApiSchemaTransformer.cs | 44 + .../IPropertyRuleHandler.cs | 7 + .../LengthPropertyRule.cs | 30 + .../NotEmptyPropertyRule.cs | 15 + .../OpenApiValidationContext.cs | 17 + .../RegularExpressionPropertyRule.cs | 26 + .../RequiredPropertyRuleHandler.cs | 14 + .../ServiceCollectionExtensions.cs | 28 + .../Start.cs | 253 --- .../OpenApi/StronglyTypedIdSchemaFilter.cs | 3 +- .../ClassicFoundationTests.cs | 2 +- ...ndationTests.OpenApiDocument.verified.json | 1849 ++++++++++++++++ ...undationTests.OpenApiDocument.verified.txt | 1906 ----------------- .../LaunchRecords/GetLaunchRecordTests.cs | 4 +- .../LaunchRecords/RemoveLaunchRecordsTests.cs | 4 +- .../Rockets/GetRocketTests.cs | 4 +- .../Rockets/RemoveRocketsTests.cs | 2 +- ...dationTests.GraphqlSchema.verified.graphql | 4 +- ...sts.Should_Roundtrip_Duration.verified.txt | 10 +- ...Geometry_LINESTRING(5 6, 7 8).verified.txt | 10 +- ...9 20, 21 22), (23 24, 25 26)).verified.txt | 10 +- ..._MULTIPOINT((15 16), (17 18)).verified.txt | 10 +- ...33 34, 35 36, 37 38, 33 34))).verified.txt | 10 +- ...Roundtrip_Geometry_POINT(3 4).verified.txt | 10 +- ...N((9 10, 11 12, 13 14, 9 10)).verified.txt | 10 +- ...ests.Should_Roundtrip_Instant.verified.txt | 10 +- ...Should_Roundtrip_IsoDayOfWeek.verified.txt | 10 +- ...ts.Should_Roundtrip_LocalDate.verified.txt | 10 +- ...hould_Roundtrip_LocalDateTime.verified.txt | 10 +- ...ts.Should_Roundtrip_LocalTime.verified.txt | 10 +- ...Tests.Should_Roundtrip_Offset.verified.txt | 10 +- ...ould_Roundtrip_OffsetDateTime.verified.txt | 10 +- ...s.Should_Roundtrip_OffsetTime.verified.txt | 10 +- ...Tests.Should_Roundtrip_Period.verified.txt | 10 +- .../ApiDescriptionData.cs | 2 +- test/Sample.Minimal.Tests/FoundationTests.cs | 4 +- .../Helpers/SqliteExtension.cs | 2 +- .../Helpers/TestWebAppFixture.cs | 2 +- .../Helpers/WebAppFixtureTest.cs | 5 +- .../Sample.Minimal.Tests/ModuleInitializer.cs | 2 +- .../RestfulConventionTests.cs | 39 - .../Sample.Minimal.Tests.csproj | 2 +- .../SqliteConnectionService.cs | 2 +- ...ndationTests.OpenApiDocument.verified.json | 775 +++++++ ...undationTests.OpenApiDocument.verified.txt | 1791 ---------------- test/Sample.Restful.Tests/FoundationTests.cs | 2 +- ...ndationTests.OpenApiDocument.verified.json | 1734 +++++++++++++++ ...undationTests.OpenApiDocument.verified.txt | 1791 ---------------- 69 files changed, 4856 insertions(+), 6090 deletions(-) create mode 100644 sample/Sample.Minimal/CustomHostedService.cs create mode 100644 sample/Sample.Minimal/CustomHostedServiceOptions.cs create mode 100644 sample/Sample.Minimal/LaunchRecordEndpoints.cs create mode 100644 sample/Sample.Minimal/RocketEndpoints.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/BetweenPropertyRule.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/ComparisonPropertyRule.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/Constants.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/EmailPropertyRule.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/Extensions.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/FluentValidationOpenApiSchemaTransformer.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/IPropertyRuleHandler.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/LengthPropertyRule.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/NotEmptyPropertyRule.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/OpenApiValidationContext.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/RegularExpressionPropertyRule.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/RequiredPropertyRuleHandler.cs create mode 100644 src/AspNetCore.FluentValidation.OpenApi/ServiceCollectionExtensions.cs delete mode 100644 src/AspNetCore.FluentValidation.OpenApi/Start.cs create mode 100644 test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.json delete mode 100644 test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.txt delete mode 100644 test/Sample.Minimal.Tests/RestfulConventionTests.cs create mode 100644 test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json delete mode 100644 test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt create mode 100644 test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json delete mode 100644 test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f5ca49c8..51faefafc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,18 +140,6 @@ jobs: id: default run: | dotnet .build/bin/Debug/.build.dll --target Default --skip Restore Build Test Pack - - name: 🏺 Publish coverage data - if: always() - uses: actions/upload-artifact@v4.4.3 - with: - name: 'coverage' - path: 'coverage/' - - name: 📫 Publish Coverage - if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]') - uses: codecov/codecov-action@v5.0.7 - with: - name: 'actions-${{ matrix.os }}' - token: '${{ secrets.CODECOV_TOKEN }}' - name: 🏺 Publish logs if: always() uses: actions/upload-artifact@v4.4.3 @@ -184,7 +172,7 @@ jobs: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - name: 📫 Publish Codecov Coverage if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]') - uses: codecov/codecov-action@v5.0.3 + uses: codecov/codecov-action@v5.0.7 with: name: 'actions' token: '${{ secrets.CODECOV_TOKEN }}' diff --git a/sample/Sample.BlazorServer/Pages/Rockets/Delete.razor.cs b/sample/Sample.BlazorServer/Pages/Rockets/Delete.razor.cs index a80964b31..9121381a5 100644 --- a/sample/Sample.BlazorServer/Pages/Rockets/Delete.razor.cs +++ b/sample/Sample.BlazorServer/Pages/Rockets/Delete.razor.cs @@ -17,12 +17,12 @@ public partial class Delete : ComponentBase protected override async Task OnInitializedAsync() { - Model = await Mediator.Send(new GetRocket.Request { Id = Id }); + Model = await Mediator.Send(new GetRocket.Request(Id)); } public async Task Save() { - await Mediator.Send(new DeleteRocket.Request { Id = Id }); + await Mediator.Send(new DeleteRocket.Request(Id)); NavigationManager.NavigateTo("/rockets"); } } diff --git a/sample/Sample.BlazorServer/Pages/Rockets/Edit.razor.cs b/sample/Sample.BlazorServer/Pages/Rockets/Edit.razor.cs index e44b14bf7..28af3d7ff 100644 --- a/sample/Sample.BlazorServer/Pages/Rockets/Edit.razor.cs +++ b/sample/Sample.BlazorServer/Pages/Rockets/Edit.razor.cs @@ -20,7 +20,7 @@ public partial class Edit : ComponentBase protected override async Task OnInitializedAsync() { - Model = EditRocket.MapRequest(await Mediator.Send(new GetRocket.Request { Id = Id, })); + Model = EditRocket.MapRequest(await Mediator.Send(new GetRocket.Request(Id))); } public async Task Save() @@ -28,4 +28,4 @@ public async Task Save() await Mediator.Send(Model with { Id = Id, }); NavigationManager.NavigateTo("/rockets"); } -} \ No newline at end of file +} diff --git a/sample/Sample.BlazorServer/Pages/Rockets/View.razor.cs b/sample/Sample.BlazorServer/Pages/Rockets/View.razor.cs index 8414577df..16e297c8a 100644 --- a/sample/Sample.BlazorServer/Pages/Rockets/View.razor.cs +++ b/sample/Sample.BlazorServer/Pages/Rockets/View.razor.cs @@ -14,6 +14,6 @@ public partial class View : ComponentBase protected override async Task OnInitializedAsync() { - Model = await Mediator.Send(new GetRocket.Request { Id = Id }); + Model = await Mediator.Send(new GetRocket.Request(Id)); } } diff --git a/sample/Sample.Core/Operations/LaunchRecords/DeleteLaunchRecord.cs b/sample/Sample.Core/Operations/LaunchRecords/DeleteLaunchRecord.cs index 9fe647542..5ce3994d0 100644 --- a/sample/Sample.Core/Operations/LaunchRecords/DeleteLaunchRecord.cs +++ b/sample/Sample.Core/Operations/LaunchRecords/DeleteLaunchRecord.cs @@ -16,13 +16,8 @@ public static partial class DeleteLaunchRecord /// /// The request to delete a launch record /// - public record Request : IRequest - { - /// - /// The launch record to delete - /// - public LaunchRecordId Id { get; init; } - } + /// The id of the record to delete + public record Request(LaunchRecordId Id) : IRequest; [UsedImplicitly] private class Validator : AbstractValidator @@ -51,4 +46,4 @@ public async Task Handle(Request request, CancellationToken cancellationToken) await dbContext.SaveChangesAsync(cancellationToken).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/sample/Sample.Core/Operations/LaunchRecords/GetLaunchRecord.cs b/sample/Sample.Core/Operations/LaunchRecords/GetLaunchRecord.cs index 87eeff864..f6f6f2011 100644 --- a/sample/Sample.Core/Operations/LaunchRecords/GetLaunchRecord.cs +++ b/sample/Sample.Core/Operations/LaunchRecords/GetLaunchRecord.cs @@ -17,13 +17,8 @@ public static partial class GetLaunchRecord /// /// The request to get a launch record /// - public record Request : IRequest - { - /// - /// The launch record to find - /// - public LaunchRecordId Id { get; init; } - } + /// The id of the launch record + public record Request(LaunchRecordId Id) : IRequest; private class Validator : AbstractValidator { @@ -48,4 +43,4 @@ public async Task Handle(Request request, CancellationToken c return ModelMapper.Map(rocket); } } -} \ No newline at end of file +} diff --git a/sample/Sample.Core/Operations/Rockets/DeleteRocket.cs b/sample/Sample.Core/Operations/Rockets/DeleteRocket.cs index 9920edf9c..5222e2e48 100644 --- a/sample/Sample.Core/Operations/Rockets/DeleteRocket.cs +++ b/sample/Sample.Core/Operations/Rockets/DeleteRocket.cs @@ -16,13 +16,8 @@ public static partial class DeleteRocket /// /// The request to remove a rocket from the system /// - public record Request : IRequest - { - /// - /// The rocket id - /// - public RocketId Id { get; init; } - } + /// The id of the rocket to remove + public record Request(RocketId Id) : IRequest; private class Validator : AbstractValidator { @@ -45,4 +40,4 @@ public async Task Handle(Request request, CancellationToken cancellationToken) await dbContext.SaveChangesAsync(cancellationToken).ConfigureAwait(false); } } -} \ No newline at end of file +} diff --git a/sample/Sample.Core/Operations/Rockets/GetRocket.cs b/sample/Sample.Core/Operations/Rockets/GetRocket.cs index af0625453..453b7e4d9 100644 --- a/sample/Sample.Core/Operations/Rockets/GetRocket.cs +++ b/sample/Sample.Core/Operations/Rockets/GetRocket.cs @@ -16,13 +16,8 @@ public static partial class GetRocket /// /// Request to fetch information about a rocket /// - public record Request : IRequest - { - /// - /// The rocket id - /// - public RocketId Id { get; set; } - } + /// The id of the rocket + public record Request(RocketId Id) : IRequest; private class Validator : AbstractValidator { @@ -41,4 +36,4 @@ public async Task Handle(Request request, CancellationToken cancell return ModelMapper.Map(await dbContext.Rockets.FindAsync([request.Id,], cancellationToken).ConfigureAwait(false) ?? throw new NotFoundException()); } } -} \ No newline at end of file +} diff --git a/sample/Sample.Minimal/CustomHostedService.cs b/sample/Sample.Minimal/CustomHostedService.cs new file mode 100644 index 000000000..7b7f090a8 --- /dev/null +++ b/sample/Sample.Minimal/CustomHostedService.cs @@ -0,0 +1,11 @@ +using Microsoft.Extensions.Options; + +internal class CustomHostedService(IOptions options) : BackgroundService +{ + protected override Task ExecuteAsync(CancellationToken stoppingToken) + { + // ReSharper disable once UnusedVariable + var v = options.Value.A; + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/sample/Sample.Minimal/CustomHostedServiceOptions.cs b/sample/Sample.Minimal/CustomHostedServiceOptions.cs new file mode 100644 index 000000000..c3c34467c --- /dev/null +++ b/sample/Sample.Minimal/CustomHostedServiceOptions.cs @@ -0,0 +1,15 @@ +using FluentValidation; + +internal class CustomHostedServiceOptions +{ + public string? A { get; set; } + + [UsedImplicitly] + private sealed class Validator : AbstractValidator + { + public Validator() + { + RuleFor(z => z.A).NotNull(); + } + } +} \ No newline at end of file diff --git a/sample/Sample.Minimal/LaunchRecordEndpoints.cs b/sample/Sample.Minimal/LaunchRecordEndpoints.cs new file mode 100644 index 000000000..35994498c --- /dev/null +++ b/sample/Sample.Minimal/LaunchRecordEndpoints.cs @@ -0,0 +1,69 @@ +using MediatR; +using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Mvc; +using Sample.Core.Domain; +using Sample.Core.Models; +using Sample.Core.Operations.LaunchRecords; + +internal static partial class LaunchRecordEndpoints +{ + public static void UseLaunchRecords(this WebApplication app) + { + app.MapGet("/launch-records", ListLaunchRecords); + app.MapGet("/launch-records/{id:guid}", GetLaunchRecord); + app.MapPost("/launch-records", CreateLaunchRecord); + app.MapPut("/launch-records/{id:guid}", EditLaunchRecord); + app.MapPatch("/launch-records/{id:guid}", PatchLaunchRecord); + app.MapDelete("/launch-records/{id:guid}", DeleteLaunchRecord); + } + + [EndpointName(nameof(ListLaunchRecords))] + private static Ok> ListLaunchRecords(IMediator mediator, RocketType? rocketType) => + TypedResults.Ok(mediator.CreateStream(new ListLaunchRecords.Request(rocketType))); + + [EndpointName(nameof(GetLaunchRecord))] + private static async Task, NotFound, ProblemHttpResult>> GetLaunchRecord( + IMediator mediator, + LaunchRecordId id, + CancellationToken cancellationToken + ) => TypedResults.Ok(await mediator.Send(new GetLaunchRecord.Request(id), cancellationToken)); + + [EndpointName(nameof(CreateLaunchRecord))] + private static async Task, ProblemHttpResult, BadRequest>> CreateLaunchRecord( + IMediator mediator, + CreateLaunchRecord.Request request + ) + { + return TypedResults.CreatedAtRoute(await mediator.Send(request), nameof(GetLaunchRecord)); + } + + /// + /// Does this comment get picked up? + /// + /// + /// + /// + /// + [EndpointName(nameof(EditLaunchRecord))] + private static async Task, NotFound, ProblemHttpResult, BadRequest>> EditLaunchRecord( + IMediator mediator, + [FromRoute] + LaunchRecordId id, + EditLaunchRecord.Request model + ) => TypedResults.Ok(await mediator.Send(model with { Id = id })); + + [EndpointName(nameof(PatchLaunchRecord))] + private static async Task, NotFound, ProblemHttpResult, BadRequest>> PatchLaunchRecord( + IMediator mediator, + [FromRoute] + LaunchRecordId id, + EditLaunchRecord.PatchRequest model + ) => TypedResults.Ok(await mediator.Send(model with { Id = id })); + + [EndpointName(nameof(DeleteLaunchRecord))] + private static async Task> DeleteLaunchRecord(IMediator mediator, [FromRoute] LaunchRecordId id) + { + await mediator.Send(new DeleteLaunchRecord.Request(id)); + return TypedResults.NoContent(); + } +} diff --git a/sample/Sample.Minimal/Program.cs b/sample/Sample.Minimal/Program.cs index 8ab4c3e68..e85f879d9 100644 --- a/sample/Sample.Minimal/Program.cs +++ b/sample/Sample.Minimal/Program.cs @@ -1,17 +1,10 @@ using System.Reflection; using System.Text; using System.Text.Json; -using FluentValidation; using Humanizer; -using MediatR; -using Microsoft.AspNetCore.Http.HttpResults; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Diagnostics.HealthChecks; -using Microsoft.Extensions.Options; using Rocket.Surgery.Hosting; using Rocket.Surgery.LaunchPad.AspNetCore; -using Sample.Core.Models; -using Sample.Core.Operations.LaunchRecords; using Sample.Minimal; using Serilog; @@ -40,6 +33,8 @@ app .UseSwaggerUI() .UseReDoc(); +app.UseLaunchRecords(); +app.UseRockets(); app.UseAuthorization(); app.MapHealthChecks( @@ -56,87 +51,6 @@ } ); -app.MapGet("/launch-records", LaunchPadApi.ListLaunchRecords); -app.MapGet("/launch-records/{id:guid}", LaunchPadApi.GetLaunchRecord); -//[Route("[controller]")] -//public partial class LaunchRecordController : RestfulApiController -//{ -// /// -// /// Create a new launch record -// /// -// /// The launch record details -// /// -// [HttpPost] -// [Created(nameof(GetLaunchRecord))] -// public partial Task> CreateLaunchRecord(CreateLaunchRecord.Request request); -// -// /// -// /// Update a given launch record -// /// -// /// The id of the launch record -// /// The request details -// /// -// [HttpPut("{id:guid}")] -// // ReSharper disable once RouteTemplates.ParameterTypeAndConstraintsMismatch -// public partial Task EditLaunchRecord([BindRequired] [FromRoute] LaunchRecordId id, EditLaunchRecord.Request model); -// -// /// -// /// Update a given launch record -// /// -// /// The id of the launch record -// /// The request details -// /// -// [HttpPatch("{id:guid}")] -// // ReSharper disable once RouteTemplates.ParameterTypeAndConstraintsMismatch -// public partial Task PatchLaunchRecord([BindRequired] [FromRoute] LaunchRecordId id, EditLaunchRecord.PatchRequest model); -// -// /// -// /// Remove a launch record -// /// -// /// -// /// -// [HttpDelete("{id:guid}")] -// public partial Task DeleteLaunchRecord(DeleteLaunchRecord.Request request); - - app.Run(); public partial class Program; - -internal class CustomHostedServiceOptions -{ - public string? A { get; set; } - - [UsedImplicitly] - private sealed class Validator : AbstractValidator - { - public Validator() - { - RuleFor(z => z.A).NotNull(); - } - } -} - -internal class CustomHostedService(IOptions options) : BackgroundService -{ - protected override Task ExecuteAsync(CancellationToken stoppingToken) - { - // ReSharper disable once UnusedVariable - var v = options.Value.A; - return Task.CompletedTask; - } -} - - -public static partial class LaunchPadApi -{ - public static Ok> ListLaunchRecords(IMediator mediator, ListLaunchRecords.Request request) => - TypedResults.Ok(mediator.CreateStream(request)); - - public static async Task> GetLaunchRecord( - IMediator mediator, - [FromRoute] - GetLaunchRecord.Request request, - CancellationToken cancellationToken - ) => TypedResults.Ok(await mediator.Send(request, cancellationToken)); -} diff --git a/sample/Sample.Minimal/RocketEndpoints.cs b/sample/Sample.Minimal/RocketEndpoints.cs new file mode 100644 index 000000000..924528c8d --- /dev/null +++ b/sample/Sample.Minimal/RocketEndpoints.cs @@ -0,0 +1,58 @@ +using MediatR; +using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Mvc; +using Sample.Core.Domain; +using Sample.Core.Models; +using Sample.Core.Operations.Rockets; + +internal static partial class RocketEndpoints +{ + public static void UseRockets(this WebApplication app) + { + app.MapGet("/rockets", ListRockets); + app.MapGet("/rockets/{id:guid}", GetRocket); + app.MapPost("/rockets", CreateRocket); + app.MapPut("/rockets/{id:guid}", EditRocket); + app.MapPatch("/rockets/{id:guid}", PatchRocket); + app.MapDelete("/rockets/{id:guid}", DeleteRocket); + } + + private static Ok> ListRockets(IMediator mediator, RocketType? rocketType) => + TypedResults.Ok(mediator.CreateStream(new ListRockets.Request(rocketType))); + + private static async Task, NotFound, ProblemHttpResult>> GetRocket( + IMediator mediator, + [FromRoute] + RocketId id, + CancellationToken cancellationToken + ) => TypedResults.Ok(await mediator.Send(new GetRocket.Request(id), cancellationToken)); + + private static async Task, ProblemHttpResult, BadRequest>> CreateRocket( + IMediator mediator, + CreateRocket.Request request + ) + { + return TypedResults.CreatedAtRoute(await mediator.Send(request), nameof(GetRocket)); + } + + private static async Task, NotFound, ProblemHttpResult, BadRequest>> EditRocket( + IMediator mediator, + [FromRoute] + RocketId id, + EditRocket.Request model + ) => TypedResults.Ok(await mediator.Send(model with { Id = id })); + + private static async Task, NotFound, ProblemHttpResult, BadRequest>> PatchRocket( + IMediator mediator, + [FromRoute] + RocketId id, + EditRocket.PatchRequest model + ) => TypedResults.Ok(await mediator.Send(model with { Id = id })); + + [HttpDelete("{id:guid}")] + private static async Task> DeleteRocket(IMediator mediator, [FromRoute] RocketId id) + { + await mediator.Send(new DeleteRocket.Request(id)); + return TypedResults.NoContent(); + } +} diff --git a/sample/Sample.Pages/Pages/Rockets/Delete.cshtml.cs b/sample/Sample.Pages/Pages/Rockets/Delete.cshtml.cs index a298cd8d1..da11d09f3 100644 --- a/sample/Sample.Pages/Pages/Rockets/Delete.cshtml.cs +++ b/sample/Sample.Pages/Pages/Rockets/Delete.cshtml.cs @@ -7,7 +7,7 @@ public class RocketDeleteModel : RocketViewModel { public async Task OnPost() { - await Send(new DeleteRocket.Request { Id = Id }); + await Send(new DeleteRocket.Request(Id)); return RedirectToPage("Index"); } } diff --git a/sample/Sample.Pages/Pages/Rockets/View.cshtml.cs b/sample/Sample.Pages/Pages/Rockets/View.cshtml.cs index 8162d4f0c..9269bc3d9 100644 --- a/sample/Sample.Pages/Pages/Rockets/View.cshtml.cs +++ b/sample/Sample.Pages/Pages/Rockets/View.cshtml.cs @@ -15,6 +15,6 @@ public class RocketViewModel : MediatorPageModel public virtual async Task OnGet() { - Rocket = await Send(new GetRocket.Request { Id = Id }); + Rocket = await Send(new GetRocket.Request(Id)); } } diff --git a/sample/Sample.Restful.Client/Sample.Restful.Client.csproj b/sample/Sample.Restful.Client/Sample.Restful.Client.csproj index 30281fa63..7f4e37c76 100644 --- a/sample/Sample.Restful.Client/Sample.Restful.Client.csproj +++ b/sample/Sample.Restful.Client/Sample.Restful.Client.csproj @@ -14,8 +14,8 @@ - value is int || value is long || value is float || value is double || value is decimal; +} \ No newline at end of file diff --git a/src/AspNetCore.FluentValidation.OpenApi/FluentValidationOpenApiSchemaTransformer.cs b/src/AspNetCore.FluentValidation.OpenApi/FluentValidationOpenApiSchemaTransformer.cs new file mode 100644 index 000000000..90bd81c38 --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/FluentValidationOpenApiSchemaTransformer.cs @@ -0,0 +1,44 @@ +using FluentValidation; +using Microsoft.AspNetCore.OpenApi; +using Microsoft.OpenApi.Models; + +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public class FluentValidationOpenApiSchemaTransformer(IEnumerable ruleDefinitionHandlers) : IOpenApiSchemaTransformer +{ + public async Task TransformAsync(OpenApiSchema schema, OpenApiSchemaTransformerContext context, CancellationToken cancellationToken) + { + var validatorType = typeof(IValidator<>).MakeGenericType(context.JsonTypeInfo.Type); + if (context.ApplicationServices.GetService(validatorType) is not IValidator validator) return; + + var descriptor = validator.CreateDescriptor(); + foreach (var (validators, propertyKey, property) in descriptor + .GetMembersWithValidators() + .Join( + schema.Properties, + z => z.Key, + z => z.Key, + (z, y) => ( validators: z.AsEnumerable(), property: y.Key, schema: y.Value ), + StringComparer.OrdinalIgnoreCase + )) + + { + foreach (var (propertyValidator, component) in validators) + { + foreach (var item in ruleDefinitionHandlers) + { + var ctx = new OpenApiValidationContext( + schema, + property, + context, + propertyValidator, + propertyKey, + component + ); + await item.HandleAsync(ctx, cancellationToken); + } + } + } + } +} diff --git a/src/AspNetCore.FluentValidation.OpenApi/IPropertyRuleHandler.cs b/src/AspNetCore.FluentValidation.OpenApi/IPropertyRuleHandler.cs new file mode 100644 index 000000000..d4de4498a --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/IPropertyRuleHandler.cs @@ -0,0 +1,7 @@ +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public interface IPropertyRuleHandler +{ + Task HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/src/AspNetCore.FluentValidation.OpenApi/LengthPropertyRule.cs b/src/AspNetCore.FluentValidation.OpenApi/LengthPropertyRule.cs new file mode 100644 index 000000000..a914e0869 --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/LengthPropertyRule.cs @@ -0,0 +1,30 @@ +using FluentValidation.Validators; + +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public sealed class LengthPropertyRule : IPropertyRuleHandler +{ + Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) + { + if (context.PropertyValidator is not ILengthValidator validator) return Task.CompletedTask; + + if (context.PropertySchema.Type == "array") + { + if (validator.Max > 0) + context.PropertySchema.MaxItems = validator.Max; + + if (validator.Min > 0) + context.PropertySchema.MinItems = validator.Min; + } + else + { + if (validator.Max > 0) + context.PropertySchema.MaxLength = validator.Max; + if (validator.Min > 0) + context.PropertySchema.MinLength = validator.Min; + } + + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/src/AspNetCore.FluentValidation.OpenApi/NotEmptyPropertyRule.cs b/src/AspNetCore.FluentValidation.OpenApi/NotEmptyPropertyRule.cs new file mode 100644 index 000000000..bc1f8992c --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/NotEmptyPropertyRule.cs @@ -0,0 +1,15 @@ +using FluentValidation.Validators; + +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public sealed class NotEmptyPropertyRule : IPropertyRuleHandler +{ + Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) + { + if (context is { PropertyValidator: not INotEmptyValidator } or { PropertySchema.MinLength: > 1 } or { PropertySchema.Type: not ("string" or "array") }) + return Task.CompletedTask; + context.PropertySchema.MinLength = 1; + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/src/AspNetCore.FluentValidation.OpenApi/OpenApiValidationContext.cs b/src/AspNetCore.FluentValidation.OpenApi/OpenApiValidationContext.cs new file mode 100644 index 000000000..4354cdb92 --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/OpenApiValidationContext.cs @@ -0,0 +1,17 @@ +using System.Text.Json.Serialization.Metadata; +using FluentValidation.Internal; +using FluentValidation.Validators; +using Microsoft.AspNetCore.OpenApi; +using Microsoft.OpenApi.Models; + +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public record OpenApiValidationContext +( + OpenApiSchema TypeSchema, + OpenApiSchema PropertySchema, + OpenApiSchemaTransformerContext TransformerContext, + IPropertyValidator PropertyValidator, + string PropertyKey, + IRuleComponent RuleComponent); diff --git a/src/AspNetCore.FluentValidation.OpenApi/RegularExpressionPropertyRule.cs b/src/AspNetCore.FluentValidation.OpenApi/RegularExpressionPropertyRule.cs new file mode 100644 index 000000000..e679001fd --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/RegularExpressionPropertyRule.cs @@ -0,0 +1,26 @@ +using FluentValidation.Validators; + +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public sealed class RegularExpressionPropertyRule : IPropertyRuleHandler +{ + Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) + { + if (context is not { PropertyValidator: IRegularExpressionValidator validator }) return Task.CompletedTask; + + var anyPatterns = context.PropertySchema.AllOf.Any(schema => schema.Pattern is { }); + if (context.PropertySchema is { Pattern: { } } || anyPatterns) + { + if (!anyPatterns) context.PropertySchema.AllOf.Add(new() { Pattern = context.PropertySchema.Pattern }); + context.PropertySchema.AllOf.Add(new() { Pattern = validator.Expression }); + context.PropertySchema.Pattern = null; + } + else + { + context.PropertySchema.Pattern = validator.Expression; + } + + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/src/AspNetCore.FluentValidation.OpenApi/RequiredPropertyRuleHandler.cs b/src/AspNetCore.FluentValidation.OpenApi/RequiredPropertyRuleHandler.cs new file mode 100644 index 000000000..daa223c58 --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/RequiredPropertyRuleHandler.cs @@ -0,0 +1,14 @@ +using FluentValidation.Validators; + +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public sealed class RequiredPropertyRuleHandler : IPropertyRuleHandler +{ + Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) + { + if (context.PropertyValidator is not (INotNullValidator or INotEmptyValidator)) return Task.CompletedTask; + context.TypeSchema.Required.Add(context.PropertyKey); + return Task.CompletedTask; + } +} diff --git a/src/AspNetCore.FluentValidation.OpenApi/ServiceCollectionExtensions.cs b/src/AspNetCore.FluentValidation.OpenApi/ServiceCollectionExtensions.cs new file mode 100644 index 000000000..669020fbe --- /dev/null +++ b/src/AspNetCore.FluentValidation.OpenApi/ServiceCollectionExtensions.cs @@ -0,0 +1,28 @@ +using FluentValidation.AspNetCore; +using Microsoft.AspNetCore.OpenApi; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; + +namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; + +[Experimental(Constants.ExperimentalId)] +public static class ServiceCollectionExtensions +{ + public static IServiceCollection AddFluentValidationOpenApi(this IServiceCollection services) + { + services.AddOpenApi(); + services.AddFluentValidationAutoValidation(); + services.Configure( + "v1", + options => { options.AddSchemaTransformer(); } + ); + services.TryAddEnumerable(ServiceDescriptor.Transient()); + services.TryAddEnumerable(ServiceDescriptor.Transient()); + services.TryAddEnumerable(ServiceDescriptor.Transient()); + services.TryAddEnumerable(ServiceDescriptor.Transient()); + services.TryAddEnumerable(ServiceDescriptor.Transient()); + services.TryAddEnumerable(ServiceDescriptor.Transient()); + services.TryAddEnumerable(ServiceDescriptor.Transient()); + return services; + } +} \ No newline at end of file diff --git a/src/AspNetCore.FluentValidation.OpenApi/Start.cs b/src/AspNetCore.FluentValidation.OpenApi/Start.cs deleted file mode 100644 index b23648dc8..000000000 --- a/src/AspNetCore.FluentValidation.OpenApi/Start.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System.Numerics; -using System.Text.Json.Serialization.Metadata; -using FluentValidation; -using FluentValidation.AspNetCore; -using FluentValidation.Internal; -using FluentValidation.Validators; -using Microsoft.AspNetCore.OpenApi; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.OpenApi.Models; - -namespace Rocket.Surgery.LaunchPad.AspNetCore.FluentValidation.OpenApi; - -internal static class Constants -{ - public const string ExperimentalId = "RSGEXP"; -} - -[Experimental(Constants.ExperimentalId)] -public static class ServiceCollectionExtensions -{ - public static IServiceCollection AddFluentValidationOpenApi(this IServiceCollection services) - { - services.AddOpenApi(); - services.AddFluentValidationAutoValidation(); - services.Configure( - "v1", - options => { options.AddSchemaTransformer(); } - ); - services.TryAddEnumerable(ServiceDescriptor.Transient()); - services.TryAddEnumerable(ServiceDescriptor.Transient()); - services.TryAddEnumerable(ServiceDescriptor.Transient()); - services.TryAddEnumerable(ServiceDescriptor.Transient()); - services.TryAddEnumerable(ServiceDescriptor.Transient()); - services.TryAddEnumerable(ServiceDescriptor.Transient()); - services.TryAddEnumerable(ServiceDescriptor.Transient()); - return services; - } -} - -[Experimental(Constants.ExperimentalId)] -public record OpenApiValidationContext -( - OpenApiSchema TypeSchema, - OpenApiSchema PropertySchema, - OpenApiSchemaTransformerContext TransformerContext, - IPropertyValidator PropertyValidator, - JsonPropertyInfo PropertyInfo, - IRuleComponent RuleComponent); - -[Experimental(Constants.ExperimentalId)] -public interface IPropertyRuleHandler -{ - Task HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken); -} - -[Experimental(Constants.ExperimentalId)] -public class FluentValidationOpenApiSchemaTransformer(IEnumerable ruleDefinitionHandlers) : IOpenApiSchemaTransformer -{ - private OpenApiSchema? _parent; - - public async Task TransformAsync(OpenApiSchema schema, OpenApiSchemaTransformerContext context, CancellationToken cancellationToken) - { - if (context.JsonPropertyInfo is not { } propertyInfo) - { - _parent = schema; - return; - } - - var validatorType = typeof(IValidator<>).MakeGenericType(propertyInfo.DeclaringType); - if (context.ApplicationServices.GetService(validatorType) is not IValidator validator) return; - if (_parent is null) return; - - var descriptor = validator.CreateDescriptor(); - foreach (var member in descriptor.GetMembersWithValidators()) - { - foreach (var (propertyValidator, component) in member) - { - if (!_parent.Properties.TryGetValue(propertyInfo.Name, out var property)) continue; - - foreach (var item in ruleDefinitionHandlers) - { - var ctx = new OpenApiValidationContext( - _parent, - property, - context, - propertyValidator, - propertyInfo, - component - ); - await item.HandleAsync(ctx, cancellationToken); - } - } - } - } -} - -[Experimental(Constants.ExperimentalId)] -public sealed class RequiredPropertyRuleHandler : IPropertyRuleHandler -{ - Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) - { - if (context.PropertyValidator is not (INotNullValidator or INotEmptyValidator)) return Task.CompletedTask; - context.TypeSchema.Required.Add(context.PropertyInfo.Name); - return Task.CompletedTask; - } -} - -[Experimental(Constants.ExperimentalId)] -public sealed class NotEmptyPropertyRule : IPropertyRuleHandler -{ - Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) - { - if (context is { PropertyValidator: not INotEmptyValidator } or { PropertySchema.MinLength: > 1 } or { PropertySchema.Type: not ("string" or "array") }) - return Task.CompletedTask; - context.PropertySchema.MinLength = 1; - return Task.CompletedTask; - } -} - -[Experimental(Constants.ExperimentalId)] -public sealed class LengthPropertyRule : IPropertyRuleHandler -{ - Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) - { - if (context.PropertyValidator is not ILengthValidator validator) return Task.CompletedTask; - - if (context.PropertySchema.Type == "array") - { - if (validator.Max > 0) - context.PropertySchema.MaxItems = validator.Max; - - if (validator.Min > 0) - context.PropertySchema.MinItems = validator.Min; - } - else - { - if (validator.Max > 0) - context.PropertySchema.MaxLength = validator.Max; - if (validator.Min > 0) - context.PropertySchema.MinLength = validator.Min; - } - - return Task.CompletedTask; - } -} - -[Experimental(Constants.ExperimentalId)] -public sealed class RegularExpressionPropertyRule : IPropertyRuleHandler -{ - Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) - { - if (context is not { PropertyValidator: IRegularExpressionValidator validator }) return Task.CompletedTask; - - var anyPatterns = context.PropertySchema.AllOf.Any(schema => schema.Pattern is { }); - if (context.PropertySchema is { Pattern: { } } || anyPatterns) - { - if (!anyPatterns) context.PropertySchema.AllOf.Add(new() { Pattern = context.PropertySchema.Pattern }); - context.PropertySchema.AllOf.Add(new() { Pattern = validator.Expression }); - context.PropertySchema.Pattern = null; - } - else - { - context.PropertySchema.Pattern = validator.Expression; - } - - return Task.CompletedTask; - } -} - -[Experimental(Constants.ExperimentalId)] -public sealed class EmailPropertyRule : IPropertyRuleHandler -{ - Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) - { - if (context is not { PropertyValidator: IEmailValidator validator }) return Task.CompletedTask; - context.PropertySchema.Format = "email"; - return Task.CompletedTask; - } -} - -[Experimental(Constants.ExperimentalId)] -public sealed class ComparisonPropertyRule : IPropertyRuleHandler -{ - Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) - { - if (context is not { PropertyValidator: IComparisonValidator validator }) return Task.CompletedTask; - - if (!validator.ValueToCompare.IsNumeric()) return Task.CompletedTask; - var valueToCompare = Convert.ToDecimal(validator.ValueToCompare); - var schemaProperty = context.PropertySchema; - - switch (validator) - { - case { Comparison: Comparison.GreaterThanOrEqual }: - { - schemaProperty.Minimum = valueToCompare; - return Task.CompletedTask; - } - - case { Comparison: Comparison.GreaterThan }: - { - schemaProperty.Minimum = valueToCompare; - schemaProperty.ExclusiveMinimum = true; - return Task.CompletedTask; - } - - case { Comparison: Comparison.LessThanOrEqual }: - { - schemaProperty.Maximum = valueToCompare; - return Task.CompletedTask; - } - - case { Comparison: Comparison.LessThan }: - { - schemaProperty.Maximum = valueToCompare; - schemaProperty.ExclusiveMaximum = true; - return Task.CompletedTask; - } - } - - return Task.CompletedTask; - } -} - -internal static class Extensions -{ - internal static bool IsNumeric(this object value) => value is int || value is long || value is float || value is double || value is decimal; -} - -[Experimental(Constants.ExperimentalId)] -public sealed class BetweenPropertyRule : IPropertyRuleHandler -{ - Task IPropertyRuleHandler.HandleAsync(OpenApiValidationContext context, CancellationToken cancellationToken) - { - if (context is not { PropertyValidator: IBetweenValidator validator }) return Task.CompletedTask; - - var schemaProperty = context.PropertySchema; - if (validator.From.IsNumeric()) - { - schemaProperty.Minimum = Convert.ToDecimal(validator.From); - if (validator.Name == "ExclusiveBetweenValidator") schemaProperty.ExclusiveMinimum = true; - } - - if (validator.To.IsNumeric()) - { - schemaProperty.Maximum = Convert.ToDecimal(validator.To); - if (validator.Name == "ExclusiveBetweenValidator") schemaProperty.ExclusiveMaximum = true; - } - - return Task.CompletedTask; - } -} diff --git a/src/AspNetCore/OpenApi/StronglyTypedIdSchemaFilter.cs b/src/AspNetCore/OpenApi/StronglyTypedIdSchemaFilter.cs index f856d89e0..8f0f88fe6 100644 --- a/src/AspNetCore/OpenApi/StronglyTypedIdSchemaFilter.cs +++ b/src/AspNetCore/OpenApi/StronglyTypedIdSchemaFilter.cs @@ -26,7 +26,8 @@ internal class StronglyTypedIdSchemaFilter : IOpenApiSchemaTransformer { public Task TransformAsync(OpenApiSchema schema, OpenApiSchemaTransformerContext context, CancellationToken cancellationToken) { - if (StronglyTypedIdHelpers.GetStronglyTypedIdType(context.JsonTypeInfo.Type) is not { } type) return Task.CompletedTask; + if (StronglyTypedIdHelpers.GetStronglyTypedIdType(context.JsonPropertyInfo?.PropertyType) is not { } type) return Task.CompletedTask; +// TODO: Solve this return Task.CompletedTask; } } diff --git a/test/Sample.Classic.Restful.Tests/ClassicFoundationTests.cs b/test/Sample.Classic.Restful.Tests/ClassicFoundationTests.cs index 1be4b8326..a7e49cb98 100644 --- a/test/Sample.Classic.Restful.Tests/ClassicFoundationTests.cs +++ b/test/Sample.Classic.Restful.Tests/ClassicFoundationTests.cs @@ -18,6 +18,6 @@ public async Task OpenApiDocument() { var response = await AlbaHost.Server.CreateClient().GetAsync("/openapi/v1.json"); var document = await response.Content.ReadAsStringAsync(); - await VerifyJson(document); + await Verify(document, extension: "json"); } } diff --git a/test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.json b/test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.json new file mode 100644 index 000000000..10b5184a6 --- /dev/null +++ b/test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.json @@ -0,0 +1,1849 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Sample.Classic.Restful | v1", + "version": "1.0.0" + }, + "paths": { + "/LaunchRecord": { + "get": { + "tags": [ + "LaunchRecord" + ], + "operationId": "ListLaunchRecords", + "parameters": [ + { + "name": "rocketType", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "post": { + "tags": [ + "LaunchRecord" + ], + "operationId": "CreateLaunchRecord", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "201": { + "description": "Created", + "headers": { + "location": { + "description": "The location of the entity that was created", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/LaunchRecord/{id}": { + "get": { + "tags": [ + "LaunchRecord" + ], + "operationId": "GetLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "put": { + "tags": [ + "LaunchRecord" + ], + "operationId": "EditLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "patch": { + "tags": [ + "LaunchRecord" + ], + "operationId": "PatchLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordPatchRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordPatchRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordPatchRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "delete": { + "tags": [ + "LaunchRecord" + ], + "operationId": "DeleteLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "ListRockets", + "parameters": [ + { + "name": "rocketType", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RocketModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "post": { + "tags": [ + "Rocket" + ], + "operationId": "CreateRocket", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "201": { + "description": "Created", + "headers": { + "location": { + "description": "The location of the entity that was created", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket/{id}": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "GetRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "put": { + "tags": [ + "Rocket" + ], + "operationId": "EditRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditRocketRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "patch": { + "tags": [ + "Rocket" + ], + "operationId": "PatchRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketPatchRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketPatchRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditRocketPatchRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Rocket" + ], + "operationId": "RemoveRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket/{id}/launch-records": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "GetRocketLaunchRecords", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket/{id}/launch-records/{launchRecordId}": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "GetRocketLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "launchRecordId", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/WeatherForecast": { + "get": { + "tags": [ + "WeatherForecast" + ], + "operationId": "Get", + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WeatherForecast" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WeatherForecast" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "AssignedOfdouble": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "number", + "format": "double" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfInstant": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfNullableOfInstant": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfRocketId": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfRocketType": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketType" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfstring": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "string", + "nullable": true + }, + "hasValue": { + "type": "boolean" + } + } + }, + "CreateLaunchRecordRequest": { + "required": [ + "partner", + "rocketId", + "payload", + "scheduledLaunchDate" + ], + "type": "object", + "properties": { + "rocketId": { + "$ref": "#/components/schemas/Instant" + }, + "partner": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "payload": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "payloadWeightKg": { + "minimum": 0, + "type": "number", + "format": "double" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/Instant" + } + } + }, + "CreateLaunchRecordResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/LaunchRecordId" + } + } + }, + "CreateRocketRequest": { + "required": [ + "serialNumber" + ], + "type": "object", + "properties": { + "serialNumber": { + "maxLength": 30, + "minLength": 10, + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "CreateRocketResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + } + } + }, + "EditLaunchRecordPatchRequest": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "partner": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "payload": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "payloadWeightKg": { + "$ref": "#/components/schemas/AssignedOfdouble" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/AssignedOfNullableOfInstant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/AssignedOfInstant" + }, + "rocketId": { + "$ref": "#/components/schemas/AssignedOfRocketId" + } + } + }, + "EditLaunchRecordRequest": { + "required": [ + "partner", + "rocketId", + "payload", + "scheduledLaunchDate" + ], + "type": "object", + "properties": { + "partner": { + "minLength": 1, + "type": "string" + }, + "payload": { + "minLength": 1, + "type": "string" + }, + "payloadWeightKg": { + "minimum": 0, + "type": "number", + "format": "double" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/RocketId" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/RocketId" + }, + "rocketId": { + "$ref": "#/components/schemas/RocketId" + } + } + }, + "EditRocketPatchRequest": { + "type": "object", + "properties": { + "serialNumber": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "type": { + "$ref": "#/components/schemas/AssignedOfRocketType" + } + } + }, + "EditRocketRequest": { + "required": [ + "type", + "serialNumber" + ], + "type": "object", + "properties": { + "serialNumber": { + "maxLength": 30, + "minLength": 10, + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "FluentValidationProblemDetails": { }, + "Instant": { }, + "LaunchRecordId": { }, + "LaunchRecordModel": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Instant" + }, + "partner": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "payloadWeightKg": { + "type": "integer", + "format": "int64" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "rocketSerialNumber": { + "type": "string" + }, + "rocketType": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "ProblemDetails": { + "required": [ + "type", + "title" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "status": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "instance": { + "type": "string", + "nullable": true + } + } + }, + "RocketId": { }, + "RocketModel": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + }, + "sn": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "RocketType": { + "enum": [ + "falcon9", + "falconHeavy", + "atlasV" + ] + }, + "WeatherForecast": { + "type": "object", + "properties": { + "date": { + "type": "string", + "format": "date-time" + }, + "temperatureC": { + "type": "integer", + "format": "int32" + }, + "temperatureF": { + "type": "integer", + "format": "int32" + }, + "summary": { + "type": "string", + "nullable": true + } + } + } + } + }, + "tags": [ + { + "name": "LaunchRecord" + }, + { + "name": "Rocket" + }, + { + "name": "WeatherForecast" + } + ] +} \ No newline at end of file diff --git a/test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.txt b/test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.txt deleted file mode 100644 index 560834311..000000000 --- a/test/Sample.Classic.Restful.Tests/snapshots/ClassicFoundationTests.OpenApiDocument.verified.txt +++ /dev/null @@ -1,1906 +0,0 @@ -{ - openapi: 3.0.1, - info: { - title: Sample.Classic.Restful | v1, - version: 1.0.0 - }, - paths: { - /LaunchRecord: { - get: { - tags: [ - LaunchRecord - ], - operationId: ListLaunchRecords, - parameters: [ - { - name: rocketType, - in: query, - schema: { - type: string - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - post: { - tags: [ - LaunchRecord - ], - operationId: CreateLaunchRecord, - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 201: { - description: Created, - headers: { - location: { - description: The location of the entity that was created, - schema: { - type: string - } - } - }, - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordResponse - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordResponse - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /LaunchRecord/{id}: { - get: { - tags: [ - LaunchRecord - ], - operationId: GetLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - put: { - tags: [ - LaunchRecord - ], - operationId: EditLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - patch: { - tags: [ - LaunchRecord - ], - operationId: PatchLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - delete: { - tags: [ - LaunchRecord - ], - operationId: DeleteLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket: { - get: { - tags: [ - Rocket - ], - operationId: ListRockets, - parameters: [ - { - name: rocketType, - in: query, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/RocketModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/RocketModel - } - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - post: { - tags: [ - Rocket - ], - operationId: CreateRocket, - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 201: { - description: Created, - headers: { - location: { - description: The location of the entity that was created, - schema: { - type: string - } - } - }, - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateRocketResponse - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateRocketResponse - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}: { - get: { - tags: [ - Rocket - ], - operationId: GetRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - put: { - tags: [ - Rocket - ], - operationId: EditRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - patch: { - tags: [ - Rocket - ], - operationId: PatchRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - delete: { - tags: [ - Rocket - ], - operationId: RemoveRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}/launch-records: { - get: { - tags: [ - Rocket - ], - operationId: GetRocketLaunchRecords, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}/launch-records/{launchRecordId}: { - get: { - tags: [ - Rocket - ], - operationId: GetRocketLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - }, - { - name: launchRecordId, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /WeatherForecast: { - get: { - tags: [ - WeatherForecast - ], - operationId: Get, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/WeatherForecast - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/WeatherForecast - } - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - } - }, - components: { - schemas: { - AssignedOfdouble: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - type: number, - format: double - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfInstant: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfNullableOfInstant: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfRocketId: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfRocketType: { - maxLength: 30, - minLength: 10, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketType - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfstring: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - type: string, - nullable: true - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfstring2: { - maxLength: 30, - minLength: 10, - required: [ - value - ], - type: object, - properties: { - value: { - type: string, - nullable: true - }, - hasValue: { - type: boolean - } - } - }, - CreateLaunchRecordRequest: { - required: [ - rocketId, - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate - ], - type: object, - properties: { - rocketId: { - $ref: #/components/schemas/Instant2 - }, - partner: { - minimum: 0, - minLength: 1, - type: string, - nullable: true - }, - payload: { - minimum: 0, - minLength: 1, - type: string, - nullable: true - }, - payloadWeightKg: { - minimum: 0, - type: number, - format: double - }, - actualLaunchDate: { - $ref: #/components/schemas/Instant2 - }, - scheduledLaunchDate: { - $ref: #/components/schemas/Instant2 - } - } - }, - CreateLaunchRecordResponse: { - type: object, - properties: { - id: { - $ref: #/components/schemas/LaunchRecordId - } - } - }, - CreateRocketRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - maxLength: 30, - minLength: 10, - type: string - }, - type: { - $ref: #/components/schemas/RocketType2 - } - } - }, - CreateRocketResponse: { - type: object, - properties: { - id: { - $ref: #/components/schemas/RocketId2 - } - } - }, - EditLaunchRecordPatchRequest: { - required: [ - id, - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate, - rocketId - ], - type: object, - properties: { - partner: { - $ref: #/components/schemas/AssignedOfstring - }, - payload: { - $ref: #/components/schemas/AssignedOfstring - }, - payloadWeightKg: { - $ref: #/components/schemas/AssignedOfdouble - }, - actualLaunchDate: { - $ref: #/components/schemas/AssignedOfNullableOfInstant - }, - scheduledLaunchDate: { - $ref: #/components/schemas/AssignedOfInstant - }, - rocketId: { - $ref: #/components/schemas/AssignedOfRocketId - } - } - }, - EditLaunchRecordRequest: { - required: [ - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate, - rocketId - ], - type: object, - properties: { - partner: { - minimum: 0, - minLength: 1, - type: string - }, - payload: { - minimum: 0, - minLength: 1, - type: string - }, - payloadWeightKg: { - minimum: 0, - type: number, - format: double - }, - actualLaunchDate: { - $ref: #/components/schemas/RocketId - }, - scheduledLaunchDate: { - $ref: #/components/schemas/RocketId - }, - rocketId: { - $ref: #/components/schemas/RocketId - } - } - }, - EditRocketPatchRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - $ref: #/components/schemas/AssignedOfstring2 - }, - type: { - $ref: #/components/schemas/AssignedOfRocketType - } - } - }, - EditRocketRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - maxLength: 30, - minLength: 10, - type: string - }, - type: { - $ref: #/components/schemas/RocketType2 - } - } - }, - Instant2: { - minimum: 0 - }, - LaunchRecordModel: { - type: object, - properties: { - id: { - $ref: #/components/schemas/Instant - }, - partner: { - type: string - }, - payload: { - type: string - }, - payloadWeightKg: { - type: integer, - format: int64 - }, - actualLaunchDate: { - $ref: #/components/schemas/Instant - }, - scheduledLaunchDate: { - $ref: #/components/schemas/Instant - }, - rocketSerialNumber: { - type: string - }, - rocketType: { - $ref: #/components/schemas/RocketType - } - } - }, - ProblemDetails: { - required: [ - type, - title, - status, - detail, - instance - ], - type: object, - properties: { - type: { - type: string, - nullable: true - }, - title: { - type: string, - nullable: true - }, - status: { - type: integer, - format: int32, - nullable: true - }, - detail: { - type: string, - nullable: true - }, - instance: { - type: string, - nullable: true - } - } - }, - RocketId: { - minimum: 0 - }, - RocketModel: { - type: object, - properties: { - id: { - $ref: #/components/schemas/RocketId2 - }, - sn: { - type: string - }, - type: { - $ref: #/components/schemas/RocketType - } - } - }, - RocketType: { - enum: [ - falcon9, - falconHeavy, - atlasV - ] - }, - RocketType2: { - maxLength: 30, - minLength: 10, - enum: [ - falcon9, - falconHeavy, - atlasV - ] - }, - WeatherForecast: { - type: object, - properties: { - date: { - type: string, - format: date-time - }, - temperatureC: { - type: integer, - format: int32 - }, - temperatureF: { - type: integer, - format: int32 - }, - summary: { - type: string, - nullable: true - } - } - } - } - }, - tags: [ - { - name: LaunchRecord - }, - { - name: Rocket - }, - { - name: WeatherForecast - } - ] -} \ No newline at end of file diff --git a/test/Sample.Core.Tests/LaunchRecords/GetLaunchRecordTests.cs b/test/Sample.Core.Tests/LaunchRecords/GetLaunchRecordTests.cs index 201abad89..5ee5fbd3b 100644 --- a/test/Sample.Core.Tests/LaunchRecords/GetLaunchRecordTests.cs +++ b/test/Sample.Core.Tests/LaunchRecords/GetLaunchRecordTests.cs @@ -42,7 +42,7 @@ public async Task Should_Get_A_LaunchRecord() ); var response = await ServiceProvider.WithScoped().Invoke( - mediator => mediator.Send(new GetLaunchRecord.Request { Id = record.Id }) + mediator => mediator.Send(new GetLaunchRecord.Request( record.Id)) ); response.Partner.Should().Be("partner"); @@ -56,7 +56,7 @@ public async Task Should_Get_A_LaunchRecord() public async Task Should_Not_Get_A_Missing_Launch_Record() { Func action = () => ServiceProvider.WithScoped().Invoke( - mediator => mediator.Send(new GetLaunchRecord.Request { Id = LaunchRecordId.New() }) + mediator => mediator.Send(new GetLaunchRecord.Request (LaunchRecordId.New())) ); await action.Should().ThrowAsync(); diff --git a/test/Sample.Core.Tests/LaunchRecords/RemoveLaunchRecordsTests.cs b/test/Sample.Core.Tests/LaunchRecords/RemoveLaunchRecordsTests.cs index 09029ae41..d5cee44b6 100644 --- a/test/Sample.Core.Tests/LaunchRecords/RemoveLaunchRecordsTests.cs +++ b/test/Sample.Core.Tests/LaunchRecords/RemoveLaunchRecordsTests.cs @@ -29,7 +29,7 @@ public async Task Should_Remove_LaunchRecord() ); await ServiceProvider.WithScoped().Invoke( - mediator => mediator.Send(new DeleteLaunchRecord.Request { Id = id }) + mediator => mediator.Send(new DeleteLaunchRecord.Request(id)) ); ServiceProvider.WithScoped().Invoke(c => c.LaunchRecords.Should().BeEmpty()); @@ -56,7 +56,7 @@ await ServiceProvider.WithScoped() ); Func action = () => ServiceProvider.WithScoped().Invoke( - mediator => mediator.Send(new DeleteLaunchRecord.Request { Id = id }) + mediator => mediator.Send(new DeleteLaunchRecord.Request(id)) ); await action.Should().ThrowAsync(); } diff --git a/test/Sample.Core.Tests/Rockets/GetRocketTests.cs b/test/Sample.Core.Tests/Rockets/GetRocketTests.cs index 74c81e32c..5df6b6ec4 100644 --- a/test/Sample.Core.Tests/Rockets/GetRocketTests.cs +++ b/test/Sample.Core.Tests/Rockets/GetRocketTests.cs @@ -30,7 +30,7 @@ public async Task Should_Get_A_Rocket() ); var response = await ServiceProvider.WithScoped().Invoke( - mediator => mediator.Send(new GetRocket.Request { Id = rocket }) + mediator => mediator.Send(new GetRocket.Request(rocket)) ); response.Type.Should().Be(RocketType.Falcon9); @@ -41,7 +41,7 @@ public async Task Should_Get_A_Rocket() public async Task Should_Not_Get_A_Missing_Rocket() { Func action = () => ServiceProvider.WithScoped().Invoke( - mediator => mediator.Send(new GetRocket.Request { Id = RocketId.New() }) + mediator => mediator.Send(new GetRocket.Request(RocketId.New())) ); await action.Should().ThrowAsync(); diff --git a/test/Sample.Core.Tests/Rockets/RemoveRocketsTests.cs b/test/Sample.Core.Tests/Rockets/RemoveRocketsTests.cs index 8fa054ee6..5c649855e 100644 --- a/test/Sample.Core.Tests/Rockets/RemoveRocketsTests.cs +++ b/test/Sample.Core.Tests/Rockets/RemoveRocketsTests.cs @@ -25,7 +25,7 @@ public async Task Should_Remove_Rocket() ); await ServiceProvider.WithScoped().Invoke( - mediator => mediator.Send(new DeleteRocket.Request { Id = id }) + mediator => mediator.Send(new DeleteRocket.Request(id)) ); ServiceProvider.WithScoped().Invoke(c => c.Rockets.Should().BeEmpty()); diff --git a/test/Sample.Graphql.Tests/snapshots/FoundationTests.GraphqlSchema.verified.graphql b/test/Sample.Graphql.Tests/snapshots/FoundationTests.GraphqlSchema.verified.graphql index cd08ad901..d32a5d3ea 100644 --- a/test/Sample.Graphql.Tests/snapshots/FoundationTests.GraphqlSchema.verified.graphql +++ b/test/Sample.Graphql.Tests/snapshots/FoundationTests.GraphqlSchema.verified.graphql @@ -308,13 +308,13 @@ input DateTimeOperationFilterInput { "The request to delete a launch record" input DeleteLaunchRecordRequest { - "The launch record to delete" + "The id of the record to delete" id: UUID! } "The request to remove a rocket from the system" input DeleteRocketRequest { - "The rocket id" + "The id of the rocket to remove" id: UUID! } diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Duration.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Duration.verified.txt index 16d5859c5..ee9408319 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Duration.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Duration.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { Duration: 0:01:00:00 } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - Duration: 0:01:00:00 - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_LINESTRING(5 6, 7 8).verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_LINESTRING(5 6, 7 8).verified.txt index b31db2436..fb64dc6a2 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_LINESTRING(5 6, 7 8).verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_LINESTRING(5 6, 7 8).verified.txt @@ -3,13 +3,5 @@ GeometryTest: { Geometry: LINESTRING (5 6, 7 8) } - }, - DataInfo: { - GeometryTest: { - __typename: GeometryOutputs, - Geometry: LINESTRING (5 6, 7 8) - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTILINESTRING((19 20, 21 22), (23 24, 25 26)).verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTILINESTRING((19 20, 21 22), (23 24, 25 26)).verified.txt index 57f9dcbe2..cfbe3722e 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTILINESTRING((19 20, 21 22), (23 24, 25 26)).verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTILINESTRING((19 20, 21 22), (23 24, 25 26)).verified.txt @@ -3,13 +3,5 @@ GeometryTest: { Geometry: MULTILINESTRING ((19 20, 21 22), (23 24, 25 26)) } - }, - DataInfo: { - GeometryTest: { - __typename: GeometryOutputs, - Geometry: MULTILINESTRING ((19 20, 21 22), (23 24, 25 26)) - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOINT((15 16), (17 18)).verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOINT((15 16), (17 18)).verified.txt index b12271e6a..a1044a062 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOINT((15 16), (17 18)).verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOINT((15 16), (17 18)).verified.txt @@ -3,13 +3,5 @@ GeometryTest: { Geometry: MULTIPOINT ((15 16), (17 18)) } - }, - DataInfo: { - GeometryTest: { - __typename: GeometryOutputs, - Geometry: MULTIPOINT ((15 16), (17 18)) - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOLYGON(((27 28, 29 30, 31 32, 27 28)), ((33 34, 35 36, 37 38, 33 34))).verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOLYGON(((27 28, 29 30, 31 32, 27 28)), ((33 34, 35 36, 37 38, 33 34))).verified.txt index 8647ad0e1..44a047473 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOLYGON(((27 28, 29 30, 31 32, 27 28)), ((33 34, 35 36, 37 38, 33 34))).verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_MULTIPOLYGON(((27 28, 29 30, 31 32, 27 28)), ((33 34, 35 36, 37 38, 33 34))).verified.txt @@ -3,13 +3,5 @@ GeometryTest: { Geometry: MULTIPOLYGON (((27 28, 31 32, 29 30, 27 28)), ((33 34, 37 38, 35 36, 33 34))) } - }, - DataInfo: { - GeometryTest: { - __typename: GeometryOutputs, - Geometry: MULTIPOLYGON (((27 28, 31 32, 29 30, 27 28)), ((33 34, 37 38, 35 36, 33 34))) - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POINT(3 4).verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POINT(3 4).verified.txt index 85605db86..7e1de067e 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POINT(3 4).verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POINT(3 4).verified.txt @@ -3,13 +3,5 @@ GeometryTest: { Geometry: POINT (3 4) } - }, - DataInfo: { - GeometryTest: { - __typename: GeometryOutputs, - Geometry: POINT (3 4) - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POLYGON((9 10, 11 12, 13 14, 9 10)).verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POLYGON((9 10, 11 12, 13 14, 9 10)).verified.txt index b0479c94d..00a27354e 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POLYGON((9 10, 11 12, 13 14, 9 10)).verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Geometry_POLYGON((9 10, 11 12, 13 14, 9 10)).verified.txt @@ -3,13 +3,5 @@ GeometryTest: { Geometry: POLYGON ((9 10, 13 14, 11 12, 9 10)) } - }, - DataInfo: { - GeometryTest: { - __typename: GeometryOutputs, - Geometry: POLYGON ((9 10, 13 14, 11 12, 9 10)) - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Instant.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Instant.verified.txt index 57a4adddd..7bea3ddb6 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Instant.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Instant.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { Instant: 2020-01-01T00:00:00Z } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - Instant: 2020-01-01T00:00:00Z - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_IsoDayOfWeek.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_IsoDayOfWeek.verified.txt index 685f56e04..513dfa0e5 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_IsoDayOfWeek.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_IsoDayOfWeek.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { IsoDayOfWeek: Wednesday } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - IsoDayOfWeek: Wednesday - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDate.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDate.verified.txt index cf7a1a0b7..c8b837b3e 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDate.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDate.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { LocalDate: 2020-01-01 } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - LocalDate: 2020-01-01 - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDateTime.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDateTime.verified.txt index fbc3e7e19..025058389 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDateTime.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalDateTime.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { LocalDateTime: 2020-01-01T00:00:00 } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - LocalDateTime: 2020-01-01T00:00:00 - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalTime.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalTime.verified.txt index 5567a9763..7755a5d1f 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalTime.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_LocalTime.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { LocalTime: 00:00:00 } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - LocalTime: 00:00:00 - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Offset.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Offset.verified.txt index ac7a580cd..c07e08dca 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Offset.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Offset.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { Offset: +02 } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - Offset: +02 - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetDateTime.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetDateTime.verified.txt index 50f33c0d5..48e4e265b 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetDateTime.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetDateTime.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { OffsetDateTime: 2020-01-01T00:00:00Z } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - OffsetDateTime: 2020-01-01T00:00:00Z - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetTime.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetTime.verified.txt index 6a3722b66..e198bebe9 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetTime.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_OffsetTime.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { OffsetTime: 00:00:00+01 } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - OffsetTime: 00:00:00+01 - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Period.verified.txt b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Period.verified.txt index f8d1b7106..fb3038201 100644 --- a/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Period.verified.txt +++ b/test/Sample.Graphql.Tests/snapshots/StrawberryShakeSerializerTests.Should_Roundtrip_Period.verified.txt @@ -3,13 +3,5 @@ NodaTimeTest: { Period: PT1H } - }, - DataInfo: { - NodaTimeTest: { - __typename: NodaTimeOutputs, - Period: PT1H - }, - Version: 1 - }, - DataFactory: {} + } } \ No newline at end of file diff --git a/test/Sample.Minimal.Tests/ApiDescriptionData.cs b/test/Sample.Minimal.Tests/ApiDescriptionData.cs index 10b36f018..2d08fa849 100644 --- a/test/Sample.Minimal.Tests/ApiDescriptionData.cs +++ b/test/Sample.Minimal.Tests/ApiDescriptionData.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Rocket.Surgery.LaunchPad.AspNetCore.Testing; -namespace Sample.Restful.Tests; +namespace Sample.Minimal.Tests; internal sealed class ApiDescriptionData : TheoryData where T : class, ILaunchPadWebAppFixture, IAsyncLifetime, new() diff --git a/test/Sample.Minimal.Tests/FoundationTests.cs b/test/Sample.Minimal.Tests/FoundationTests.cs index 02a5fd05c..0d4c58807 100644 --- a/test/Sample.Minimal.Tests/FoundationTests.cs +++ b/test/Sample.Minimal.Tests/FoundationTests.cs @@ -1,7 +1,7 @@ using System.Net; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using Sample.Restful.Tests.Helpers; +using Sample.Minimal.Tests.Helpers; namespace Sample.Restful.Tests; @@ -19,6 +19,6 @@ public async Task OpenApiDocument() { var response = await AlbaHost.Server.CreateClient().GetAsync("/openapi/v1.json"); var document = await response.Content.ReadAsStringAsync(); - await VerifyJson(document); + await Verify(document, extension: "json"); } } diff --git a/test/Sample.Minimal.Tests/Helpers/SqliteExtension.cs b/test/Sample.Minimal.Tests/Helpers/SqliteExtension.cs index 662a08d20..1137fc617 100644 --- a/test/Sample.Minimal.Tests/Helpers/SqliteExtension.cs +++ b/test/Sample.Minimal.Tests/Helpers/SqliteExtension.cs @@ -6,7 +6,7 @@ using Rocket.Surgery.DependencyInjection; using Rocket.Surgery.LaunchPad.AspNetCore.Testing; -namespace Sample.Restful.Tests.Helpers; +namespace Sample.Minimal.Tests.Helpers; public sealed class SqliteExtension : IResettableAlbaExtension where TDbContext : DbContext { diff --git a/test/Sample.Minimal.Tests/Helpers/TestWebAppFixture.cs b/test/Sample.Minimal.Tests/Helpers/TestWebAppFixture.cs index 7de680890..641d13e7f 100644 --- a/test/Sample.Minimal.Tests/Helpers/TestWebAppFixture.cs +++ b/test/Sample.Minimal.Tests/Helpers/TestWebAppFixture.cs @@ -1,6 +1,6 @@ using Rocket.Surgery.LaunchPad.AspNetCore.Testing; using Sample.Core.Domain; -namespace Sample.Restful.Tests.Helpers; +namespace Sample.Minimal.Tests.Helpers; public class TestWebAppFixture() : LaunchPadWebAppFixture(new SqliteExtension()), IAsyncLifetime; diff --git a/test/Sample.Minimal.Tests/Helpers/WebAppFixtureTest.cs b/test/Sample.Minimal.Tests/Helpers/WebAppFixtureTest.cs index 58b759c1b..9b4756edd 100644 --- a/test/Sample.Minimal.Tests/Helpers/WebAppFixtureTest.cs +++ b/test/Sample.Minimal.Tests/Helpers/WebAppFixtureTest.cs @@ -1,10 +1,7 @@ using Alba; -using Microsoft.Extensions.Logging; using Rocket.Surgery.LaunchPad.AspNetCore.Testing; -using Serilog; -using Serilog.Events; -namespace Sample.Restful.Tests.Helpers; +namespace Sample.Minimal.Tests.Helpers; public abstract class WebAppFixtureTest(ITestOutputHelper outputHelper, TestWebAppFixture rocketSurgeryWebAppFixture) : LoggerTest(XUnitTestContext.Create(outputHelper)), IClassFixture, IAsyncLifetime where TAppFixture : class, ILaunchPadWebAppFixture diff --git a/test/Sample.Minimal.Tests/ModuleInitializer.cs b/test/Sample.Minimal.Tests/ModuleInitializer.cs index 431eb0939..26014a9aa 100644 --- a/test/Sample.Minimal.Tests/ModuleInitializer.cs +++ b/test/Sample.Minimal.Tests/ModuleInitializer.cs @@ -2,7 +2,7 @@ using DiffEngine; using Path = System.IO.Path; -namespace Sample.Restful.Tests; +namespace Sample.Minimal.Tests; internal static class ModuleInitializer { diff --git a/test/Sample.Minimal.Tests/RestfulConventionTests.cs b/test/Sample.Minimal.Tests/RestfulConventionTests.cs deleted file mode 100644 index 15166c94b..000000000 --- a/test/Sample.Minimal.Tests/RestfulConventionTests.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc.Controllers; -using Sample.Restful.Tests.Helpers; - -namespace Sample.Restful.Tests; - -public class RestfulConventionTests -{ - [Theory] - [ClassData(typeof(ApiDescriptionData))] - public void Should_Have_Success_Response_Types(ApiDescriptionData description) - { - description.Description.SupportedResponseTypes.Should().Contain(z => z.StatusCode >= 200 && z.StatusCode < 300); - } - - [Theory] - [ClassData(typeof(ApiDescriptionData))] - public void Should_Have_Not_Found_Responses(ApiDescriptionData description) - { - // ReSharper disable once NullableWarningSuppressionIsUsed - var method = ( description.Description.ActionDescriptor as ControllerActionDescriptor )!.MethodInfo; - if (method.ReturnType.IsGenericType && method.ReturnType.GetGenericTypeDefinition() == typeof(IAsyncEnumerable<>)) return; - description.Description.SupportedResponseTypes.Should().Contain(z => z.StatusCode == StatusCodes.Status404NotFound); - } - - [Theory] - [ClassData(typeof(ApiDescriptionData))] - public void Should_Have_Validation_Responses(ApiDescriptionData description) - { - description.Description.SupportedResponseTypes.Should().Contain(z => z.StatusCode == StatusCodes.Status422UnprocessableEntity); - } - - [Theory] - [ClassData(typeof(ApiDescriptionData))] - public void Should_Have_Bad_Request_Responses(ApiDescriptionData description) - { - description.Description.SupportedResponseTypes.Should().Contain(z => z.IsDefaultResponse); - } -} diff --git a/test/Sample.Minimal.Tests/Sample.Minimal.Tests.csproj b/test/Sample.Minimal.Tests/Sample.Minimal.Tests.csproj index f82d35b6f..9bffead80 100644 --- a/test/Sample.Minimal.Tests/Sample.Minimal.Tests.csproj +++ b/test/Sample.Minimal.Tests/Sample.Minimal.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/test/Sample.Minimal.Tests/SqliteConnectionService.cs b/test/Sample.Minimal.Tests/SqliteConnectionService.cs index c04e3d852..91197716d 100644 --- a/test/Sample.Minimal.Tests/SqliteConnectionService.cs +++ b/test/Sample.Minimal.Tests/SqliteConnectionService.cs @@ -2,7 +2,7 @@ using Rocket.Surgery.DependencyInjection; using Sample.Core.Domain; -namespace Sample.Restful.Tests; +namespace Sample.Minimal.Tests; internal sealed class SqliteConnectionService(IServiceProvider serviceProvider) : IHostedService { diff --git a/test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json b/test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json new file mode 100644 index 000000000..016173293 --- /dev/null +++ b/test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json @@ -0,0 +1,775 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Sample.Minimal | v1", + "version": "1.0.0" + }, + "paths": { + "/launch-records": { + "get": { + "tags": [ + "LaunchRecordEndpoints" + ], + "operationId": "ListLaunchRecords", + "parameters": [ + { + "name": "rocketType", + "in": "query", + "schema": { + "$ref": "#/components/schemas/NullableOfRocketType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + } + } + } + }, + "post": { + "tags": [ + "LaunchRecordEndpoints" + ], + "operationId": "CreateLaunchRecord", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Created", + "headers": { + "location": { + "description": "The location of the entity that was created", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordResponse" + } + } + } + }, + "400": { + "description": "Bad Request" + } + } + } + }, + "/launch-records/{id}": { + "get": { + "tags": [ + "LaunchRecordEndpoints" + ], + "operationId": "GetLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + }, + "404": { + "description": "Not Found" + } + } + }, + "put": { + "tags": [ + "LaunchRecordEndpoints" + ], + "operationId": "EditLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/LaunchRecordId2" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + }, + "404": { + "description": "Not Found" + }, + "400": { + "description": "Bad Request" + } + } + }, + "patch": { + "tags": [ + "LaunchRecordEndpoints" + ], + "operationId": "PatchLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/LaunchRecordId2" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordPatchRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + }, + "404": { + "description": "Not Found" + }, + "400": { + "description": "Bad Request" + } + } + }, + "delete": { + "tags": [ + "LaunchRecordEndpoints" + ], + "operationId": "DeleteLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/LaunchRecordId2" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found" + } + } + } + }, + "/rockets": { + "get": { + "tags": [ + "RocketEndpoints" + ], + "parameters": [ + { + "name": "rocketType", + "in": "query", + "schema": { + "$ref": "#/components/schemas/NullableOfRocketType" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + } + } + } + }, + "post": { + "tags": [ + "RocketEndpoints" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "Created", + "headers": { + "location": { + "description": "The location of the entity that was created", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketResponse" + } + } + } + }, + "400": { + "description": "Bad Request" + } + } + } + }, + "/rockets/{id}": { + "get": { + "tags": [ + "RocketEndpoints" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/RocketId2" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found" + } + } + }, + "put": { + "tags": [ + "RocketEndpoints" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/RocketId2" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found" + }, + "400": { + "description": "Bad Request" + } + } + }, + "patch": { + "tags": [ + "RocketEndpoints" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/RocketId2" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketPatchRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found" + }, + "400": { + "description": "Bad Request" + } + } + }, + "delete": { + "tags": [ + "RocketEndpoints" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/RocketId2" + } + } + ], + "responses": { + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found" + } + } + } + } + }, + "components": { + "schemas": { + "AssignedOfdouble": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "number", + "format": "double" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfInstant": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfNullableOfInstant": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfRocketId": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfRocketType": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketType" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfstring": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "string", + "nullable": true + }, + "hasValue": { + "type": "boolean" + } + } + }, + "CreateLaunchRecordRequest": { + "required": [ + "partner", + "rocketId", + "payload", + "scheduledLaunchDate" + ], + "type": "object", + "properties": { + "rocketId": { + "$ref": "#/components/schemas/Instant" + }, + "partner": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "payload": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "payloadWeightKg": { + "minimum": 0, + "type": "number", + "format": "double" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/Instant" + } + } + }, + "CreateLaunchRecordResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/LaunchRecordId" + } + } + }, + "CreateRocketRequest": { + "required": [ + "serialNumber" + ], + "type": "object", + "properties": { + "serialNumber": { + "maxLength": 30, + "minLength": 10, + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "CreateRocketResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + } + } + }, + "EditLaunchRecordPatchRequest": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + }, + "partner": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "payload": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "payloadWeightKg": { + "$ref": "#/components/schemas/AssignedOfdouble" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/AssignedOfNullableOfInstant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/AssignedOfInstant" + }, + "rocketId": { + "$ref": "#/components/schemas/AssignedOfRocketId" + } + } + }, + "EditLaunchRecordRequest": { + "required": [ + "id", + "partner", + "rocketId", + "payload", + "scheduledLaunchDate" + ], + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + }, + "partner": { + "minLength": 1, + "type": "string" + }, + "payload": { + "minLength": 1, + "type": "string" + }, + "payloadWeightKg": { + "minimum": 0, + "type": "number", + "format": "double" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/RocketId" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/RocketId" + }, + "rocketId": { + "$ref": "#/components/schemas/RocketId" + } + } + }, + "EditRocketPatchRequest": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + }, + "serialNumber": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "type": { + "$ref": "#/components/schemas/AssignedOfRocketType" + } + } + }, + "EditRocketRequest": { + "required": [ + "id", + "type", + "serialNumber" + ], + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + }, + "serialNumber": { + "maxLength": 30, + "minLength": 10, + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "Instant": { }, + "LaunchRecordId": { }, + "LaunchRecordId2": { + "type": "string", + "format": "uuid" + }, + "LaunchRecordModel": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Instant" + }, + "partner": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "payloadWeightKg": { + "type": "integer", + "format": "int64" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "rocketSerialNumber": { + "type": "string" + }, + "rocketType": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "NullableOfRocketType": { + "enum": [ + "falcon9", + "falconHeavy", + "atlasV", + null + ] + }, + "RocketId": { }, + "RocketId2": { + "type": "string", + "format": "uuid" + }, + "RocketModel": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + }, + "sn": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "RocketType": { + "enum": [ + "falcon9", + "falconHeavy", + "atlasV" + ] + } + } + }, + "tags": [ + { + "name": "LaunchRecordEndpoints" + }, + { + "name": "RocketEndpoints" + } + ] +} \ No newline at end of file diff --git a/test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt b/test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt deleted file mode 100644 index a7177e9bb..000000000 --- a/test/Sample.Minimal.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt +++ /dev/null @@ -1,1791 +0,0 @@ -{ - openapi: 3.0.1, - info: { - title: Sample.Restful | v1, - version: 1.0.0 - }, - paths: { - /LaunchRecord: { - get: { - tags: [ - LaunchRecord - ], - operationId: ListLaunchRecords, - parameters: [ - { - name: rocketType, - in: query, - schema: { - type: string - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - post: { - tags: [ - LaunchRecord - ], - operationId: CreateLaunchRecord, - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 201: { - description: Created, - headers: { - location: { - description: The location of the entity that was created, - schema: { - type: string - } - } - }, - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordResponse - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordResponse - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /LaunchRecord/{id}: { - get: { - tags: [ - LaunchRecord - ], - operationId: GetLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - put: { - tags: [ - LaunchRecord - ], - operationId: EditLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - patch: { - tags: [ - LaunchRecord - ], - operationId: PatchLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - delete: { - tags: [ - LaunchRecord - ], - operationId: DeleteLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket: { - get: { - tags: [ - Rocket - ], - operationId: ListRockets, - parameters: [ - { - name: rocketType, - in: query, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/RocketModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/RocketModel - } - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - post: { - tags: [ - Rocket - ], - operationId: CreateRocket, - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 201: { - description: Created, - headers: { - location: { - description: The location of the entity that was created, - schema: { - type: string - } - } - }, - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateRocketResponse - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateRocketResponse - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}: { - get: { - tags: [ - Rocket - ], - operationId: GetRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - put: { - tags: [ - Rocket - ], - operationId: EditRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - patch: { - tags: [ - Rocket - ], - operationId: PatchRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - delete: { - tags: [ - Rocket - ], - operationId: RemoveRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}/launch-records: { - get: { - tags: [ - Rocket - ], - operationId: GetRocketLaunchRecords, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}/launch-records/{launchRecordId}: { - get: { - tags: [ - Rocket - ], - operationId: GetRocketLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - }, - { - name: launchRecordId, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - } - }, - components: { - schemas: { - AssignedOfdouble: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - type: number, - format: double - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfInstant: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfNullableOfInstant: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfRocketId: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfRocketType: { - maxLength: 30, - minLength: 10, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketType - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfstring: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - type: string, - nullable: true - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfstring2: { - maxLength: 30, - minLength: 10, - required: [ - value - ], - type: object, - properties: { - value: { - type: string, - nullable: true - }, - hasValue: { - type: boolean - } - } - }, - CreateLaunchRecordRequest: { - required: [ - rocketId, - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate - ], - type: object, - properties: { - rocketId: { - $ref: #/components/schemas/Instant2 - }, - partner: { - minimum: 0, - minLength: 1, - type: string, - nullable: true - }, - payload: { - minimum: 0, - minLength: 1, - type: string, - nullable: true - }, - payloadWeightKg: { - minimum: 0, - type: number, - format: double - }, - actualLaunchDate: { - $ref: #/components/schemas/Instant2 - }, - scheduledLaunchDate: { - $ref: #/components/schemas/Instant2 - } - } - }, - CreateLaunchRecordResponse: { - type: object, - properties: { - id: { - $ref: #/components/schemas/LaunchRecordId - } - } - }, - CreateRocketRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - maxLength: 30, - minLength: 10, - type: string - }, - type: { - $ref: #/components/schemas/RocketType2 - } - } - }, - CreateRocketResponse: { - type: object, - properties: { - id: { - $ref: #/components/schemas/RocketId2 - } - } - }, - EditLaunchRecordPatchRequest: { - required: [ - id, - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate, - rocketId - ], - type: object, - properties: { - partner: { - $ref: #/components/schemas/AssignedOfstring - }, - payload: { - $ref: #/components/schemas/AssignedOfstring - }, - payloadWeightKg: { - $ref: #/components/schemas/AssignedOfdouble - }, - actualLaunchDate: { - $ref: #/components/schemas/AssignedOfNullableOfInstant - }, - scheduledLaunchDate: { - $ref: #/components/schemas/AssignedOfInstant - }, - rocketId: { - $ref: #/components/schemas/AssignedOfRocketId - } - } - }, - EditLaunchRecordRequest: { - required: [ - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate, - rocketId - ], - type: object, - properties: { - partner: { - minimum: 0, - minLength: 1, - type: string - }, - payload: { - minimum: 0, - minLength: 1, - type: string - }, - payloadWeightKg: { - minimum: 0, - type: number, - format: double - }, - actualLaunchDate: { - $ref: #/components/schemas/RocketId - }, - scheduledLaunchDate: { - $ref: #/components/schemas/RocketId - }, - rocketId: { - $ref: #/components/schemas/RocketId - } - } - }, - EditRocketPatchRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - $ref: #/components/schemas/AssignedOfstring2 - }, - type: { - $ref: #/components/schemas/AssignedOfRocketType - } - } - }, - EditRocketRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - maxLength: 30, - minLength: 10, - type: string - }, - type: { - $ref: #/components/schemas/RocketType2 - } - } - }, - Instant2: { - minimum: 0 - }, - LaunchRecordModel: { - type: object, - properties: { - id: { - $ref: #/components/schemas/Instant - }, - partner: { - type: string - }, - payload: { - type: string - }, - payloadWeightKg: { - type: integer, - format: int64 - }, - actualLaunchDate: { - $ref: #/components/schemas/Instant - }, - scheduledLaunchDate: { - $ref: #/components/schemas/Instant - }, - rocketSerialNumber: { - type: string - }, - rocketType: { - $ref: #/components/schemas/RocketType - } - } - }, - ProblemDetails: { - required: [ - type, - title, - status, - detail, - instance - ], - type: object, - properties: { - type: { - type: string, - nullable: true - }, - title: { - type: string, - nullable: true - }, - status: { - type: integer, - format: int32, - nullable: true - }, - detail: { - type: string, - nullable: true - }, - instance: { - type: string, - nullable: true - } - } - }, - RocketId: { - minimum: 0 - }, - RocketModel: { - type: object, - properties: { - id: { - $ref: #/components/schemas/RocketId2 - }, - sn: { - type: string - }, - type: { - $ref: #/components/schemas/RocketType - } - } - }, - RocketType: { - enum: [ - falcon9, - falconHeavy, - atlasV - ] - }, - RocketType2: { - maxLength: 30, - minLength: 10, - enum: [ - falcon9, - falconHeavy, - atlasV - ] - } - } - }, - tags: [ - { - name: LaunchRecord - }, - { - name: Rocket - } - ] -} \ No newline at end of file diff --git a/test/Sample.Restful.Tests/FoundationTests.cs b/test/Sample.Restful.Tests/FoundationTests.cs index 02a5fd05c..125b0a9b1 100644 --- a/test/Sample.Restful.Tests/FoundationTests.cs +++ b/test/Sample.Restful.Tests/FoundationTests.cs @@ -19,6 +19,6 @@ public async Task OpenApiDocument() { var response = await AlbaHost.Server.CreateClient().GetAsync("/openapi/v1.json"); var document = await response.Content.ReadAsStringAsync(); - await VerifyJson(document); + await Verify(document, extension: "json"); } } diff --git a/test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json b/test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json new file mode 100644 index 000000000..956fa5a31 --- /dev/null +++ b/test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.json @@ -0,0 +1,1734 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Sample.Restful | v1", + "version": "1.0.0" + }, + "paths": { + "/LaunchRecord": { + "get": { + "tags": [ + "LaunchRecord" + ], + "operationId": "ListLaunchRecords", + "parameters": [ + { + "name": "rocketType", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "post": { + "tags": [ + "LaunchRecord" + ], + "operationId": "CreateLaunchRecord", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "201": { + "description": "Created", + "headers": { + "location": { + "description": "The location of the entity that was created", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateLaunchRecordResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/LaunchRecord/{id}": { + "get": { + "tags": [ + "LaunchRecord" + ], + "operationId": "GetLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "put": { + "tags": [ + "LaunchRecord" + ], + "operationId": "EditLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "patch": { + "tags": [ + "LaunchRecord" + ], + "operationId": "PatchLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordPatchRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordPatchRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditLaunchRecordPatchRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "delete": { + "tags": [ + "LaunchRecord" + ], + "operationId": "DeleteLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "ListRockets", + "parameters": [ + { + "name": "rocketType", + "in": "query", + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RocketModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "post": { + "tags": [ + "Rocket" + ], + "operationId": "CreateRocket", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "201": { + "description": "Created", + "headers": { + "location": { + "description": "The location of the entity that was created", + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketResponse" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/CreateRocketResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket/{id}": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "GetRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "put": { + "tags": [ + "Rocket" + ], + "operationId": "EditRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditRocketRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "patch": { + "tags": [ + "Rocket" + ], + "operationId": "PatchRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketPatchRequest" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/EditRocketPatchRequest" + } + }, + "application/*+json": { + "schema": { + "$ref": "#/components/schemas/EditRocketPatchRequest" + } + } + }, + "required": true + }, + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/RocketModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Rocket" + ], + "operationId": "RemoveRocket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "204": { + "description": "No Content" + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket/{id}/launch-records": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "GetRocketLaunchRecords", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + }, + "text/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + }, + "/Rocket/{id}/launch-records/{launchRecordId}": { + "get": { + "tags": [ + "Rocket" + ], + "operationId": "GetRocketLaunchRecord", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "name": "launchRecordId", + "in": "path", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "default": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/LaunchRecordModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + }, + "text/json": { + "schema": { + "$ref": "#/components/schemas/FluentValidationProblemDetails" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "AssignedOfdouble": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "number", + "format": "double" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfInstant": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfNullableOfInstant": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfRocketId": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketId" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfRocketType": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "$ref": "#/components/schemas/RocketType" + }, + "hasValue": { + "type": "boolean" + } + } + }, + "AssignedOfstring": { + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "string", + "nullable": true + }, + "hasValue": { + "type": "boolean" + } + } + }, + "CreateLaunchRecordRequest": { + "required": [ + "partner", + "rocketId", + "payload", + "scheduledLaunchDate" + ], + "type": "object", + "properties": { + "rocketId": { + "$ref": "#/components/schemas/Instant" + }, + "partner": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "payload": { + "minLength": 1, + "type": "string", + "nullable": true + }, + "payloadWeightKg": { + "minimum": 0, + "type": "number", + "format": "double" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/Instant" + } + } + }, + "CreateLaunchRecordResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/LaunchRecordId" + } + } + }, + "CreateRocketRequest": { + "required": [ + "serialNumber" + ], + "type": "object", + "properties": { + "serialNumber": { + "maxLength": 30, + "minLength": 10, + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "CreateRocketResponse": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + } + } + }, + "EditLaunchRecordPatchRequest": { + "required": [ + "id" + ], + "type": "object", + "properties": { + "partner": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "payload": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "payloadWeightKg": { + "$ref": "#/components/schemas/AssignedOfdouble" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/AssignedOfNullableOfInstant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/AssignedOfInstant" + }, + "rocketId": { + "$ref": "#/components/schemas/AssignedOfRocketId" + } + } + }, + "EditLaunchRecordRequest": { + "required": [ + "partner", + "rocketId", + "payload", + "scheduledLaunchDate" + ], + "type": "object", + "properties": { + "partner": { + "minLength": 1, + "type": "string" + }, + "payload": { + "minLength": 1, + "type": "string" + }, + "payloadWeightKg": { + "minimum": 0, + "type": "number", + "format": "double" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/RocketId" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/RocketId" + }, + "rocketId": { + "$ref": "#/components/schemas/RocketId" + } + } + }, + "EditRocketPatchRequest": { + "type": "object", + "properties": { + "serialNumber": { + "$ref": "#/components/schemas/AssignedOfstring" + }, + "type": { + "$ref": "#/components/schemas/AssignedOfRocketType" + } + } + }, + "EditRocketRequest": { + "required": [ + "type", + "serialNumber" + ], + "type": "object", + "properties": { + "serialNumber": { + "maxLength": 30, + "minLength": 10, + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "FluentValidationProblemDetails": { }, + "Instant": { }, + "LaunchRecordId": { }, + "LaunchRecordModel": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/Instant" + }, + "partner": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "payloadWeightKg": { + "type": "integer", + "format": "int64" + }, + "actualLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "scheduledLaunchDate": { + "$ref": "#/components/schemas/Instant" + }, + "rocketSerialNumber": { + "type": "string" + }, + "rocketType": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "ProblemDetails": { + "required": [ + "type", + "title" + ], + "type": "object", + "properties": { + "type": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "status": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "instance": { + "type": "string", + "nullable": true + } + } + }, + "RocketId": { }, + "RocketModel": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/RocketId" + }, + "sn": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RocketType" + } + } + }, + "RocketType": { + "enum": [ + "falcon9", + "falconHeavy", + "atlasV" + ] + } + } + }, + "tags": [ + { + "name": "LaunchRecord" + }, + { + "name": "Rocket" + } + ] +} \ No newline at end of file diff --git a/test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt b/test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt deleted file mode 100644 index a7177e9bb..000000000 --- a/test/Sample.Restful.Tests/snapshots/FoundationTests.OpenApiDocument.verified.txt +++ /dev/null @@ -1,1791 +0,0 @@ -{ - openapi: 3.0.1, - info: { - title: Sample.Restful | v1, - version: 1.0.0 - }, - paths: { - /LaunchRecord: { - get: { - tags: [ - LaunchRecord - ], - operationId: ListLaunchRecords, - parameters: [ - { - name: rocketType, - in: query, - schema: { - type: string - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - post: { - tags: [ - LaunchRecord - ], - operationId: CreateLaunchRecord, - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 201: { - description: Created, - headers: { - location: { - description: The location of the entity that was created, - schema: { - type: string - } - } - }, - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordResponse - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateLaunchRecordResponse - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /LaunchRecord/{id}: { - get: { - tags: [ - LaunchRecord - ], - operationId: GetLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - put: { - tags: [ - LaunchRecord - ], - operationId: EditLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - patch: { - tags: [ - LaunchRecord - ], - operationId: PatchLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditLaunchRecordPatchRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - delete: { - tags: [ - LaunchRecord - ], - operationId: DeleteLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket: { - get: { - tags: [ - Rocket - ], - operationId: ListRockets, - parameters: [ - { - name: rocketType, - in: query, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/RocketModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/RocketModel - } - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - post: { - tags: [ - Rocket - ], - operationId: CreateRocket, - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/CreateRocketRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 201: { - description: Created, - headers: { - location: { - description: The location of the entity that was created, - schema: { - type: string - } - } - }, - content: { - application/json: { - schema: { - $ref: #/components/schemas/CreateRocketResponse - } - }, - text/json: { - schema: { - $ref: #/components/schemas/CreateRocketResponse - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}: { - get: { - tags: [ - Rocket - ], - operationId: GetRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - put: { - tags: [ - Rocket - ], - operationId: EditRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditRocketRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - patch: { - tags: [ - Rocket - ], - operationId: PatchRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - requestBody: { - content: { - application/json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - }, - text/json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - }, - application/*+json: { - schema: { - $ref: #/components/schemas/EditRocketPatchRequest - } - } - }, - required: true - }, - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/RocketModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - }, - delete: { - tags: [ - Rocket - ], - operationId: RemoveRocket, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 204: { - description: No Content - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}/launch-records: { - get: { - tags: [ - Rocket - ], - operationId: GetRocketLaunchRecords, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - }, - text/json: { - schema: { - type: array, - items: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - }, - /Rocket/{id}/launch-records/{launchRecordId}: { - get: { - tags: [ - Rocket - ], - operationId: GetRocketLaunchRecord, - parameters: [ - { - name: id, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - }, - { - name: launchRecordId, - in: path, - required: true, - schema: { - type: string, - format: uuid - } - } - ], - responses: { - default: { - description: , - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 200: { - description: OK, - content: { - application/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - }, - text/json: { - schema: { - $ref: #/components/schemas/LaunchRecordModel - } - } - } - }, - 404: { - description: Not Found, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 400: { - description: Bad Request, - content: { - application/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/ProblemDetails - } - } - } - }, - 422: { - description: Unprocessable Entity, - content: { - application/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - }, - text/json: { - schema: { - $ref: #/components/schemas/FluentValidationProblemDetails - } - } - } - } - } - } - } - }, - components: { - schemas: { - AssignedOfdouble: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - type: number, - format: double - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfInstant: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfNullableOfInstant: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfRocketId: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketId2 - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfRocketType: { - maxLength: 30, - minLength: 10, - required: [ - value - ], - type: object, - properties: { - value: { - $ref: #/components/schemas/RocketType - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfstring: { - minimum: 0, - required: [ - value - ], - type: object, - properties: { - value: { - type: string, - nullable: true - }, - hasValue: { - type: boolean - } - } - }, - AssignedOfstring2: { - maxLength: 30, - minLength: 10, - required: [ - value - ], - type: object, - properties: { - value: { - type: string, - nullable: true - }, - hasValue: { - type: boolean - } - } - }, - CreateLaunchRecordRequest: { - required: [ - rocketId, - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate - ], - type: object, - properties: { - rocketId: { - $ref: #/components/schemas/Instant2 - }, - partner: { - minimum: 0, - minLength: 1, - type: string, - nullable: true - }, - payload: { - minimum: 0, - minLength: 1, - type: string, - nullable: true - }, - payloadWeightKg: { - minimum: 0, - type: number, - format: double - }, - actualLaunchDate: { - $ref: #/components/schemas/Instant2 - }, - scheduledLaunchDate: { - $ref: #/components/schemas/Instant2 - } - } - }, - CreateLaunchRecordResponse: { - type: object, - properties: { - id: { - $ref: #/components/schemas/LaunchRecordId - } - } - }, - CreateRocketRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - maxLength: 30, - minLength: 10, - type: string - }, - type: { - $ref: #/components/schemas/RocketType2 - } - } - }, - CreateRocketResponse: { - type: object, - properties: { - id: { - $ref: #/components/schemas/RocketId2 - } - } - }, - EditLaunchRecordPatchRequest: { - required: [ - id, - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate, - rocketId - ], - type: object, - properties: { - partner: { - $ref: #/components/schemas/AssignedOfstring - }, - payload: { - $ref: #/components/schemas/AssignedOfstring - }, - payloadWeightKg: { - $ref: #/components/schemas/AssignedOfdouble - }, - actualLaunchDate: { - $ref: #/components/schemas/AssignedOfNullableOfInstant - }, - scheduledLaunchDate: { - $ref: #/components/schemas/AssignedOfInstant - }, - rocketId: { - $ref: #/components/schemas/AssignedOfRocketId - } - } - }, - EditLaunchRecordRequest: { - required: [ - partner, - payload, - payloadWeightKg, - actualLaunchDate, - scheduledLaunchDate, - rocketId - ], - type: object, - properties: { - partner: { - minimum: 0, - minLength: 1, - type: string - }, - payload: { - minimum: 0, - minLength: 1, - type: string - }, - payloadWeightKg: { - minimum: 0, - type: number, - format: double - }, - actualLaunchDate: { - $ref: #/components/schemas/RocketId - }, - scheduledLaunchDate: { - $ref: #/components/schemas/RocketId - }, - rocketId: { - $ref: #/components/schemas/RocketId - } - } - }, - EditRocketPatchRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - $ref: #/components/schemas/AssignedOfstring2 - }, - type: { - $ref: #/components/schemas/AssignedOfRocketType - } - } - }, - EditRocketRequest: { - required: [ - serialNumber, - type - ], - type: object, - properties: { - serialNumber: { - maxLength: 30, - minLength: 10, - type: string - }, - type: { - $ref: #/components/schemas/RocketType2 - } - } - }, - Instant2: { - minimum: 0 - }, - LaunchRecordModel: { - type: object, - properties: { - id: { - $ref: #/components/schemas/Instant - }, - partner: { - type: string - }, - payload: { - type: string - }, - payloadWeightKg: { - type: integer, - format: int64 - }, - actualLaunchDate: { - $ref: #/components/schemas/Instant - }, - scheduledLaunchDate: { - $ref: #/components/schemas/Instant - }, - rocketSerialNumber: { - type: string - }, - rocketType: { - $ref: #/components/schemas/RocketType - } - } - }, - ProblemDetails: { - required: [ - type, - title, - status, - detail, - instance - ], - type: object, - properties: { - type: { - type: string, - nullable: true - }, - title: { - type: string, - nullable: true - }, - status: { - type: integer, - format: int32, - nullable: true - }, - detail: { - type: string, - nullable: true - }, - instance: { - type: string, - nullable: true - } - } - }, - RocketId: { - minimum: 0 - }, - RocketModel: { - type: object, - properties: { - id: { - $ref: #/components/schemas/RocketId2 - }, - sn: { - type: string - }, - type: { - $ref: #/components/schemas/RocketType - } - } - }, - RocketType: { - enum: [ - falcon9, - falconHeavy, - atlasV - ] - }, - RocketType2: { - maxLength: 30, - minLength: 10, - enum: [ - falcon9, - falconHeavy, - atlasV - ] - } - } - }, - tags: [ - { - name: LaunchRecord - }, - { - name: Rocket - } - ] -} \ No newline at end of file