arraySchema static method

dynamic arraySchema(
  1. String id, {
  2. bool includeObject = false,
})

Implementation

static dynamic arraySchema(
  String id, {
  bool includeObject = false,
}) {
  dynamic result;

  if (Enums.all.contains(id) || ColorSchema.id == id) {
    result = {
      'type': 'array',
      'items': {
        r'$ref': id,
      },
    };
  } else {
    result = {
      'anyOf': [
        {
          'type': 'string',
        },
        {
          'type': 'array',
          'items': {
            r'$ref': id,
          },
        },
        if (includeObject)
          {
            r'$ref': id,
          },
      ],
    };
  }

  return result;
}