## What Allow `medusa-oas` CLI to generate API client code from an OAS json file. ## Why Manually maintaining API clients is time consuming and error prone. We wish to automate the process by using code generation strategies. We also wish to eliminate direct import from `@medusajs/medusa` in clients which can lead to unwanted side effects like importing unnecessary dependencies. ## How Fork and customize an OAS code generator library that is TypeScript friendly. Attempt to match the interface and signature of our current client packages: `@medusajs/medusa-js`, `medusa-react` Add a new `client` command to the `medusa-oas` CLI as the main interface to interact with the code generation tooling. ## Test ### Prerequisites * From the root of the monorepo: * `yarn install` * `yarn build` ### Case - all in one build * From the root of the monorepo: * Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store` * Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-store --type store` * Expect `~/tmp/client-store` to contain the following files and directories: ``` core/ hooks/ models/ services/ index.ts MedusaStore.ts useMedusaStore.tsx ``` ### Case - types only * From the root of the monorepo: * Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store` * Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-types --type store --component types` * Expect `~/tmp/client-types` to contain the following files and directories: ``` models/ index.ts ``` ### Case - client only * From the root of the monorepo: * Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store` * Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-only --type store --component client --types-package @medusajs/client-types` * Expect `~/tmp/client-only` to contain the following files and directories: ``` core/ services/ index.ts MedusaStore.ts ```
Medusa
Documentation | Medusa Admin Demo | Website
An open source composable commerce engine built for developers.
Getting Started
Follow our quickstart guide to learn how to set up a Medusa server.
Requirements
You can check out this documentation for details about setting up your environment.
What is Medusa
Medusa is an open source composable commerce engine built with Node.js. Medusa enables developers to build scalable and sophisticated commerce setups with low effort and great developer experience.
You can learn more about Medusa’s architecture in our documentation.
Features
You can learn about all of the ecommerce features that Medusa provides in our documentation.
Roadmap
You can view our roadmap with features that are planned, started, and completed on the Roadmap discussion category.
Plugins
Check out our available plugins that you can install and use instantly on your Medusa server.
Contributions
Please check our contribution guide for details about how to contribute to both our codebase and our documentation.
Upgrade Guides
Follow our upgrade guides on the documentation to keep your Medusa project up-to-date.
Community & Support
Use these channels to be part of the community, ask for help while using Medusa, or just learn more about Medusa:
- Discord: This is the main channel to join the community. You can ask for help, showcase your work with Medusa, and stay up to date with everything Medusa.
- GitHub Issues: for sending in any issues you face or bugs you find while using Medusa.
- GitHub Discussions: for joining discussions and submitting your ideas.
- Medusa Blog: find diverse tutorials and company news.
License
Licensed under the MIT License