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

fix: Add validators to lsx API #9182

Merged
merged 10 commits into from
Oct 10, 2024

Conversation

WNomunomu
Copy link
Contributor

@WNomunomu WNomunomu commented Sep 30, 2024

タスク

概要

変更点

セルフチェック

  • コンフリクト解消したか
  • 余計なコードは残っていないか
  • 適切にメモ化したか
  • 責務の問題はクリアしているか
  • CIは通っているか
  • PRの内容は適切にかけているか

Copy link

changeset-bot bot commented Sep 30, 2024

⚠️ No Changeset found

Latest commit: b7dbd3e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

packages/remark-lsx/src/server/index.ts Outdated Show resolved Hide resolved
@miya miya requested a review from yuki-takei September 30, 2024 08:53
@yuki-takei yuki-takei changed the title fix: add validators to lsx api fix: Add validators to lsx API Oct 3, 2024
packages/remark-lsx/src/server/index.ts Show resolved Hide resolved

import type { PageQuery, PageQueryBuilder } from './generate-base-query';

import { listPages } from '.';

interface listPagesRequest extends Request<undefined, undefined, undefined, LsxApiParams> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

インターフェース名を IListPagesRequest にしてください

Copy link
Contributor

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 : {},
Copy link
Member

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[] など)が入ってきた時のエラーハンドリングが弱いんじゃないかな

(元々の実装も弱いんですがそれは置いておいて…)

Copy link
Contributor

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 を使用する形でチェックを実装しました。

mergify bot added a commit that referenced this pull request Oct 10, 2024
@mergify mergify bot merged commit 0eceb58 into master Oct 10, 2024
17 checks passed
@mergify mergify bot deleted the fix/154290-154296-add-validators-to-lsx-api branch October 10, 2024 06:10
This was referenced Oct 10, 2024
@github-actions github-actions bot mentioned this pull request Oct 18, 2024
@yuki-takei yuki-takei mentioned this pull request Oct 31, 2024
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants