swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Package openapi-types is missing, but gets requested by yarn

Open Myrmod opened this issue 3 years ago • 7 comments

I created a monorepository using turborepo with the yarn (v3.1.1) option. In there I have two express applications that use swagger. While trying to install I get the following log output:

YN0000: ┌ Resolution step
➤ YN0002: │ swagger-parser@npm:10.0.2 doesn't provide openapi-types (p8111f), requested by @apidevtools/swagger-parser
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 389ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ turbo@npm:1.0.28 must be built because it never has been before or the last one failed
➤ YN0009: │ turbo@npm:1.0.28 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-9144f05e/build.log)
➤ YN0000: └ Completed in 0s 310ms
➤ YN0000: Failed with errors in 0s 889ms
yarn explain peer-requirements p8111f
➤ YN0000: swagger-parser@npm:10.0.2 doesn't provide openapi-types, breaking the following requirements:

➤ YN0000: @apidevtools/swagger-parser@npm:10.0.2 [9cdba] → >=7 ✘

What might be the reason and how can I debug this properly?

Myrmod avatar Jan 25 '22 11:01 Myrmod

A workaround I could use is this:

yarn remove swagger-jsdoc && yarn add -P swagger-jsdoc

Here we also install the peer dependencies.

Myrmod avatar Jan 25 '22 12:01 Myrmod

I have the same problem. but not with yarn, with npm

node_modules/@apidevtools/swagger-parser/lib/index.d.ts:1:25 - error TS2307: Cannot find module 'openapi-types' or its corresponding type declarations.

1 import { OpenAPI } from "openapi-types";

sinoohe avatar Apr 19 '22 13:04 sinoohe

@sinoohe could you help me out with a pull request here? I've spent three days straight just trying to fix the upstream dependencies to get 10.1.0 out and I really need a hand with this.

philsturgeon avatar May 13 '22 16:05 philsturgeon

I think the problem is that swagger-parser shim package needs to declare the openapi-types as (some kind of) a dependency.

dividedmind avatar Jun 23 '22 07:06 dividedmind

+1 -- Basically, this project requires 7 but the current is 12.

This should be a peerDependency.

AlbinoGeek avatar Aug 04 '22 18:08 AlbinoGeek

Anyone got a PR to fix this.

philsturgeon avatar Aug 05 '22 14:08 philsturgeon

You can install openapi-types to your project to get around this.

meronogbai avatar Jan 18 '24 05:01 meronogbai