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

Cannot read property 'securitySchemes' of undefined #46

Open
prichey opened this issue Jun 25, 2020 · 3 comments
Open

Cannot read property 'securitySchemes' of undefined #46

prichey opened this issue Jun 25, 2020 · 3 comments

Comments

@prichey
Copy link

prichey commented Jun 25, 2020

Getting this with a valid OAS v2 file:

TypeError: Cannot read property 'securitySchemes' of undefined
    at getHeadersArray (/repo/node_modules/openapi-snippet/openapi-to-har.js:309:48)
    at createHar (/repo/node_modules/openapi-snippet/openapi-to-har.js:44:14)
    at Object.openApiToHarList [as getAll] (/repo/node_modules/openapi-snippet/openapi-to-har.js:379:21)
    at Object.getSnippets (/repo/node_modules/openapi-snippet/index.js:63:32)

Looks like openapi-to-har.js expects openApi.components.securitySchemes to exist even though it's not required for OAS v2.

@sa-mustafa
Copy link

Same feeling here. However, after a bit of debugging 'openapi-to-har.js', I found out that some of my endpoint definitions lacked 'security:' tag. For more info, see the swagger api keys.
You can also upgrade your doc from Swagger (i.e. OAS v1/2) to OpenAPI v3.

@ran-huang
Copy link

Getting the same error. I have a global security section on the root level so I'm not sure why the error occurs. The error is related to this line

@BartoszPluta
Copy link

For the future of the solution proposal just add in your schema

openapi: '3.0.0',

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

4 participants