Skip to content

fix: バーコードAPIのバリデーションをプロジェクト標準形式に修正#18

Open
Atsumi3 wants to merge 2 commits intomainfrom
fix/barcode-api-validation
Open

fix: バーコードAPIのバリデーションをプロジェクト標準形式に修正#18
Atsumi3 wants to merge 2 commits intomainfrom
fix/barcode-api-validation

Conversation

@Atsumi3
Copy link
Member

@Atsumi3 Atsumi3 commented Oct 3, 2025

Summary

バーコード検索API (/api/item/barcode/{barcode}) のバリデーションルールを、プロジェクトで実際に使用されているバーコード形式に修正しました。

Changes

  • バリデーションパターンの変更
    • 変更前: ^[0-9]{4,}$ (数字のみ4桁以上)
    • 変更後: ^A(00|01|02)\d{6}A$ (A + 種別2桁 + ID6桁 + A)
  • APIドキュメントの更新
    • パラメータ例: 1234567890A01000001A
    • 説明文: "4+ digits" → "format: A01XXXXXXA"

Rationale

プロジェクトで実際に使用されているバーコードは Constants.Validation.BARCODE_PATTERN で定義されている独自フォーマット(例: A01000001A)です。
しかし、APIのバリデーションが数字のみの形式を期待していたため、実際のバーコードでリクエストするとエラーが発生していました。

Test plan

  • サーバー起動確認
  • /api/item/barcode/A01000005A で正常にレスポンスが返ることを確認

- バーコード検索API(/api/item/barcode/{barcode})のバリデーションを修正
- 数字のみ4桁以上 → A + 種別(2桁) + ID(6桁) + A 形式に変更
- APIドキュメントの例を実際の形式(A01000001A)に更新
- プロジェクトで実際に使用されているバーコードフォーマット(Constants.Validation.BARCODE_PATTERN)に準拠
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

🎨 Visual Regression Test Results

Visual regression tests failed

Some pages have visual differences. Please review the artifacts:

📋 Actions to take:

  1. Download test artifacts
  2. Review the diff images to understand the changes
  3. If changes are intentional, add update-snapshots label to this PR

📊 Test Coverage

  • Desktop (1280x720)
  • Tablet (iPad)
  • Mobile (iPhone 13)

- SaleEntityにchangeAmountプロパティを追加してNOT NULL制約エラーを解決
- SalePersistenceService/SaleServiceでお釣り計算を実装
- レシート印刷を非同期化(CompletableFuture)してAPIレスポンスのブロッキングを回避
- ReceiptPrinterにSocket接続タイムアウト(5秒)を追加してプリンター接続エラー時の無限待機を防止
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

🎨 Visual Regression Test Results

Visual regression tests failed

Some pages have visual differences. Please review the artifacts:

📋 Actions to take:

  1. Download test artifacts
  2. Review the diff images to understand the changes
  3. If changes are intentional, add update-snapshots label to this PR

📊 Test Coverage

  • Desktop (1280x720)
  • Tablet (iPad)
  • Mobile (iPhone 13)

@Atsumi3 Atsumi3 added the update-snapshots update vrt label Oct 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

🎨 Visual Regression Test Results

Visual regression tests failed

Some pages have visual differences. Please review the artifacts:

📋 Actions to take:

  1. Download test artifacts
  2. Review the diff images to understand the changes
  3. If changes are intentional, add update-snapshots label to this PR

📊 Test Coverage

  • Desktop (1280x720)
  • Tablet (iPad)
  • Mobile (iPhone 13)

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant