Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postman Collection Where Example contains a colon #442

Closed
1 task done
freexe opened this issue Feb 28, 2022 · 4 comments
Closed
1 task done

Postman Collection Where Example contains a colon #442

freexe opened this issue Feb 28, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@freexe
Copy link

freexe commented Feb 28, 2022

What happened?

  1. I set the query params in the doc block
    /**
    *@QueryParam identifier required foobar. Example: 1234:1234
    */
  2. Then I ran php artisan scribe:generate ...
  3. I expected the collection.json once imported into Postman to have the query value "1234:1234"
  4. But instead inside postman the value is escaped and shown as "1234%3A1234":
  5. 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/framework or composer 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,

@freexe freexe added the bug Something isn't working label Feb 28, 2022
@shalvah shalvah added enhancement New feature or request and removed bug Something isn't working labels Mar 1, 2022
@shalvah
Copy link
Contributor

shalvah commented Mar 1, 2022

I'll consider it, but I think I once removed it, but returned it when that caused problems.

@mariosvasiliou
Copy link

mariosvasiliou commented Feb 22, 2023

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.

@lumos94
Copy link

lumos94 commented Mar 16, 2023

@shalvah same issue here! Are there any updates?

@shalvah
Copy link
Contributor

shalvah commented Mar 19, 2023

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. 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants