Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/all packages #1776

Merged
merged 7 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
/>
<PackageReference Include="Rocket.Surgery.MSBuild.SourceLink" IncludeAssets="analyzers;build;buildMultitargeting;buildTransitive" PrivateAssets="All" />
<PackageReference Include="Polyfill" IncludeAssets="analyzers;build;buildMultitargeting;buildTransitive" PrivateAssets="All" />
<!--
<PackageReference Include="Roslynator.Analyzers" IncludeAssets="analyzers;build;buildMultitargeting;buildTransitive" PrivateAssets="All" />
<PackageReference Include="Roslynator.Formatting.Analyzers" IncludeAssets="analyzers;build;buildMultitargeting;buildTransitive" PrivateAssets="All" />
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" IncludeAssets="analyzers;build;buildMultitargeting;buildTransitive" PrivateAssets="All" />
<PackageReference Include="Roslynator.CodeFixes" IncludeAssets="analyzers;build;buildMultitargeting;buildTransitive" PrivateAssets="All" />
<PackageReference Include="Roslynator.Refactorings" IncludeAssets="analyzers;build;buildMultitargeting;buildTransitive" PrivateAssets="All" />
-->
</ItemGroup>
</Project>
46 changes: 23 additions & 23 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,27 @@
<PackageVersion Include="Grpc.AspNetCore" Version="2.60.0" />
<PackageVersion Include="Humanizer.Core" Version="2.14.1" />
<PackageVersion Include="Hellang.Middleware.ProblemDetails" Version="6.5.1" />
<PackageVersion Include="HotChocolate" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Abstractions" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Data" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Diagnostics" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Execution.Abstractions" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Data.AutoMapper" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Data.EntityFramework" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Data.Spatial" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Types.Analyzers" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Types.CursorPagination" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Types.OffsetPagination" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Types.NodaTime" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate.Types.Spatial" Version="14.0.0-p.22" />
<PackageVersion Include="StrawberryShake.Transport.Http" Version="14.0.0-p.22" />
<PackageVersion Include="StrawberryShake" Version="14.0.0-p.22" />
<PackageVersion Include="StrawberryShake.Core" Version="14.0.0-p.22" />
<PackageVersion Include="StrawberryShake.Server" Version="14.0.0-p.22" />
<PackageVersion Include="StrawberryShake.Maui" Version="14.0.0-p.22" />
<PackageVersion Include="StrawberryShake.Blazor" Version="14.0.0-p.22" />
<PackageVersion Include="StrawberryShake.Razor" Version="14.0.0-p.22" />
<PackageVersion Include="HotChocolate" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Abstractions" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Data" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Diagnostics" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Execution.Abstractions" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Data.AutoMapper" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Data.EntityFramework" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Data.Spatial" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Types.Analyzers" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Types.CursorPagination" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Types.OffsetPagination" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Types.NodaTime" Version="14.0.0-p.29" />
<PackageVersion Include="HotChocolate.Types.Spatial" Version="14.0.0-p.29" />
<PackageVersion Include="StrawberryShake.Transport.Http" Version="14.0.0-p.29" />
<PackageVersion Include="StrawberryShake" Version="14.0.0-p.29" />
<PackageVersion Include="StrawberryShake.Core" Version="14.0.0-p.29" />
<PackageVersion Include="StrawberryShake.Server" Version="14.0.0-p.29" />
<PackageVersion Include="StrawberryShake.Maui" Version="14.0.0-p.29" />
<PackageVersion Include="StrawberryShake.Blazor" Version="14.0.0-p.29" />
<PackageVersion Include="StrawberryShake.Razor" Version="14.0.0-p.29" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
Expand Down Expand Up @@ -127,7 +127,7 @@
<PackageVersion Include="System.Reactive.Observable.Aliases" Version="6.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.0" />
<PackageVersion Include="System.Net.Http.Json" Version="8.0.0" />
<PackageVersion Include="NSwag.ApiDescription.Client" Version="13.20.0" />
<PackageVersion Include="NSwag.ApiDescription.Client" Version="14.0.2" />
<PackageVersion Include="Microsoft.Extensions.ApiDescription.Client" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.ApiDescription.Server" Version="8.0.0" />
<PackageVersion Include="OpenTelemetry" Version="1.7.0" />
Expand All @@ -151,7 +151,7 @@
<PackageVersion Include="xunit" Version="2.6.6" />
<PackageVersion Include="xunit.analyzers" Version="1.10.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageVersion Include="Verify.Xunit" Version="22.11.5" />
<PackageVersion Include="Verify.Xunit" Version="23.0.1" />
<PackageVersion Include="Verify.NodaTime" Version="2.1.0" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.2.0" />
</ItemGroup>
Expand Down
102 changes: 88 additions & 14 deletions sample/Sample.Restful.Client/Sample.Restful.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,93 @@
PrivateAssets="All"
ReferenceOutputAssembly="false"
OutputPath="client/$(TargetFramework)/Sample.RestfulClient.cs"
>
<Options
>/generateClientClasses:true /generateClientInterfaces:true /injectHttpClient:true /disposeHttpClient:false /generateExceptionClasses:true /wrapDtoExceptions:true /useBaseUrl:false /generateBaseUrlProperty:false /operationGenerationMode:"MultipleClientsFromFirstTagAndOperationId" /generateOptionalParameters:true /generateJsonMethods:false /enforceFlagEnums:true /parameterArrayType:"System.Collections.Generic.IEnumerable" /parameterDictionaryType:"System.Collections.Generic.IDictionary" /responseArrayType:"System.Collections.Generic.ICollection" /responseDictionaryType:"System.Collections.Generic.IDictionary" /wrapResponses:true /generateResponseClasses:true /responseClass:"Response" /requiredPropertiesMustBeDefined:false /dateType:"System.DateTimeOffset" /dateTimeType:"System.DateTimeOffset" /timeType:"System.TimeSpan" /timeSpanType:"System.TimeSpan" /arrayType:"System.Collections.ObjectModel.Collection" /arrayInstanceType:"System.Collections.ObjectModel.Collection" /dictionaryType:"System.Collections.Generic.IDictionary" /dictionaryInstanceType:"System.Collections.Generic.Dictionary" /arrayBaseType:"System.Collections.ObjectModel.Collection" /dictionaryBaseType:"System.Collections.Generic.Dictionary" /classStyle:"Poco" /generateDefaultValues:true /generateDataAnnotations:true /generateImmutableArrayProperties:true /generateImmutableDictionaryProperties:true /generateDtoTypes:true /generateOptionalPropertiesAsNullable:true</Options>
</OpenApiProjectReference>
</ItemGroup>

