Open
Conversation
keillera
approved these changes
Jul 25, 2018
| 'reason': {'enum': settings.FRAUD_REASONS} | ||
| } | ||
| } | ||
| ], |
Member
There was a problem hiding this comment.
(リファクタ)
今回の場合はチェック処理を手動(L78〜)で記載頂いているので anyOf で書く必要はありません。
また、reson の記載が L18 と L26 で複数定義になっており分かりにくいため、特に意図がなければ enum の設定も setting.py に直接記載するようお願いします。
まとめると、下記の3点について修正をお願いしますm(_ _)m
・anyOf の記載(L23〜29) を削除
・setting.py L92 に下記を追加
'enum': [
'violence',
'spam',
'plagiarism',
'slander',
'illegal',
'other'
]
・setting.py L172 を削除
| } | ||
| } | ||
| } | ||
| return basic_params |
Member
There was a problem hiding this comment.
(テストケース追加)
現在各パラメータに対して none な場合についてはチェック頂いていますが、空文字列の観点が入っていない状態です。
jsonschema ではなく 独自に実装したチェック処理については(me_articles_fraud_create.py L78~) 各パラメータに対しても空文字チェックを追加で実施頂くようお願いします。
(jsonschemaでやりたくて色々調べたが、draft-07で初めてifが登場してた)
01da406 to
c3a40b5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
現状記事に対して違反しているというデータしか持っていないが、
申告者がより詳細に報告をできるよう、APIの受け口を広げました。
追加項目
環境変数(SSMパラメータ)
なし
関連URL
影響範囲(ユーザ)
影響範囲(システム)
技術的変更点概要
なにをどう変更したか
当該APIのリクエストにJSONで受け取れるように受け皿を作り、データ登録時の項目を増やした
memo: 複合条件での入力チェックについて
今回の場合、例えば申告理由が著作権違反の場合は、元記事URLと補足説明を必須にする必要があると考えた。
その複合条件のチェックをjsonschemaでやろうと調べまくったが、結論本家のバージョンdraft-07から開始したらしい。。
(Pythonライブラリのjsonschemaはdraft-6までをサポート)
悲しいが今回は自作しました。
→諦めきれずにもう少し調べたが、仕様に合う形でどうしてもできず、スピード優先で結局自作しました。。
参考URL
https://github.com/Julian/jsonschema
http://json-schema.org/draft-07/json-schema-release-notes.html
https://stackoverflow.com/questions/38717933/jsonschema-attribute-conditionally-required
使い方
DBやDBへのクエリに対する変更
violence(公序良俗に反する)
spam(迷惑行為)
plagiarism(著作権違反)
slander(誹謗中傷)
illegal(トークン不正取得)
other(その他)
ブロックチェーンへの影響
なし
個人情報の取り扱いに変更のあるリリースか
なし
ロギング
なし
ユニットテスト
あり
テスト結果とテスト項目
保留した項目とTODOリスト
注意点・その他