akka/akka-core

JsonObjectParser rejects some valid JSON Array streams

オープン

#25,673 opened on 2018/09/21

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Scala (3,547 件のフォーク)batch import
3 - in progresshelp wantedt:stream

Repository metrics

Stars
 (13,277 個のスター)
PR merge metrics
 (平均マージ 8d 19h) (30d で 10 merged PRs)

説明

When attempting to feed the following entity:

   [ "abc", "def", "ghi", "klm" ]

(which is a valid JSON Array, even though not of objects) to an Akka HTTP endpoint that specifies the

entity(asSourceOf[String]) { source ⇒ … }

directive, JsonObjectParser fails to parse and provide a Source[ByteString, _] that can be demarshalled as JsValues and eventually strings.

Furthermore, while using the directive for that usage might be slower than using a dedicated framing primitive, it's a bit dangerous that the "obvious path" compiles but fails to work. (incoming PR)

コントリビューターガイド