Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Question] Use the rule patterns somewhere else

オープン
#95 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
openapi, php
領域
documentation

調査の方向性

Intervention\Validation\Rules\Postalcode とその private な pattern 関数から始め、その後 issue の OpenAPI Property の例を確認します。重複したハードコード値を要求せずに API ドキュメント用の rule pattern を package が公開すべきかどうかを判断します。意図したアプローチとその動作が文書化されるか、適切なテストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Hi! First of all, thank you for creating this package, it’s really helpful!

My problem

We’re building an application that processes user information, and we use the PostalCode rule to validate the postal codes provided in requests. The validation itself works perfectly, but I’m struggling with one thing: I’m generating a Swagger (OpenAPI) documentation for our APIs, and in it, I’d like to specify a pattern for the postal code like this:

new OA\Property(
    property: 'postal_code', 
    type: 'string', 
    pattern: '^\d{4}[A-Z]{2}$'
),

But now I want to match the pattern used in Intervention\Validation\Rules\Postalcode, which seems a bit difficult. Besides, the pattern function is private, and it doesn't seem to accept functions in the Swagger documentation anyway. I'm currently using a public constant or an enum.

My questions

Has anyone had the same problem in the past? Did you solve it in some way, or did you just hardcode the pattern in your docs and hope it never changes within the package? Is there a way to fetch the pattern(s) that I just didn't see before?

Hope someone can help me out, Thnx

主要言語
PHP
スター
678
フォーク
68
平均マージ
9分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Intervention/validation のほかの issue

Intervention/validation の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。