chore: contact form min length and Scribe API domain#197
Conversation
- Add min:20 validation to contact form message field - Use API_DOMAIN env var for Scribe docs base URL when set
There was a problem hiding this comment.
Pull request overview
Adds stricter contact form validation to reduce spam/low-effort submissions and updates Scribe configuration so generated API docs can display an API-specific domain when configured.
Changes:
- Enforce a minimum message length (
min:20) on the contact form request validation. - Update Scribe docs
base_urlto preferapp.api_domain(when set) overapp.url.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| config/scribe.php | Changes the displayed API docs base URL to use app.api_domain when present. |
| app/Http/Requests/ContactRequest.php | Adds min:20 validation to the contact form message field. |
| 'email' => ['required', 'email:rfc,dns', 'max:255'], | ||
| 'company' => ['nullable', 'string', 'max:255'], | ||
| 'message' => ['required', 'string', 'max:5000'], | ||
| 'message' => ['required', 'string', 'min:20', 'max:5000'], |
There was a problem hiding this comment.
This validation change alters contact form behavior but there are no automated tests covering contact form submissions in the suite. Please add a feature test that posts to the contact endpoint and asserts messages shorter than 20 characters fail validation (and that a valid message succeeds, eg with Mail::fake()).
| // The base URL displayed in the docs. | ||
| // If you're using `laravel` type, you can set this to a dynamic string, like '{{ config("app.tenant_url") }}' to get a dynamic base URL. | ||
| 'base_url' => config('app.url'), | ||
| 'base_url' => config('app.api_domain') ? 'https://'.config('app.api_domain') : config('app.url'), |
There was a problem hiding this comment.
base_url hardcodes https:// and drops any scheme/port from app.url. This can produce incorrect server URLs in docs (eg local http, non-standard ports). Consider building the URL the same way as URL::getApiUrl does (derive scheme/port from config('app.url')) instead of hardcoding https.
Summary
min:20validation to contact form message field to filter spam/low-effort submissionsAPI_DOMAINenv var as base URL when set (showsapi.relaticle.cominstead ofrelaticle.com)Test plan
api.relaticle.comas server afterphp artisan scribe:generate