Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Question] Use the rule patterns somewhere else

未关闭
#95 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
冷清
技术栈
openapi, php
领域
documentation

调研方向

从 Intervention\Validation\Rules\Postalcode 及其 private pattern 函数开始,然后查看 issue 中的 OpenAPI Property 示例。确定 package 是否应为 API 文档公开该 rule pattern,同时不要求重复的硬编码值;当预期的实现方式及其行为已有文档说明或由适当的测试覆盖时,即视为完成。

由索引模型根据 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 分钟
30 天内合并 PR
1

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Intervention/validation 的其他 Issue

查看 Intervention/validation 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。