Closed henhal closed 1 year ago
Partially fixes #20
Thank you so much for your great input. Unfortunately, after merging your change in main, I noticed that there is still an error message. Could you take a look at this please? So I haven't created a new version for NPM yet. I have attached my example project and the error message. I am so grateful for your support, after changing jobs and no longer actively using the module myself every day, I simply don't have the time for further development.
Hi @yndlingsfar!
Thanks for merging my PRs! Sorry for missing one null check, I raised #25 to fix this. Your example project (which lacked components/responses
in the spec) completed successfully for me with this fix applied onto serverless-openapi-integration-helper#master.
Also, when I tried adding a response to the API it successfully injected CORS headers to it:
responses:
TestResponse:
content:
application/json:
schema:
type: object
headers:
Access-Control-Allow-Origin:
style: simple
explode: false
schema:
type: string
Access-Control-Allow-Methods:
style: simple
explode: false
schema:
type: string
Access-Control-Allow-Headers:
style: simple
explode: false
schema:
type: string
Two problems were addressed:
Here, any content under the
parameters
object should not be modified - only HTTP method object such as get, post, put etc.Here, the object under the '400' key must not be modified, since a $ref must not be combined with other attributes. Instead, each response object found under components/responses are modified with CORS content as well.