kevinswiber / postman2openapi

Convert a Postman collection to an OpenAPI definition.
Apache License 2.0
340 stars 54 forks source link

multiple query parameters with the same name generated #66

Closed pmhofman closed 1 year ago

pmhofman commented 1 year ago

With postman2openapi@1.1.0 multiple query parameters with the same name are generated in the openapi spec.

environment: npm 9.8.1 node 20.8.0

obscured.postman_collection.zip

kevinswiber commented 1 year ago

@pmhofman Thanks for reporting the issue! This has been fixed in https://github.com/kevinswiber/postman2openapi/commit/57e74a244eeb8c4ebaadcd20cda43d95abba7d49.

If you're using the CLI, you can install from the main branch with:

cargo install --git https://github.com/kevinswiber/postman2openapi postman2openapi-cli

Otherwise, the Web version is up-to-date, as well (though you may need to do a hard refresh): https://kevinswiber.github.io/postman2openapi/

Thanks again! :sparkles:

pmhofman commented 1 year ago

Thanks.

I am not using any Rust, only the npm module, which I call as described in the docs. When a new version is released, the pipeline will pull it in automatically. I will keep an eye on the logs, and when I see a newer version being used, I will remove my postprocessing, which is just a "simple" jq query: (.. | objects | select(has("parameters")) | .parameters ) |= unique.

Actually, my full postprocessing is: (.info.description) = "ACME API" | (.. | objects | select(."text/plain")[] ) += { "schema": { "type": "string" } } | (.. | objects | select(has( "parameters")) | .parameters ) |= unique

The first part is just removal of a terrible long description (might be an idea for addition of a flag for the generation), which adds to much clutter in the python code generated from the openapi spec. The second part is to add a schema when body has type text/plain, necessary for python client generation. The last one I added to fix the duplicate query parameter issue, which also affected python client generation.

If you like, I can create issues for the first 2 as well, both being improvements.

Best regards,

Peter Hofman

Op ma 2 okt 2023 om 23:19 schreef Kevin Swiber @.***>:

@pmhofman https://github.com/pmhofman Thanks for reporting the issue! This has been fixed in 57e74a2 https://github.com/kevinswiber/postman2openapi/commit/57e74a244eeb8c4ebaadcd20cda43d95abba7d49 .

If you're using the CLI, you can install from the main branch with:

cargo install --git https://github.com/kevinswiber/postman2openapi postman2openapi-cli

Otherwise, the Web version is up-to-date, as well (though you may need to do a hard refresh): https://kevinswiber.github.io/postman2openapi/

Thanks again! ✨

— Reply to this email directly, view it on GitHub https://github.com/kevinswiber/postman2openapi/issues/66#issuecomment-1743782343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIFT5SAZ6HFR4GW7XQDF6DX5MVVVAVCNFSM6AAAAAA5PVXVGWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBTG44DEMZUGM . You are receiving this because you were mentioned.Message ID: @.***>