akka/akka-http

Wrong Marshalling when Entity is `Optional`

オープン

#559 opened on 2016/11/20

 (11 件のコメント) (0 件のリアクション) (0 人の担当者)Scala (598 件のフォーク)batch import
1 - triagedhelp wantedt:routing

Repository metrics

Stars
 (1,311 個のスター)
PR merge metrics
 (平均マージ 1d 10h) (30d で 2 merged PRs)

説明

When completing a route with a Java Optional the output is not the one I would expect:

Expected Behavior

  • If Optional[T] is empty: completed with an empty Entity
  • If Optional[T] is not empty: completed with proper marshalling of T

Actual Behavior

  • If Optional[T] is empty: completed with {"present": false}
  • If Optional[T] is not empty: completed with {"present": true}

I have a gist where one can reproduce this: https://gist.github.com/jlprat/5e1c27ce4b912e0a3eb0ad56237246d7

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