示例#1
0
        static JTask Required <TSource, TTarget>(this JTask jTask, Mapping <TSource, TTarget> mapping)
        {
            if (!jTask.TryCoerce(mapping))
            {
                throw new MissingFieldException($"Required {mapping.Field} field not found in the JSON payload.");
            }

            return(jTask);
        }
示例#2
0
        static JTask Required <TSource, TTarget>(this JTask jTask, Mapping <TSource[], IList <TTarget> > mapping)
        {
            if (!jTask.TryCoerce(mapping))
            {
                throw new MissingFieldException(mapping.Field);
            }

            return(jTask);
        }
示例#3
0
 static JTask Optional <TSource, TTarget>(this JTask jTask, Mapping <TSource, TTarget> mapping)
 {
     jTask.TryCoerce(mapping);
     return(jTask);
 }