Joi回应了两个相同的错误

时间:2018-06-26 13:30:14

标签: joi

/**
 * Manually assign a list of partitions to this consumer. This interface does not allow for incremental assignment
 * and will replace the previous assignment (if there is one).
 * <p>
 * If the given list of topic partitions is empty, it is treated the same as {@link #unsubscribe()}.
 * <p>
 * Manual topic assignment through this method does not use the consumer's group management
 * functionality. As such, there will be no rebalance operation triggered when group membership or cluster and topic
 * metadata change. Note that it is not possible to use both manual partition assignment with {@link #assign(Collection)}
 * and group assignment with {@link #subscribe(Collection, ConsumerRebalanceListener)}.
 * <p>
 * If auto-commit is enabled, an async commit (based on the old assignment) will be triggered before the new
 * assignment replaces the old one.
 *
 * @param partitions The list of partitions to assign this consumer
 * @throws IllegalArgumentException If partitions is null or contains null or empty topics
 * @throws IllegalStateException If {@code subscribe()} is called previously with topics or pattern
 *                               (without a subsequent call to {@link #unsubscribe()})
 */
@Override
public void assign(Collection<TopicPartition> partitions) {

上面的代码段当包含不带seriesId的eventId 时,会给出以下响应

getEventDetail: {
query: Joi.object()
  .keys({
    profileIdentifier: Joi.string().required(),
    country: Joi.string()
      .min(2)
      .max(2)
      .required(),
    language: Joi.string()
      .min(2)
      .max(2)
      .required(),
    titleCrid: Joi.string(),
    seriesId: Joi.string(),
    eventId: Joi.string(),
  })
  .xor('titleCrid', 'seriesId')
  .with('eventId', 'seriesId'),
},

如您所见,它是一个包含2个相同错误对象的数组。 该错误是正确的,但是Joi为什么会返回两次?

0 个答案:

没有答案