Skip to content

Commit 20c16b2

Browse files
Copilotcaptainsafia
andcommitted
Fix JsonPatchDocument review feedback
Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
1 parent 7548949 commit 20c16b2

File tree

5 files changed

+6
-12
lines changed

5 files changed

+6
-12
lines changed

src/Features/JsonPatch.SystemTextJson/src/JsonPatchDocument.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,11 @@ IList<Operation> IJsonPatchDocument.GetOperations()
227227
/// </summary>
228228
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
229229
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
230-
#pragma warning disable RS0016 // Add public types and members to the declared API
231230
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
232-
#pragma warning restore RS0016 // Add public types and members to the declared API
233231
{
234232
ArgumentNullException.ThrowIfNull(parameter);
235233
ArgumentNullException.ThrowIfNull(builder);
236234

237-
builder.Metadata.Add(new AcceptsMetadata(new[] { "application/json-patch+json" }, parameter.ParameterType));
235+
builder.Metadata.Add(new AcceptsMetadata(["application/json-patch+json"], parameter.ParameterType));
238236
}
239237
}

src/Features/JsonPatch.SystemTextJson/src/JsonPatchDocumentOfT.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,14 +664,12 @@ IList<Operation> IJsonPatchDocument.GetOperations()
664664
/// </summary>
665665
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
666666
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
667-
#pragma warning disable RS0016 // Add public types and members to the declared API
668667
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
669-
#pragma warning restore RS0016 // Add public types and members to the declared API
670668
{
671669
ArgumentNullException.ThrowIfNull(parameter);
672670
ArgumentNullException.ThrowIfNull(builder);
673671

674-
builder.Metadata.Add(new AcceptsMetadata(new[] { "application/json-patch+json" }, parameter.ParameterType));
672+
builder.Metadata.Add(new AcceptsMetadata(["application/json-patch+json"], typeof(TModel)));
675673
}
676674

677675
// Internal for testing

src/Features/JsonPatch.SystemTextJson/src/PublicAPI.Unshipped.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Microsoft.AspNetCore.JsonPatch.SystemTextJson.Exceptions.JsonPatchException.Json
66
Microsoft.AspNetCore.JsonPatch.SystemTextJson.IJsonPatchDocument
77
Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument
88
Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.JsonPatchDocument() -> void
9+
Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.PopulateMetadata(System.Reflection.ParameterInfo parameter, Microsoft.AspNetCore.Builder.EndpointBuilder builder) -> void
910
Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>.JsonPatchDocument() -> void
1011
Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchError
1112
Microsoft.AspNetCore.JsonPatch.SystemTextJson.Operations.Operation
@@ -52,6 +53,7 @@ Microsoft.AspNetCore.JsonPatch.SystemTextJson.Operations.OperationType.Test = 5
5253
~Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.SerializerOptions.set -> void
5354
~Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.Test(string path, object value) -> Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument
5455
~Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>
56+
~Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>.PopulateMetadata(System.Reflection.ParameterInfo parameter, Microsoft.AspNetCore.Builder.EndpointBuilder builder) -> void
5557
~Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>.Add<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>> path, TProp value) -> Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>
5658
~Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>.Add<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, System.Collections.Generic.IList<TProp>>> path, TProp value, int position) -> Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>
5759
~Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>.Add<TProp>(System.Linq.Expressions.Expression<System.Func<TModel, TProp>> path, TProp value) -> Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument<TModel>

src/Features/JsonPatch/src/JsonPatchDocument.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,12 @@ IList<Operation> IJsonPatchDocument.GetOperations()
235235
/// </summary>
236236
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
237237
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
238-
#pragma warning disable RS0016 // Add public types and members to the declared API
239238
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
240-
#pragma warning restore RS0016 // Add public types and members to the declared API
241239
{
242240
ArgumentNullException.ThrowIfNull(parameter);
243241
ArgumentNullException.ThrowIfNull(builder);
244242

245-
builder.Metadata.Add(new AcceptsMetadata(new[] { "application/json-patch+json" }, parameter.ParameterType));
243+
builder.Metadata.Add(new AcceptsMetadata(["application/json-patch+json"], parameter.ParameterType));
246244
}
247245
#endif
248246
}

src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,14 +672,12 @@ IList<Operation> IJsonPatchDocument.GetOperations()
672672
/// </summary>
673673
/// <param name="parameter">The <see cref="ParameterInfo"/> for the endpoint parameter.</param>
674674
/// <param name="builder">The endpoint builder for the endpoint being constructed.</param>
675-
#pragma warning disable RS0016 // Add public types and members to the declared API
676675
public static void PopulateMetadata(ParameterInfo parameter, EndpointBuilder builder)
677-
#pragma warning restore RS0016 // Add public types and members to the declared API
678676
{
679677
ArgumentNullException.ThrowIfNull(parameter);
680678
ArgumentNullException.ThrowIfNull(builder);
681679

682-
builder.Metadata.Add(new AcceptsMetadata(new[] { "application/json-patch+json" }, parameter.ParameterType));
680+
builder.Metadata.Add(new AcceptsMetadata(["application/json-patch+json"], typeof(TModel)));
683681
}
684682
#endif
685683

0 commit comments

Comments
 (0)