joolfe / postman-to-openapi

🛸 Convert postman collection to OpenAPI
MIT License
575 stars 99 forks source link

disabled options #186

Closed 379820 closed 1 year ago

379820 commented 2 years ago

Hi,

Thanks for the great product.

Postman gives you the ability to enable and disable options, parameters, for example, in headers.

In postman json this is marked as "disabled": true.

Apparently there is no way to have switches, for example, in the headers for swagger?

I should probably put the changeable values into variables and leave only enabled headers to control them?

from json:

{
  "info": {
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "whatever",
      "item": [
        {
          "name": "Create new whatever",
          "event": [
          ],
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [
              {
                "key": "X-Real-UserAgent",
                "value": "{{real_user_agent}}",
                "type": "text"
              },
              {
                "key": "X-Real-UserAgent",
                "value": "{{real_user_agent_mobile}}",
                "type": "text",
                "disabled": true
              }
            ]…
mindrunner commented 1 year ago

It seems like disabled params are currently ignored. I think they should be converted as well.

joolfe commented 1 year ago

@mindrunner how do you suggest to translate the Postman disabled to Open API spec?

binlabs commented 1 year ago

@joolfe I think an optional flag in the CLI to translate the disabled params as if they were not disabled would be great.

mindrunner commented 1 year ago

That sounds like a good idea. My workflow in postman is to disable optional params while not needed, always ending up in a half converted openapi spec after dpeloyment, due to them being ignored. I personally don't see a use case for having them disabled in postman but not wanting them to be converted. If I do not need them permanently, I would rather also wipe them off the postman collection.

joolfe commented 1 year ago

I personally don't see a use case for having them disabled in postman but not wanting them to be converted.

Some people use to have multiple values in the collection so when ever want to test one thing activate a parameter and deactivate the other... no too much time ago somebody request a feature to allow get values by this methods...

Have an option to translate or not the disable params seems a good solution but need to think in what happen when the parameter exist more than one time and in how many parameters can be apply this (headers, query, path...) so I would work in a little research first

Best regards.

mindrunner commented 1 year ago

Some people use to have multiple values in the collection so when ever want to test one thing activate a parameter and deactivate the other... no too much time ago somebody request a feature to allow get values by this methods...

Sounds pretty handy, never thought about that actually. :)

so I would work in a little research first

ack

binlabs commented 1 year ago

Thanks a lot for getting this done @joolfe - just FYI, I noticed a minor problem with the new docs for this new disabledParams object. It looks like the markdown format for the table isn't getting parsed correctly on the website: https://joolfe.github.io/postman-to-openapi/#disabledparams-object

Here is a screenshot

Screen Shot 2022-09-18 at 6 49 06 PM