private static string JsonSchemaTypesToLabel(JsonSchemaType type)
{
var types = new string[6];
int index = 0;
if ((type & JsonSchemaType.String) == JsonSchemaType.String)
types[index++] = "string";
if ((type & JsonSchemaType.Float) == JsonSchemaType.Float || (type & JsonSchemaType.Integer) == JsonSchemaType.Integer)
types[index++] = "number";
if ((type & JsonSchemaType.Boolean) == JsonSchemaType.Boolean)
types[index++] = "boolean";
if ((type & JsonSchemaType.Object) == JsonSchemaType.Object)
types[index++] = "object";
if ((type & JsonSchemaType.Array) == JsonSchemaType.Array)
types[index++] = "array";
if ((type & JsonSchemaType.Null) == JsonSchemaType.Null)
types[index++] = "null";
switch (index)
{
case 0:
return "";
case 1:
return types[0];
case 2:
return types[0] + " or " + types[1];
default:
return string.Join(", ", types, 0, index - 1) + ", or " + types[index - 1];
}
}