scribe
scribe copied to clipboard
Postman Collection Where Example contains a colon
- [x] I confirm that I have read and attempted the tips in the Troubleshooting Guide.
What happened?
- I set the query params in the doc block /** *@queryParam identifier required foobar. Example: 1234:1234 */
- Then I ran
php artisan scribe:generate... - I expected the collection.json once imported into Postman to have the query value "1234:1234"
- But instead inside postman the value is escaped and shown as "1234%3A1234":
- In the collection.json you can see: "query": [ { "key": "identifier", "value": "1234%3A1234", "description": "foobar", "disabled": false } ],
instead of... "query": [ { "key": "identifier", "value": "1234:1234", "description": "foobar", "disabled": false } ],
My environment:
- PHP version 8.1
- Framework (Laravel/Lumen): Laravel
- Laravel/Lumen version (from
composer show laravel/frameworkorcomposer show laravel/lumen-framework): 9.1 - Scribe version (from
composer show knuckleswtf/scribe): 3.24
Additional info: I've tracked this done to the class PostmanCollectionWriter.php::generateUrlObject[line:252 + 261]
'value' => urlencode($parameterData->example),
I think this should be as follows because the value doesn't need escaping here as postman escapes the values when it processes the url parameters:
'value' => $parameterData->example,
I'll consider it, but I think I once removed it, but returned it when that caused problems.
We have the same problem, for example, this filter is corrupted in the postman collection but not open API. filter[created_at_between] Filter by created date based on the date range in format Y-m-d.Example:2020-01-01,2020-01-05 Also, any filters that contain [ ] or , or : or space... For example, we use spatie query builder for laravel and all includes and filters containing those characters are corrupted in the postman collection. I believe should be a setting in the configuration if you want to URL encode PHP doc or not.
@shalvah same issue here! Are there any updates?
Ugh, I can see that I reverted it, but I can't find the reason why. I'll change it for now, and let's see. My hypothesis is that there are more non-URL-friendly characters beyond the : and [] that could be more game-breaking, but it's your problem. 🤷