Skip to content

Commit

Permalink
Post-merge fixes and package updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bkoelman committed Dec 24, 2024
1 parent f69cc54 commit df14313
Show file tree
Hide file tree
Showing 87 changed files with 267 additions and 1,304 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"rollForward": false
},
"microsoft.openapi.kiota": {
"version": "1.19.1",
"version": "1.21.0",
"commands": [
"kiota"
],
Expand Down
10 changes: 5 additions & 5 deletions package-versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
<CodeAnalysisFrozenVersion>4.1.0</CodeAnalysisFrozenVersion>
<DemystifierFrozenVersion>0.4.1</DemystifierFrozenVersion>
<HumanizerFrozenVersion>2.14.1</HumanizerFrozenVersion>
<SwashbuckleFrozenVersion>6.8.1</SwashbuckleFrozenVersion>
<SwashbuckleFrozenVersion>7.2.0</SwashbuckleFrozenVersion>
<NewtonsoftJsonFrozenVersion>13.0.3</NewtonsoftJsonFrozenVersion>

<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
<ApiDescriptionServerVersion>8.0.*</ApiDescriptionServerVersion>
<BenchmarkDotNetVersion>0.14.*</BenchmarkDotNetVersion>
<BlushingPenguinVersion>1.0.*</BlushingPenguinVersion>
<BogusVersion>35.6.*</BogusVersion>
Expand All @@ -19,11 +18,12 @@
<GitHubActionsTestLoggerVersion>2.4.*</GitHubActionsTestLoggerVersion>
<InheritDocVersion>2.0.*</InheritDocVersion>
<KiotaVersion>1.*</KiotaVersion>
<MicrosoftApiClientVersion>8.0.*</MicrosoftApiClientVersion>
<NSwagApiClientVersion>14.1.*</NSwagApiClientVersion>
<MicrosoftApiClientVersion>9.0.*</MicrosoftApiClientVersion>
<MicrosoftApiServerVersion>9.0.*</MicrosoftApiServerVersion>
<NSwagApiClientVersion>14.2.*</NSwagApiClientVersion>
<NewtonsoftJsonVersion>13.0.*</NewtonsoftJsonVersion>
<SourceLinkVersion>8.0.*</SourceLinkVersion>
<SwashbuckleVersion>6.*-*</SwashbuckleVersion>
<SwashbuckleVersion>7.*-*</SwashbuckleVersion>
<SystemTextJsonVersion>9.0.*</SystemTextJsonVersion>
<TestSdkVersion>17.12.*</TestSdkVersion>
<XunitVersion>2.9.*</XunitVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="$(ApiDescriptionServerVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server" Version="$(MicrosoftApiServerVersion)" PrivateAssets="all" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand All @@ -20,6 +20,10 @@
<PackageReference Include="Microsoft.Kiota.Serialization.Text" Version="$(KiotaVersion)" />
</ItemGroup>

<Target Name="KiotaRestoreTool" BeforeTargets="ExcludeKiotaGeneratedCode" Condition="$(DesignTimeBuild) != true And $(BuildingProject) == true">
<Exec Command="dotnet tool restore" />
</Target>

<Target Name="ExcludeKiotaGeneratedCode" BeforeTargets="BeforeCompile;CoreCompile" Condition="$(DesignTimeBuild) != true And $(BuildingProject) == true">
<ItemGroup>
<Compile Remove="**\GeneratedCode\**\*.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<!-- TargetFrameworks does not work, see https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/2706 -->
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
Expand Down
8 changes: 4 additions & 4 deletions src/JsonApiDotNetCore.OpenApi.Client.NSwag/ApiResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ApiResponse(int statusCode, IReadOnlyDictionary<string, IEnumerable
public static async Task<TResponse?> TranslateAsync<TResponse>(Func<Task<TResponse>> operation)
where TResponse : class
{
ArgumentGuard.NotNull(operation);
ArgumentNullException.ThrowIfNull(operation);

try
{
Expand All @@ -27,7 +27,7 @@ public class ApiResponse(int statusCode, IReadOnlyDictionary<string, IEnumerable

public static async Task TranslateAsync(Func<Task> operation)
{
ArgumentGuard.NotNull(operation);
ArgumentNullException.ThrowIfNull(operation);

try
{
Expand All @@ -42,7 +42,7 @@ public static async Task TranslateAsync(Func<Task> operation)
public static async Task<ApiResponse<TResult?>> TranslateAsync<TResult>(Func<Task<ApiResponse<TResult>>> operation)
where TResult : class
{
ArgumentGuard.NotNull(operation);
ArgumentNullException.ThrowIfNull(operation);

try
{
Expand All @@ -57,7 +57,7 @@ public static async Task TranslateAsync(Func<Task> operation)

public static async Task<ApiResponse> TranslateAsync(Func<Task<ApiResponse>> operation)
{
ArgumentGuard.NotNull(operation);
ArgumentNullException.ThrowIfNull(operation);

try
{
Expand Down
18 changes: 0 additions & 18 deletions src/JsonApiDotNetCore.OpenApi.Client.NSwag/ArgumentGuard.cs

This file was deleted.

30 changes: 15 additions & 15 deletions src/JsonApiDotNetCore.OpenApi.Client.NSwag/JsonApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract class JsonApiClient : IJsonApiClient
/// </summary>
protected void SetSerializerSettingsForJsonApi(JsonSerializerSettings settings)
{
ArgumentGuard.NotNull(settings);
ArgumentNullException.ThrowIfNull(settings);

settings.Converters.Add(_documentJsonConverter);
}
Expand All @@ -27,8 +27,8 @@ public IDisposable WithPartialAttributeSerialization<TRequestDocument, TAttribut
params Expression<Func<TAttributesObject, object?>>[] alwaysIncludedAttributeSelectors)
where TRequestDocument : class
{
ArgumentGuard.NotNull(requestDocument);
ArgumentGuard.NotNull(alwaysIncludedAttributeSelectors);
ArgumentNullException.ThrowIfNull(requestDocument);
ArgumentNullException.ThrowIfNull(alwaysIncludedAttributeSelectors);

HashSet<string> attributeNames = [];

Expand Down Expand Up @@ -79,8 +79,8 @@ private sealed class DocumentRegistrationScope : IDisposable

public DocumentRegistrationScope(DocumentJsonConverter documentJsonConverter, object document)
{
ArgumentGuard.NotNull(documentJsonConverter);
ArgumentGuard.NotNull(document);
ArgumentNullException.ThrowIfNull(documentJsonConverter);
ArgumentNullException.ThrowIfNull(document);

_documentJsonConverter = documentJsonConverter;
_document = document;
Expand All @@ -102,8 +102,8 @@ private sealed class AlwaysIncludedAttributes

public AlwaysIncludedAttributes(HashSet<string> propertyNames, Type attributesObjectType)
{
ArgumentGuard.NotNull(propertyNames);
ArgumentGuard.NotNull(attributesObjectType);
ArgumentNullException.ThrowIfNull(propertyNames);
ArgumentNullException.ThrowIfNull(attributesObjectType);

_propertyNames = propertyNames;
_attributesObjectType = attributesObjectType;
Expand Down Expand Up @@ -162,7 +162,7 @@ public void UnRegisterDocument(object document)

public override bool CanConvert(Type objectType)
{
ArgumentGuard.NotNull(objectType);
ArgumentNullException.ThrowIfNull(objectType);

if (_isSerializing)
{
Expand All @@ -180,8 +180,8 @@ public override object ReadJson(JsonReader reader, Type objectType, object? exis

public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
ArgumentGuard.NotNull(writer);
ArgumentGuard.NotNull(serializer);
ArgumentNullException.ThrowIfNull(writer);
ArgumentNullException.ThrowIfNull(serializer);

if (value != null)
{
Expand Down Expand Up @@ -216,14 +216,14 @@ private sealed class AttributesJsonConverter : JsonConverter

public AttributesJsonConverter(AlwaysIncludedAttributes alwaysIncludedAttributes)
{
ArgumentGuard.NotNull(alwaysIncludedAttributes);
ArgumentNullException.ThrowIfNull(alwaysIncludedAttributes);

_alwaysIncludedAttributes = alwaysIncludedAttributes;
}

public override bool CanConvert(Type objectType)
{
ArgumentGuard.NotNull(objectType);
ArgumentNullException.ThrowIfNull(objectType);

if (_isSerializing)
{
Expand All @@ -241,8 +241,8 @@ public override object ReadJson(JsonReader reader, Type objectType, object? exis

public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
ArgumentGuard.NotNull(writer);
ArgumentGuard.NotNull(serializer);
ArgumentNullException.ThrowIfNull(writer);
ArgumentNullException.ThrowIfNull(serializer);

if (value != null)
{
Expand Down Expand Up @@ -322,7 +322,7 @@ private sealed class JsonApiAttributeContractResolver : DefaultContractResolver

public JsonApiAttributeContractResolver(AlwaysIncludedAttributes alwaysIncludedAttributes)
{
ArgumentGuard.NotNull(alwaysIncludedAttributes);
ArgumentNullException.ThrowIfNull(alwaysIncludedAttributes);

_alwaysIncludedAttributes = alwaysIncludedAttributes;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ internal static class ActionDescriptorExtensions
{
public static MethodInfo GetActionMethod(this ActionDescriptor descriptor)
{
ArgumentGuard.NotNull(descriptor);
ArgumentNullException.ThrowIfNull(descriptor);

return ((ControllerActionDescriptor)descriptor).MethodInfo;
}

public static TFilterMetaData? GetFilterMetadata<TFilterMetaData>(this ActionDescriptor descriptor)
where TFilterMetaData : IFilterMetadata
{
ArgumentGuard.NotNull(descriptor);
ArgumentNullException.ThrowIfNull(descriptor);

return descriptor.FilterDescriptors.Select(filterDescriptor => filterDescriptor.Filter).OfType<TFilterMetaData>().FirstOrDefault();
}

public static ControllerParameterDescriptor? GetBodyParameterDescriptor(this ActionDescriptor descriptor)
{
ArgumentGuard.NotNull(descriptor);
ArgumentNullException.ThrowIfNull(descriptor);

return (ControllerParameterDescriptor?)descriptor.Parameters.FirstOrDefault(parameterDescriptor =>
parameterDescriptor.BindingInfo?.BindingSource == BindingSource.Body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ internal sealed class ConfigureMvcOptions : IConfigureOptions<MvcOptions>
public ConfigureMvcOptions(IJsonApiRoutingConvention jsonApiRoutingConvention, OpenApiEndpointConvention openApiEndpointConvention,
JsonApiRequestFormatMetadataProvider jsonApiRequestFormatMetadataProvider)
{
ArgumentGuard.NotNull(jsonApiRoutingConvention);
ArgumentGuard.NotNull(openApiEndpointConvention);
ArgumentGuard.NotNull(jsonApiRequestFormatMetadataProvider);
ArgumentNullException.ThrowIfNull(jsonApiRoutingConvention);
ArgumentNullException.ThrowIfNull(openApiEndpointConvention);
ArgumentNullException.ThrowIfNull(jsonApiRequestFormatMetadataProvider);

_jsonApiRoutingConvention = jsonApiRoutingConvention;
_openApiEndpointConvention = openApiEndpointConvention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ internal sealed class ConfigureSwaggerGenOptions : IConfigureOptions<SwaggerGenO
public ConfigureSwaggerGenOptions(OpenApiOperationIdSelector operationIdSelector, JsonApiSchemaIdSelector schemaIdSelector,
IControllerResourceMapping controllerResourceMapping, IResourceGraph resourceGraph)
{
ArgumentGuard.NotNull(operationIdSelector);
ArgumentGuard.NotNull(schemaIdSelector);
ArgumentGuard.NotNull(controllerResourceMapping);
ArgumentGuard.NotNull(resourceGraph);
ArgumentNullException.ThrowIfNull(operationIdSelector);
ArgumentNullException.ThrowIfNull(schemaIdSelector);
ArgumentNullException.ThrowIfNull(controllerResourceMapping);
ArgumentNullException.ThrowIfNull(resourceGraph);

_operationIdSelector = operationIdSelector;
_schemaIdSelector = schemaIdSelector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal sealed class IncludeDependencyScanner
/// </summary>
public IReadOnlySet<ResourceType> GetReachableRelatedTypes(ResourceType resourceType)
{
ArgumentGuard.NotNull(resourceType);
ArgumentNullException.ThrowIfNull(resourceType);

HashSet<ResourceType> resourceTypesFound = [];
AddTypesFromRelationships(resourceType.Relationships, resourceTypesFound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ internal sealed class JsonApiActionDescriptorCollectionProvider : IActionDescrip
public JsonApiActionDescriptorCollectionProvider(IActionDescriptorCollectionProvider defaultProvider,
JsonApiEndpointMetadataProvider jsonApiEndpointMetadataProvider)
{
ArgumentGuard.NotNull(defaultProvider);
ArgumentGuard.NotNull(jsonApiEndpointMetadataProvider);
ArgumentNullException.ThrowIfNull(defaultProvider);
ArgumentNullException.ThrowIfNull(jsonApiEndpointMetadataProvider);

_defaultProvider = defaultProvider;
_jsonApiEndpointMetadataProvider = jsonApiEndpointMetadataProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private EndpointResolver()

public JsonApiEndpoints GetEndpoint(MethodInfo controllerAction)
{
ArgumentGuard.NotNull(controllerAction);
ArgumentNullException.ThrowIfNull(controllerAction);

if (!IsJsonApiController(controllerAction))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ internal sealed class JsonApiEndpointMetadataProvider

public JsonApiEndpointMetadataProvider(IControllerResourceMapping controllerResourceMapping, NonPrimaryDocumentTypeFactory nonPrimaryDocumentTypeFactory)
{
ArgumentGuard.NotNull(controllerResourceMapping);
ArgumentGuard.NotNull(nonPrimaryDocumentTypeFactory);
ArgumentNullException.ThrowIfNull(controllerResourceMapping);
ArgumentNullException.ThrowIfNull(nonPrimaryDocumentTypeFactory);

_controllerResourceMapping = controllerResourceMapping;
_nonPrimaryDocumentTypeFactory = nonPrimaryDocumentTypeFactory;
}

public JsonApiEndpointMetadataContainer Get(MethodInfo controllerAction)
{
ArgumentGuard.NotNull(controllerAction);
ArgumentNullException.ThrowIfNull(controllerAction);

if (EndpointResolver.Instance.IsAtomicOperationsController(controllerAction))
{
Expand Down
Loading

0 comments on commit df14313

Please sign in to comment.