0
URLに配列値を使用しようとしています。だから私はジョイの検証としてこれを持っています。Joi for Hapiは、配列の1つの要素を配列として変換しません。
entity: Joi.array().allow(['person','location','organization']).unique().single().default(['person'])
それは私がこの
http://something.com/query?entity=person&person=organization
をすれば、私はこの
を行う場合、私は、しかしrequest
console.log(request.query.entity) // ['person', 'organization']
から値をプリントアウトしたときにそれはとても配列としてentity
を見て正常に動作します
http://something.com/query?entity=person
私はentity
ためhttp://something.com/query?entity=person
が['person']
http://something.com/query?entity=['person '] – Red