-
Notifications
You must be signed in to change notification settings - Fork 220
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
fix: Add validators to lsx API #9182
Conversation
|
|
||
import type { PageQuery, PageQueryBuilder } from './generate-base-query'; | ||
|
||
import { listPages } from '.'; | ||
|
||
interface listPagesRequest extends Request<undefined, undefined, undefined, LsxApiParams> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
インターフェース名を IListPagesRequest
にしてください
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
変更しました。
pagePath: removeTrailingSlash(req.query.pagePath), | ||
offset: req.query?.offset != null ? req.query.offset : undefined, | ||
limit: req.query?.limit != null ? req.query.limit : undefined, | ||
options: req.query?.options != null ? req.query.options : {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query の型を LsxApiParams 決め打ちにしているけれど、express-validator でチェックしておかないと予期しない値(例えば string[]
など)が入ってきた時のエラーハンドリングが弱いんじゃないかな
(元々の実装も弱いんですがそれは置いておいて…)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list-pages/index.ts
内ではなく server/index.ts
で validationResult を使用する形でチェックを実装しました。
タスク
概要
変更点
セルフチェック