serializr
    Preparing search index...

    Interface DiscriminatorSpec

    Define an object exposing a couple of methods that are used to discriminate between subschema.

    interface DiscriminatorSpec {
        isActualType(src: any): boolean;
        storeDiscriminator(result: any): void;
    }
    Index

    Methods

    • This method is invoked during deserialization to check if the data should be deserialized as the specific type.

      Parameters

      • src: any

        An object to inspect

      Returns boolean

      true if the json matched the discriminator condition.

    • If available this method is invoked during serialization and is meant to add discriminator information to the result json.

      Parameters

      • result: any

        The result of the deserialization

      Returns void