readmeio/api

Not able to install the SDK in any project

Closed this issue · 8 comments

I made an SDK using the swagger open spec definition for my API named @api/yaus_link_generation, (SDK's name) the command npm install @api/yaus_link_generation is working fine in my personal directory in which the SDK was made.


But in a different directory, I am getting this error:

image

Not able to install it in any other directory

Hey! So the module right now doesn't provide a first class way to publish these generated SDKs onto npm. The preferred workflow is for your users to install it via a URL to the OAS spec like so:

npx api@beta install https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json

It would be excellent if you could run npm publish in the generated directory, then your users could run npm install on it from anywhere. But this isn't what this module does at this point. Assigning this to @erunion who is in charge of this module.

Thanks @domharrington , will try npm publish

Well, getting this npm ERR! code EBADSEMVER npm ERR! invalid semver: by using the command npm publish
@domharrington

Yeah we don't currently support running npm publish of the generated SDK at the moment. This is a feature request for future. The intended usage is installing from a URL:

npx api@beta install https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json

@Kanika637 So you've run npx api@beta install http://some-url and that created @api/yaus_link_generation and added that to the package.json from where you issued that command, but you're trying to load @api/yaus_link_generation in a directory above? Or another directory within your codebase? Or another codebase?

@erunion yes, I am just trying to use this SDK which I just created in another codebase

Ah ok. You'll need to either publish that SDK to NPM yourself, or re-run the SDK generation in that other codebase.

We have plans to at some point offer commands in api that'll help you publish the package but for now it's a very manual process for you unfortunately.

Okay @erunion , thanks for the guidance 👍