knuckleswtf / knuckleswtf/scribe

Use Laravel's validation functionality to map body parameters

Open
#698 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
2.3k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

### Scribe version

4.22

### PHP version

8.1

### Framework

Laravel

### Framework version

10.10

### Scribe config

```ruby
try_it_out.enabled => false
auth.enabled => true
auth.default => true
auth.name => "Authorization"
postman.enabled => false
openapi.enabled => false
```

### What happened?

Mapping of validation rules don't work if I use $request->validate in try/catch block.
The problem in RequestValidate.php this line:
if (!($node instanceof Node\Stmt\Expression)) return;

Node return => RulesPhpParser\Node\Stmt\TryCatch instead RulesPhpParser\Node\Stmt\Expression and exit from mapping

### Docs

- [X] I've checked [the docs](https://scribe.knuckles.wtf/laravel), the [troubleshooting guide](https://scribe.knuckles.wtf/laravel/troubleshooting), and [existing issues](https://github.com/knuckleswtf/scribe/issues?q=is%3Aissue+), but I didn't find a solution

Contributor guide

Open the contributing guide

Research direction

Start in RequestValidate.php and trace how validation rules are handled when the node is a TryCatch rather than an Expression. Reproduce the reported case with $request->validate inside a try/catch block, then confirm that body-parameter mapping still works for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.