APIDevTools / swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
https://apitools.dev/swagger-parser
MIT License
1.09k stars 154 forks source link

npm warning: requires a peer of openapi-types@>=7 but none is installed #156

Closed wottpal closed 3 years ago

wottpal commented 3 years ago

I already opened an issue here (https://github.com/Surnet/swagger-jsdoc/issues/218), but I think here it's more appropriate.

How do I fix this warning? Why is openapi-types not installed automatically with the correct version?

npm WARN @apidevtools/swagger-parser@10.0.2 requires a peer of openapi-types@>=7 but none is installed. You must install peer dependencies yourself.

❯ npm list @apidevtools/swagger-parser
project@1.0.0
└─┬ swagger-jsdoc@4.2.3
  └─┬ swagger-parser@10.0.2
    └── @apidevtools/swagger-parser@10.0.2 
jeffory-orrok commented 3 years ago

Peer dependencies are automatically installed as of npm 7. For npm versions 3.x-6.x, here is a workaround you might try:

npm install -g install-peerdeps
install-peerdeps -g @apidevtools/swagger-parser

Needless to say, if you are installing swagger-parser as a dependency in your own project, leave off the -g in the second line