Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.
This repository was archived by the owner on Jun 10, 2026. It is now read-only.

Add JsonProperty(DefaultValueHandling.Include) for required primitives #110

Description

We do not emit JsonProperty(DefaultValueHandling.Include) on properties that are marked required. If we do not do this, then the default handling for non-attributed properties is subject to being overriden by settings provided to the JSON.NET serialization classes.

When JsonProperty is applied, this value can't be overridden. This is important in some scenarios, such as SARIF, where eliminating a default value (like a boolean primitive, e.g. Run.ExecutionSuccessful) will invalidate the file.

This bug turned up in the SARIF SDK, where a log writer incorrectly initialized the serializer with DefaultValueHandling.Ignore.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions