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

The requests in the default folder are in the reverse order #13

Closed
FabienSailliet opened this issue Apr 25, 2019 · 12 comments
Closed

The requests in the default folder are in the reverse order #13

FabienSailliet opened this issue Apr 25, 2019 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@FabienSailliet
Copy link

If we generate a Markdown or HTML file from a Postman collection, the requests directly in the collection (outside any subfolder) are reversed.

For example, with the following collection:

image

{
	"info": {
		"_postman_id": "72a750d2-5658-4e2f-a475-3317b4c7ec73",
		"name": "Test collection (requests order bug)",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "first",
			"request": {
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": ""
				}
			},
			"response": []
		},
		{
			"name": "second",
			"request": {
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": ""
				}
			},
			"response": []
		},
		{
			"name": "third",
			"request": {
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": ""
				}
			},
			"response": []
		}
	]
}

We get the following html:

image

@tahayk
Copy link

tahayk commented Jun 3, 2019

still having same issue, any idea how to solve this ?

@FabienSailliet
Copy link
Author

Same under Linux with v2.3 and the same collection.

I tried to quickly look over the code, but I don't know Go, so I will not be really useful, sorry.

@Enrico204
Copy link
Contributor

I found the code part that does the sorting. I'll create a pull request to add a command line switch to enable/disable collections sort :-)

@Enrico204
Copy link
Contributor

@FabienSailliet can you check if this problem is fixed in the latest version? Thanks :-)

@akiselev1
Copy link

@Enrico204 I checked - the sorting problem is still there today. -s switch is visible in help and accepted. But it does not change the reverse sort order. It is reproducible with the original test json posted by @FabienSailliet
Docgen version: v2.3

@abhijitnathwani
Copy link

@Enrico204 @thedevsaddam This problem is still persistent. Do we have any solution for this?

@thedevsaddam
Copy link
Owner

thedevsaddam commented May 14, 2020

@abhijitnathwani , Hopefully, it will be solved by next release [v3.0.0]. There will be major changes in UI.

In the case of directory or requests ordering:

  • The default will be as it shows in postman
  • -s flag will sort the items (directory, requests) in lexical order

@thedevsaddam thedevsaddam self-assigned this May 14, 2020
@thedevsaddam thedevsaddam added the bug Something isn't working label May 14, 2020
@thedevsaddam
Copy link
Owner

Please use the latest v3.0.0-rc

curl https://raw.githubusercontent.com/thedevsaddam/docgen/v3/install.sh -o install.sh && sudo chmod +x install.sh && sudo ./install.sh

I'm closing the issue. If anything goes wrong, please feel free to create an issue or reopen

@abhijitnathwani
Copy link

abhijitnathwani commented May 14, 2020

Thanks @thedevsaddam . The -s flag sorts lexically now.

However, the default behavior is still ordering in reverse. We can verify that by checking the sequence in collection.json and the generated output. Should I open an issue to track that?

@thedevsaddam
Copy link
Owner

thedevsaddam commented May 14, 2020

The default order is using parent directories in order but the children are going out of order

Screenshot 2020-05-14 19 16 59

Note: Probably I'll need a PR for that :(

Update: Removed the s flag, from now on the collections will be in lexical order by default

@mnich0ls
Copy link
Contributor

mnich0ls commented May 21, 2020

I'm also still seeing sorting not following the same order of the requests in the collection by default:
Screen Shot 2020-05-21 at 4 55 30 PM

I used the Mac binary 3.0.0-rc2 - https://github.com/thedevsaddam/docgen-bin/blob/master/latest/mac_amd64

@thedevsaddam
Copy link
Owner

The collections are ordered alphabetically,
a-z etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants