< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 1
Coverable lines: 1
Total lines: 25
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Attributes/JsonRequiredAttribute.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Text.Json.Serialization.Metadata;
 5
 6namespace System.Text.Json.Serialization
 7{
 8    /// <summary>
 9    /// Indicates that the annotated member must bind to a JSON property on deserialization.
 10    /// </summary>
 11    /// <remarks>
 12    /// <see langword="null"/> token in JSON will not trigger a validation error.
 13    /// For contracts originating from <see cref="DefaultJsonTypeInfoResolver"/> or <see cref="JsonSerializerContext"/>,
 14    /// this attribute will be mapped to <see cref="JsonPropertyInfo.IsRequired"/>.
 15    /// </remarks>
 16    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
 17    public sealed class JsonRequiredAttribute : JsonAttribute
 18    {
 19        /// <summary>
 20        /// Initializes a new instance of <see cref="JsonRequiredAttribute"/>.
 21        /// </summary>
 022        public JsonRequiredAttribute() { }
 23    }
 24}
 25

Methods/Properties

.ctor()