HTTP API Toolkit HTTP API Toolkit
HTTP API Toolkit HTTP API Toolkit
DocFX + Singulink = ♥

Search Results for

    Class ApiNullHandlingExtensions

    Extension methods that apply the toolkit's null handling to JSON serializer options.

    Inheritance
    object
    ApiNullHandlingExtensions
    Namespace: Singulink.Net.Http.Api
    Assembly: Singulink.Net.Http.Api.dll
    Syntax
    public static class ApiNullHandlingExtensions
    Remarks

    With the null handling, reading JSON rejects a null value for a property or constructor parameter that is not nullable, and a missing value for a required member that is not nullable: a constructor parameter without a default value, a required member or a member with JsonRequiredAttribute. Required members that are nullable are optional: a missing constructor parameter is read as null, and a missing property is left as it is. Rejected values throw a JsonException.

    Writing JSON rejects a null value in a property that is not nullable too, with a JsonException. Other null values are written unless DefaultIgnoreCondition says otherwise, and are read back as null, also for a member whose default value is not null.

    Methods

    Name Description
    ConfigureApiNullHandling(JsonSerializerOptions)

    Applies the null handling to the options and to the type info of their current type info resolvers (see ApiNullHandlingExtensions). It must be called after the options' contexts and other resolvers are added: resolvers added afterwards are not covered.

    © Singulink. All rights reserved.