Skip to content

Commit 204074c

Browse files
committed
Mark AddOpenApiForJsonApi with [Experimental]
1 parent d81abed commit 204074c

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

docs/usage/openapi.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Exposing an [OpenAPI document](https://swagger.io/specification/) for your JSON:
77
The [JsonApiDotNetCore.OpenApi.Swashbuckle](https://github.com/json-api-dotnet/JsonApiDotNetCore/pkgs/nuget/JsonApiDotNetCore.OpenApi.Swashbuckle) NuGet package
88
provides OpenAPI support for JSON:API by integrating with [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle.AspNetCore).
99

10+
> [!WARNING]
11+
> OpenAPI support for JSON:API is currently experimental. The API and the structure of the OpenAPI document may change in future versions.
12+
1013
## Getting started
1114

1215
1. Install the `JsonApiDotNetCore.OpenApi.Swashbuckle` NuGet package:

src/Examples/JsonApiDotNetCoreExample/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ static void ConfigureServices(WebApplicationBuilder builder)
7979

8080
using (CodeTimingSessionManager.Current.Measure("AddOpenApiForJsonApi()"))
8181
{
82+
#pragma warning disable JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
8283
builder.Services.AddOpenApiForJsonApi(options => options.DocumentFilter<SetOpenApiServerAtBuildTimeFilter>());
84+
#pragma warning restore JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
8385
}
8486
}
8587

src/JsonApiDotNetCore.OpenApi.Swashbuckle/ServiceCollectionExtensions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics.CodeAnalysis;
12
using JsonApiDotNetCore.OpenApi.Swashbuckle.JsonApiMetadata;
23
using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators;
34
using JsonApiDotNetCore.OpenApi.Swashbuckle.SchemaGenerators.Bodies;
@@ -18,17 +19,18 @@ public static class ServiceCollectionExtensions
1819
/// <summary>
1920
/// Configures OpenAPI for JsonApiDotNetCore using Swashbuckle.
2021
/// </summary>
21-
public static void AddOpenApiForJsonApi(this IServiceCollection services, Action<SwaggerGenOptions>? setupSwaggerGenAction = null)
22+
[Experimental("JADNC_OA_001", UrlFormat = "https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/openapi/docs/usage/openapi.md")]
23+
public static void AddOpenApiForJsonApi(this IServiceCollection services, Action<SwaggerGenOptions>? configureSwaggerGenOptions = null)
2224
{
2325
ArgumentNullException.ThrowIfNull(services);
2426

2527
AddCustomApiExplorer(services);
2628
AddCustomSwaggerComponents(services);
2729
AddSwaggerGenerator(services);
2830

29-
if (setupSwaggerGenAction != null)
31+
if (configureSwaggerGenOptions != null)
3032
{
31-
services.Configure(setupSwaggerGenAction);
33+
services.Configure(configureSwaggerGenOptions);
3234
}
3335
}
3436

test/OpenApiTests/OpenApiStartup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ public override void ConfigureServices(IServiceCollection services)
1515
{
1616
base.ConfigureServices(services);
1717

18+
#pragma warning disable JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
1819
services.AddOpenApiForJsonApi(SetupSwaggerGenAction);
20+
#pragma warning restore JADNC_OA_001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
1921
}
2022

2123
protected override void SetJsonApiOptions(JsonApiOptions options)

0 commit comments

Comments
 (0)