-
Notifications
You must be signed in to change notification settings - Fork 237
Closed
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.
Milestone
Description
Description
Rule S6964 raises on members that are defined with the [JSonProperty(Require = Always)] attribute.
Since a missing value will cause a deserialization error, the rule should not raise.
Please also consider [JSonProperty(Require = DisallowNull)]
Repro steps
Please provide a minimal code snippet that compiles which reproduces the problem. Alternatively, you can share a link to the SonarCloud public project where the issue appears. If the issue requires some specific project configuration to reproduce, you can create a minimal reproducible project and share its git repository or attach it as a ZIP file.
Example:
/// <summary>This class defines a GetPartnerSubscriptionRequest model.</summary>
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class GetPartnerSubscriptionRequest
{
/// <summary>Gets or sets the ClientSiteId.</summary>
[ValidateNever] // Prevents sonar error/warning S6964
[JsonProperty(Required = Required.Always)]
public Guid ClientSiteId { get; set; }
/// <summary>Gets or sets the PartnerId.</summary>
[ValidateNever] // Prevents sonar error/warning S6964
[JsonProperty(Required = Required.Always)]
public Guid PartnerId { get; set; }
}
Metadata
Metadata
Assignees
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.