Skip to content

Commit 06d1a7f

Browse files
authored
Fix broken documentation in Steeltoe 4.x (#1653)
* Fix broken documentation in Steeltoe 4.x * Fix broken build (this branch uses an old Sonar version)
1 parent 3bd2f49 commit 06d1a7f

8 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/Configuration/src/Abstractions/CompositeConfigurationProvider.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ public void Set(string key, string? value)
9797

9898
LogSet(GetType().Name, key, value);
9999

100-
if (ConfigurationRoot != null)
101-
{
102-
ConfigurationRoot[key] = value;
103-
}
100+
#pragma warning disable S1121 // Assignments should not be made from within sub-expressions
101+
ConfigurationRoot?[key] = value;
102+
#pragma warning restore S1121 // Assignments should not be made from within sub-expressions
104103
}
105104

106105
public void Dispose()

src/Connectors/src/Connectors/DynamicTypeAccess/ConnectorFactoryShim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private static TypeAccessor MakeGenericTypeAccessor(Type connectionType)
6060

6161
public ConnectorShim<TOptions> Get(string serviceBindingName)
6262
{
63-
object instance = InstanceAccessor.InvokeMethodOverload(nameof(ConnectorFactory<TOptions, object>.Get), true, [typeof(string)], serviceBindingName)!;
63+
object instance = InstanceAccessor.InvokeMethodOverload(nameof(ConnectorFactory<,>.Get), true, [typeof(string)], serviceBindingName)!;
6464

6565
return new ConnectorShim<TOptions>(_connectionType, instance);
6666
}

src/Connectors/src/Connectors/DynamicTypeAccess/ConnectorShim.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private static InstanceAccessor CreateAccessor(Type connectionType, object insta
2525

2626
public object GetConnection()
2727
{
28-
return InstanceAccessor.InvokeMethod(nameof(Connector<TOptions, object>.GetConnection), true)!;
28+
return InstanceAccessor.InvokeMethod(nameof(Connector<,>.GetConnection), true)!;
2929
}
3030

3131
public void Dispose()

src/Discovery/src/Configuration/ConfigurationServiceCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static class ConfigurationServiceCollectionExtensions
1818
/// Build your list of service instances under the configuration prefix discovery:services.
1919
/// <example>
2020
/// Example configuration in appsettings.json:
21-
/// <![CDATA[
21+
/// <code><![CDATA[
2222
/// {
2323
/// "discovery": {
2424
/// "services": [
@@ -36,7 +36,7 @@ public static class ConfigurationServiceCollectionExtensions
3636
/// ]
3737
/// }
3838
/// }
39-
/// ]]>
39+
/// ]]></code>
4040
/// </example>
4141
/// </remarks>
4242
/// <param name="services">

src/Discovery/src/Eureka/AppInfo/ApplicationInfo.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public sealed class ApplicationInfo
1717
private readonly ConcurrentDictionary<string, InstanceInfo> _instanceMap = new();
1818

1919
public string Name { get; }
20-
public IReadOnlyList<InstanceInfo> Instances => new List<InstanceInfo>(_instanceMap.Values);
20+
public IReadOnlyList<InstanceInfo> Instances => GetInstancesSnapshot();
2121

2222
internal ApplicationInfo(string name)
2323
: this(name, Array.Empty<InstanceInfo>())
@@ -38,6 +38,11 @@ internal ApplicationInfo(string name, ICollection<InstanceInfo> instances)
3838
}
3939
}
4040

41+
private List<InstanceInfo> GetInstancesSnapshot()
42+
{
43+
return [.. _instanceMap.Values];
44+
}
45+
4146
internal InstanceInfo? GetInstance(string instanceId)
4247
{
4348
ArgumentException.ThrowIfNullOrWhiteSpace(instanceId);

src/Management/src/Endpoint/Actuators/Health/Availability/LivenessState.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ namespace Steeltoe.Management.Endpoint.Actuators.Health.Availability;
66

77
/// <summary>
88
/// "Liveness" state of the application.
9-
/// <para />
9+
/// <para>
1010
/// An application is considered live when it's running with a correct internal state. "Liveness" failure means that the internal state of the
1111
/// application is broken, and we cannot recover from it. As a result, the platform should restart the application.
12+
/// </para>
1213
/// </summary>
1314
public sealed class LivenessState : AvailabilityState
1415
{

src/Management/src/Endpoint/Actuators/Health/Availability/ReadinessState.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ namespace Steeltoe.Management.Endpoint.Actuators.Health.Availability;
66

77
/// <summary>
88
/// The Readiness state of the application.
9-
/// <para />
9+
/// <para>
1010
/// An application is considered ready when it's <see cref="LivenessState.Correct" /> and willing to accept traffic. "Readiness" failure means that the
1111
/// application is not able to accept traffic and that the infrastructure should not route requests to it.
12+
/// </para>
1213
/// </summary>
1314
public sealed class ReadinessState : AvailabilityState
1415
{

src/Management/src/Endpoint/Actuators/RouteMappings/AspNetEndpointProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private static IEnumerable<AspNetEndpoint> FromActuatorEndpoint(RouteEndpoint en
167167
if (endpointOptions != null)
168168
{
169169
string displayName = endpoint.DisplayName ?? string.Empty;
170-
MethodInfo handlerMethod = typeof(EndpointMiddleware<,>).GetMethod(nameof(EndpointMiddleware<object, object>.InvokeAsync))!;
170+
MethodInfo handlerMethod = typeof(EndpointMiddleware<,>).GetMethod(nameof(EndpointMiddleware<,>.InvokeAsync))!;
171171
var metadataProvider = endpoint.Metadata.GetMetadata<ActuatorMetadataProvider>()!;
172172

173173
foreach (string httpMethod in endpointOptions.GetSafeAllowedVerbs())

0 commit comments

Comments
 (0)