Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Hook で送信される JSON が実際のデータと乖離している #341

Closed
griffin-stewie opened this issue Apr 8, 2016 · 6 comments

Comments

@griffin-stewie
Copy link

現状 Webhook の Test Hook で送信される JSON は以下のようになっています。

{   "knowledge_id": 1,  "title": "記事タイトル",  "content": "記事本文",  "status": "created",    "public_flag": 10,  "tags": ["Sample"   ],  "groups": [     "ALL USERS" ],  "like_count": 2,    "comment_count": 3, "type_id": -100,    "link": "http://example.jp/knowledge/open.knowledge/view/1",    "insert_user": "記事投稿ユーザ名",  "insert_date": "記事投稿日",   "update_user": "記事更新ユーザ名",  "update_date": "記事更新日"}

"insert_date" などでは、キーに対するバリューの型やその表現が本番データと大きな乖離があります。

Webhook を受ける側の実装によっては、不正な JSON(想定外の JSON)として処理されてしまい、テストとして成立しないと感じました。

具体的な値自体は何でもいいですが、実際のデータにより近い形式で Test Hook が動作するとありがたいです。

@koda-masaru
Copy link
Contributor

データ形式が異なっていましたか。失礼しました。
調べてみて、形式が合うように対応します。

@nagodon
Copy link
Contributor

nagodon commented Apr 9, 2016

すいません、直しますね。
ご指摘ありがとうございます。

@griffin-stewie
Copy link
Author

@koda-masaru @nagodon

ありがとうございます。

  • insert_date
  • update_date

今回ハマったのは上記 Key に対して

  1. 日時を表すような値("2016/03/04 10:00:00" のようなもの)が入っているのかと思えば、自然言語だった
  2. 日時のフォーマット(RFC3339 のような形式とか)が想定と違っていた

という感じでした。

"1." に関しては、Test Hook が呼び出された現在日時でも固定の日時でもかまわないと思っています。
"2." に関しては、当時の Issue でも明確な日時フォーマットを議論していなかったので、現状のもので問題はありません。どのようなフォーマット形式なのかがわかればそれで問題ありません。

Webhook に関する情報がどこかにまとまっていて、利用者に活用してもらえる状態であればうれしいです。よろしくお願いいたします。

@nagodon
Copy link
Contributor

nagodon commented Apr 10, 2016

@griffin-stewie

#344 で実際に送られるフォーマットに対応しました。

Webhook に関する情報がどこかにまとまっていて、利用者に活用してもらえる状態であればうれしいです。よろしくお願いいたします。

確かにそうですね。
ドキュメントにまとめるようにしたいと思います。

@griffin-stewie
Copy link
Author

@nagodon

ご対応ありがとうございます。次回リリースを楽しみにしています。

@koda-masaru koda-masaru added this to the v1.4 milestone Apr 20, 2016
@koda-masaru
Copy link
Contributor

v1.4.0でリリースしたため、issueはクローズします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants