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

orderOfOperations is not working as expected (apideck/portman@1.22.0) #485

Open
Tanmay2711 opened this issue May 16, 2023 · 1 comment
Open

Comments

@Tanmay2711
Copy link

Tanmay2711 commented May 16, 2023

Hi Team,
I am using below configuration -

portman-config.json
"orderOfOperations":[
"POST::/*",
"GET::/*",
"PATCH::/*",
"DELETE::/*"
],

and schema.json

Path - /provider/domain/v1/entity
Operations -
GET
POST

Path - /provider/domain/v1/entity/{id}
Operations -
DELETE
GET
PATCH

Note: All operations have unique operationIds specified.

and postman-config.json
{
"folderStrategy": "Paths",
"requestParametersResolution": "Example"
}

command -
npx portman -l schema.json -b http://localhost -o postman-collection.json -c portman-config.json --postmanConfigFile postman-config.json

Expected behavior -
for path /provider/domain/v1/entity it should generate requests in order - POST, GET
for path /provider/domain/v1/entity/{id}, it should generate requests in order - GET, PATCH and DELETE

Actual behavior -
for path /provider/domain/v1/entity it generates requests in order - POST, GET (Working as expected)
for path /provider/domain/v1/entity/{id}, it keeps the same order - DELETE, GET, PATCH (Not working as expected)

@JaredCE
Copy link

JaredCE commented Aug 12, 2023

I Agree, there is something funky with order of operations:

portman-config.json

{
  "version": 1.0,
  "globals": {
    "orderOfOperations": [
      "POST::/batch/{organisationId}",
      "PATCH::/{paymentCodeId}",
      "GET::/{paymentCodeId}",
      "POST::/filter/{organisationId}",
      "PATCH::/allocate/{organisationId}",
      "PATCH::/{paymentCodeId}/{organisationId}",
      "POST::/verify",
      "PATCH::/used",
      "POST::/create/{organisationId}",
      "DELETE::/{paymentCodeId}/{organisationId}"
    ]
  }
}

results in a postman collection generated:

{
  "_": {
    "postman_id": "fc88856f-4aff-4c01-abee-a50700e42fe8"
  },
  "item": [
    {
          "_": {
            "portman_operation": "POST::/batch/:organisationId"
          }
    },
    {
          "_": {
            "portman_operation": "PATCH::/:paymentCodeId/:organisationId"
          }
     },
     {
         "_": {
            "portman_operation": "PATCH::/:paymentCodeId"
          },
      },
      {
          "_": {
            "portman_operation": "GET::/:paymentCodeId"
          }
      }   
  ]
}

Somehow that "portman_operation": "PATCH::/:paymentCodeId/:organisationId" operation is getting added in very early compared to where i would expect it, based on the provided orderOfOperations

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

No branches or pull requests

2 participants