private static void UnmarshallResult(JsonUnmarshallerContext context,ValidatePipelineDefinitionResponse response)
{
int originalDepth = context.CurrentDepth;
int targetDepth = originalDepth + 1;
while (context.Read())
{
if (context.TestExpression("validationErrors", targetDepth))
{
context.Read();
response.ValidationErrors = new List<ValidationError>();
ValidationErrorUnmarshaller unmarshaller = ValidationErrorUnmarshaller.GetInstance();
while (context.Read())
{
JsonToken token = context.CurrentTokenType;
if (token == JsonToken.ArrayStart)
{
continue;
}
if (token == JsonToken.ArrayEnd)
{
break;
}
response.ValidationErrors.Add(unmarshaller.Unmarshall(context));
}
continue;
}
if (context.TestExpression("validationWarnings", targetDepth))
{
context.Read();
response.ValidationWarnings = new List<ValidationWarning>();
ValidationWarningUnmarshaller unmarshaller = ValidationWarningUnmarshaller.GetInstance();
while (context.Read())
{
JsonToken token = context.CurrentTokenType;
if (token == JsonToken.ArrayStart)
{
continue;
}
if (token == JsonToken.ArrayEnd)
{
break;
}
response.ValidationWarnings.Add(unmarshaller.Unmarshall(context));
}
continue;
}
if (context.TestExpression("errored", targetDepth))
{
context.Read();
response.Errored = BoolUnmarshaller.GetInstance().Unmarshall(context);
continue;
}
if (context.CurrentDepth <= originalDepth)
{
return;
}
}
return;
}