<!-- Hack to fix multi-targeting -->
<ItemGroup Condition="Exists('$(OpenApiCodeDirectory)\$(MSBuildProjectName).$(TargetFramework).cs') AND '$(OpenApiGenerateCodeOnBuild)'=='false'">
/>
</ItemGroup>
<Target
Name="_TieInGenerateOpenApiCodeHack"
BeforeTargets="BeforeCompile"
Condition="'$(OpenApiGenerateCodeOnBuild)'=='true'"
DependsOnTargets="GenerateOpenApiCode"
/>

<PropertyGroup>
<NSwagGenerateExceptionClasses>true</NSwagGenerateExceptionClasses>
<NSwagClientBaseClass />
<NSwagConfigurationClass />
<NSwagGenerateClientClasses>true</NSwagGenerateClientClasses>
<NSwagSuppressClientClassesOutput />
<NSwagGenerateClientInterfaces>true</NSwagGenerateClientInterfaces>
<NSwagSuppressClientInterfacesOutput />
<NSwagClientBaseInterface />
<NSwagInjectHttpClient>true</NSwagInjectHttpClient>
<NSwagDisposeHttpClient>false</NSwagDisposeHttpClient>
<NSwagProtectedMethods />
<NSwagExceptionClass />
<NSwagWrapDtoExceptions>true</NSwagWrapDtoExceptions>
<NSwagUseHttpClientCreationMethod />
<NSwagHttpClientType />
<NSwagUseHttpRequestMessageCreationMethod />
<NSwagUseBaseUrl>false</NSwagUseBaseUrl>
<NSwagGenerateBaseUrlProperty>false</NSwagGenerateBaseUrlProperty>
<NSwagGenerateSyncMethods />
<NSwagGeneratePrepareRequestAndProcessResponseAsAsyncMethods />
<NSwagExposeJsonSerializerSettings />
<NSwagClientClassAccessModifier />
<NSwagTypeAccessModifier />
<NSwagGenerateContractsOutput />
<NSwagContractsNamespace />
<NSwagParameterDateTimeFormat />
<NSwagParameterDateFormat />
<NSwagGenerateUpdateJsonSerializerSettingsMethod />
<NSwagUseRequestAndResponseSerializationSettings />
<NSwagSerializeTypeInformation />
<NSwagQueryNullValue />
<NSwagOperationGenerationMode>MultipleClientsFromFirstTagAndOperationId</NSwagOperationGenerationMode>
<NSwagAdditionalNamespaceUsages />
<NSwagAdditionalContractNamespaceUsages />
<NSwagGenerateOptionalParameters>true</NSwagGenerateOptionalParameters>
<NSwagGenerateJsonMethods>false</NSwagGenerateJsonMethods>
<NSwagEnforceFlagEnums>true</NSwagEnforceFlagEnums>
<NSwagParameterArrayType>System.Collections.Generic.IEnumerable</NSwagParameterArrayType>
<NSwagParameterDictionaryType>System.Collections.Generic.IReadOnlyDictionary</NSwagParameterDictionaryType>
<NSwagResponseArrayType>System.Collections.Generic.ICollection</NSwagResponseArrayType>
<NSwagResponseDictionaryType>System.Collections.Generic.IReadOnlyDictionary</NSwagResponseDictionaryType>
<NSwagWrapResponses>true</NSwagWrapResponses>
<NSwagWrapResponseMethods />
<NSwagGenerateResponseClasses>true</NSwagGenerateResponseClasses>
<NSwagResponseClass>Response</NSwagResponseClass>
<NSwagNamespace />
<NSwagRequiredPropertiesMustBeDefined>true</NSwagRequiredPropertiesMustBeDefined>
<!-- <NSwagDateType>NodaTime.LocalDate</NSwagDateType>-->
<NSwagJsonConverters />
<NSwagAnyType />
<!-- <NSwagDateTimeType>NodaTime.LocalDateTime</NSwagDateTimeType>-->
<!-- <NSwagTimeType>NodaTime.LocalTime</NSwagTimeType>-->
<!-- <NSwagTimeSpanType>NodaTime.Duration</NSwagTimeSpanType>-->
<NSwagArrayType>System.Collections.ObjectModel.Collection</NSwagArrayType>
<NSwagArrayInstanceType>System.Collections.ObjectModel.Collection</NSwagArrayInstanceType>
<NSwagDictionaryType>System.Collections.Generic.IDictionary</NSwagDictionaryType>
<NSwagDictionaryInstanceType>System.Collections.Generic.Dictionary</NSwagDictionaryInstanceType>
<NSwagArrayBaseType>System.Collections.ObjectModel.Collection</NSwagArrayBaseType>
<NSwagDictionaryBaseType>System.Collections.Generic.Dictionary</NSwagDictionaryBaseType>
<NSwagClassStyle>POCO</NSwagClassStyle>
<NSwagJsonLibrary />
<NSwagGenerateDefaultValues>true</NSwagGenerateDefaultValues>
<NSwagGenerateDataAnnotations>true</NSwagGenerateDataAnnotations>
<NSwagExcludedTypeNames />
<NSwagExcludedParameterNames />
<NSwagHandleReferences />
<NSwagGenerateImmutableArrayProperties>true</NSwagGenerateImmutableArrayProperties>
<NSwagGenerateImmutableDictionaryProperties>true</NSwagGenerateImmutableDictionaryProperties>
<NSwagJsonSerializerSettingsTransformationMethod />
<NSwagInlineNamedArrays />
<NSwagInlineNamedDictionaries />
<NSwagInlineNamedTuples />
<NSwagInlineNamedAny />
<NSwagGenerateDtoTypes>true</NSwagGenerateDtoTypes>
<NSwagGenerateOptionalPropertiesAsNullable>true</NSwagGenerateOptionalPropertiesAsNullable>
<NSwagGenerateNullableReferenceTypes>true</NSwagGenerateNullableReferenceTypes>
<NSwagTemplateDirectory />
<NSwagTypeNameGeneratorType />
<NSwagPropertyNameGeneratorType />
<NSwagEnumNameGeneratorType />
<NSwagServiceHost />
<NSwagServiceSchemes />
<NSwagOutput />
<NSwagNewLineBehavior />
</PropertyGroup>
</Project>
28 changes: 15 additions & 13 deletions src/AspNetCore.Blazor/Validation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Rocket.Surgery.LaunchPad.AspNetCore.Blazor;
/// </summary>
public class FluentValidator : ComponentBase
{
private static readonly char[] _separators = { '.', '[' };
private static readonly char[] _separators = { '.', '[', };

private static FieldIdentifier ToFieldIdentifier(EditContext editContext, string propertyPath)
{
Expand All @@ -30,14 +30,14 @@ private static FieldIdentifier ToFieldIdentifier(EditContext editContext, string
var nextTokenEnd = propertyPath.IndexOfAny(_separators);
if (nextTokenEnd < 0)
{
return new FieldIdentifier(obj, propertyPath);
return new(obj, propertyPath);
}

var nextToken = propertyPath.Substring(0, nextTokenEnd);
propertyPath = propertyPath.Substring(nextTokenEnd + 1);

object? newObj;
if (nextToken.EndsWith("]", StringComparison.OrdinalIgnoreCase))
if (nextToken.EndsWith(']'))
{
// It's an indexer
// This code assumes C# conventions (one indexer named Item with one param)
Expand All @@ -46,7 +46,7 @@ private static FieldIdentifier ToFieldIdentifier(EditContext editContext, string
var prop = obj.GetType().GetProperty("Item")!;
var indexerType = prop.GetIndexParameters()[0].ParameterType;
var indexerValue = Convert.ChangeType(nextToken, indexerType, CultureInfo.InvariantCulture);
newObj = prop.GetValue(obj, new[] { indexerValue });
newObj = prop.GetValue(obj, new[] { indexerValue, });
}
else
{
Expand All @@ -63,7 +63,7 @@ private static FieldIdentifier ToFieldIdentifier(EditContext editContext, string
if (newObj == null)
{
// This is as far as we can go
return new FieldIdentifier(obj, nextToken);
return new(obj, nextToken);
}

obj = newObj;
Expand Down Expand Up @@ -113,8 +113,8 @@ private static async void ValidateField(
{
if (validator != null)
{
var properties = new[] { fieldIdentifier.FieldName };
var context = new ValidationContext<object>(fieldIdentifier.Model, new PropertyChain(), new MemberNameValidatorSelector(properties));
var properties = new[] { fieldIdentifier.FieldName, };
var context = new ValidationContext<object>(fieldIdentifier.Model, new(), new MemberNameValidatorSelector(properties));
var validationResults = await validator.ValidateAsync(context);

messages.Clear(fieldIdentifier);
Expand All @@ -133,23 +133,25 @@ private static async void ValidateField(
public IValidator? Validator { get; set; } = null!;

// ReSharper disable once NullableWarningSuppressionIsUsed
[Inject] private IServiceProvider Services { get; set; } = null!;
[Inject]
private IServiceProvider Services { get; set; } = null!;

// ReSharper disable once NullableWarningSuppressionIsUsed
[CascadingParameter] private EditContext CurrentEditContext { get; set; } = null!;
[CascadingParameter]
private EditContext CurrentEditContext { get; set; } = null!;

/// <inheritdoc />
protected override void OnInitialized()
{
if (CurrentEditContext == null)
{
throw new InvalidOperationException(
$"{nameof(FluentValidator)} requires a cascading " +
$"parameter of type {nameof(EditContext)}. For example, you can use {nameof(FluentValidator)} " +
$"inside an {nameof(EditForm)}."
$"{nameof(FluentValidator)} requires a cascading "
+ $"parameter of type {nameof(EditContext)}. For example, you can use {nameof(FluentValidator)} "
+ $"inside an {nameof(EditForm)}."
);
}

AddFluentValidation(Validator, CurrentEditContext, Services);
}
}
}
Loading
Loading