openapistack / openapicmd

The CLI for all things OpenAPI and Swagger
https://openapistack.co
MIT License
56 stars 9 forks source link

check if response exists bevor assigning to it #52

Closed sebastian-otto-axa closed 3 months ago

sebastian-otto-axa commented 3 months ago

Description

hi, its me again, working behind a corporate proxy isn't the best...

As you can see down in strip-definition | line 263 it's trying to asssign an empty object to responses. Since the description dosen't have a response the code breaks. Not sure why it has to be an empty response, can't it just be deleted?

This behavior is problematic if the removeResponses flag is set. And a description is provided on the path (see #50) The response gets changed bevor all descriptions get stripped, that's why #50 didn't fix the real issue...

Furthermore I added a few more tests, to actually test the combination of all options in the presets. I used a paramerized test to check if a api spec gets stripped properly. The array contains the preset and the expected stripped spec.

BTW: you got two high findings, that can be easly fixed by upgrading wait-on to 7.2.0 😅

anttiviljami commented 3 months ago

Thanks @sebastian-otto-axa! Merged this, ran npm audit fix and shipped a new version openapicmd@2.4.0