Commit Graph

34 Commits

Author SHA1 Message Date
github-actions[bot]
f35fcb810f chore(docs): Generated References (#5593)
* chore(docs): Generated References (automated)

* fix sidebar and links

* removed reflection path section

---------

Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
Co-authored-by: Shahed nasser <shahednasser@gmail.com>
2023-11-09 20:23:25 +02:00
Shahed Nasser
4f91263588 chore: fix generate automated reference action (#5589)
* chore: fix generate automated reference action

* fix dependencies

* add depends in turbo

* add install step for www workspace
2023-11-09 17:14:28 +02:00
Shahed Nasser
91615f9c45 chore: improve JS Client TSDoc comments (#5582)
* add oas schema to tsdoc parser

* add tsdoc (part 1)

* Finished tsdoc in js client

* general fixes

* added tsdoc in core medusa package

* parse schema tags in model files

* added maxlevel option

* added more tsdoc

* added tsdoc in core

* added TSDoc in core package

* generated client types

* support featureFlag and expandable tags

* added support for resource feature flag note

* fix api ignore plugin

* added eslint plugin

* support feature flag and expandable badges

* adjusted overview page + generated reference

* revert generated files

* added changeset

* add details about new typedoc options

* fix broken link
2023-11-09 12:51:17 +02:00
Shahed Nasser
4692f54b49 chore(docs-util): fix freshness check script (#5518) 2023-11-01 12:28:34 +02:00
Shahed Nasser
9f29f18ee9 chore(docs-util): fix announcement script (#5503) 2023-10-31 17:27:12 +01:00
Shahed Nasser
2ac05066ac chore(docs-util): Improve generate references script and action (#5472)
* chore(docs-util): Improve generate references script and action

* added if condition for API reference

* fix api reference condition

* fix description of action

* fix body value

* fix step name
2023-10-25 17:12:10 +03:00
Shahed Nasser
1a10822cae docs: update override price selection strategy documentation (#5438)
* docs: update override price selection strategy documentation

* fix eslint errors
2023-10-20 20:17:45 +03:00
github-actions[bot]
9dcd62c731 chore(docs): Generated JS Client Reference (#5421)
* chore(docs): Generated JS Client Reference (automated)

* fix js client reference

* fix links

---------

Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed nasser <shahednasser@gmail.com>
2023-10-20 14:01:27 +03:00
Shahed Nasser
28d2f2ea98 docs: fix parameters display in module reference (#5425)
* prettify json output

* fix parameter optional + array children
2023-10-19 19:34:17 +03:00
Shahed Nasser
8d0a45ec14 chore: added TSDocs to product module service interface (#5341)
* added tsdocs for product module service

* general fixes

* added generate github action

* fix typedoc configurations

* update comments

* change configurations

* address PR feedback
2023-10-18 19:41:53 +03:00
Shahed Nasser
2d74ec256f docs: resdesign and restructure modules references (#5372)
* docs: change format of module reference

* description fix

* update structure + comments

* added new options to README

* small text fix

* change section ordering

* change how required/optional are shown

* remove optional text

* docs: redesigned accordion
2023-10-16 19:51:55 +03:00
Shahed Nasser
f0af8ecc89 docs: generate pricing module reference (#5349)
* docs: generate pricing module reference

* added notes about new configurations
2023-10-11 14:08:19 +03:00
Shahed Nasser
9c1c19f409 chore(docs-util): fix dependencies installation (#5345) 2023-10-11 10:46:06 +03:00
github-actions[bot]
daea35fe73 chore(docs): Generated JS Client Reference (#5334)
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2023-10-10 17:47:07 +00:00
Shahed Nasser
57bd38bb4b chore: added and improved TSDoc of pricing module (#5335)
* adjusted tsdoc of methods and types in pricing module

* finished adding tsdocs

* small fixes

* remove reference files

* added github action

* fix typo in outPath

* Update packages/types/src/shared-context.ts

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* fix sharedContext description

* changed branch name of action

* added ignore for is_dynamic

* added private remark

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2023-10-10 13:23:54 +03:00
Shahed Nasser
418ff2a33a chore: fix tsconfig in utils (#5328) 2023-10-09 18:19:00 +03:00
Shahed Nasser
85c4cdf9af chore: fix path prefix of reference generation scripts (#5324)
* chore: fix path prefix of reference generation scripts

* fix build step
2023-10-09 16:43:54 +03:00
Shahed Nasser
ce93d75cc5 chore: fix generate reference command name in action (#5320)
* chore: fix generate reference command name

* fix require path in typedoc config

* add missing dependencies
2023-10-09 13:45:19 +03:00
Shahed Nasser
0350eeb0a1 docs: create typedoc theme and plugins for references (#5297)
* update typedoc and its plugins

* refactor existing typedoc configurations

* added new typedoc plugin and themes

* added more customization options

* added more customization options

* refactored doc-utils to a workspace

* fix tsconfig

* update README files

* remove comments

* revert type changes

* remove dependencies no longer needed

* removed modules action
2023-10-05 12:09:42 +03:00
Patrick
1456056e8f feat(oas): new medusa-oas docs for Redocly and circular references (#3745)
## What

New `medusa-oas docs` to improve OAS compatibility with for Redocly API documentation viewer and handle deep circular references.

## Why

We wish to share the tooling we have been using to generate our public API documentation.

## How

* Move `/docs-utils/redocly` under `medusa-oas-cli` package.
* Move  some of the operations from `oas-github-ci/scripts/build-openapi.js` under the `medusa-oas docs` command.
* Improve DevX when dealing with circular references by outputting precise troubleshooting recommendations in the error message.
* Extract some common operations in utility methods.

## Tests

### Step 1
* Run `yarn install`
* Run `yarn build`
* Run `yarn openapi:generate --dry-run`
* Expect same behaviour as before where OAS is validated and circular references are checked.

### Step 2
* Run `yarn openapi:generate`
* Expect same behaviour as before where API documentation is generated in `/docs`

### Step 3
* Move to the `packages/oas/medusa-oas-cli`
* Run `yarn medusa-oas oas --type store --out-dir ~/tmp/oas` to generate the raw OAS file.
* Run `yarn medusa-oas docs --src-file ~/tmp/oas/store.oas.json --preview`
* Open url from the console output in a browser
* Expect a preview of the API documentation using Redocly.

### Step 4
* Run `yarn medusa-oas docs --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/docs/store --clean --split`
* Expect a similiar output as `yarn openapi:generate`

### Step 5
* Run `yarn medusa-oas docs --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/docs/store --clean --html`
* Expect `index.html` to have been created.
* Run `npx http-server ~/tmp/docs/store -p 8000`
* Open http://127.0.0.1:8000 in a browser.
* Expect a zero-dependency static rendering of the API documentation using Redocly.

### Step 6
* To emulate an unhandled circular reference, edit [packages/oas/medusa-oas-cli/redocly/redocly-config.yaml](d180f47e16/packages/oas/medusa-oas-cli/redocly/redocly-config.yaml (L9-L10)) and comment out "Address: - Customer"
* Run `yarn medusa-oas docs --src-file ~/tmp/oas/store.oas.json --dry-run`
* Expect an error message with a hint on how to resolve the issue.
* Create a file `~/tmp/redocly-config.yaml` and paste in the recommendation from the error message.
* Run `yarn medusa-oas docs --src-file ~/tmp/oas/store.oas.json --dry-run --config ~/tmp/redocly-config.yaml` 
* Expect Dry run to succeed.
2023-04-12 17:16:15 +00:00
Patrick
f3bf351d21 feat(oas): pluralize OAS tags (#3315)
## What

Pluralize OAS tags

## Why

OAS tags are commonly used by code generator to group routes under a name space based on a tag. 

Our JS client convention is to use plural, e.g: client.products, client.customers. In order to minimize friction when migrating to a client generated from OAS, tags should be plural as well.

## How

Match tag naming with JS client resource naming.

## Test

* Run `yarn build`
* Run `yarn openapi:generate`
* Run `yarn redocly preview-docs docs/api/admin/openapi.yaml --config=./docs-util/redocly/config.yaml`
* Expect side menu items to be plural.
* Run `yarn redocly preview-docs docs/api/store/openapi.yaml --config=./docs-util/redocly/config.yaml`
* Expect side menu items to be plural.
2023-02-23 13:31:51 +00:00
Patrick
8137061908 feat(oas): medusa-oas-cli as OAS build tool (#3213)
## What

Introduce a CLI for extracting OAS from the core `medusa` package.

## Why

We need to decouple OAS tooling from documentation tooling in order to allow packages and external systems to leverage our OAS has a dependency.

## How

Introduce a new OAS workspace within packages in order to organize current and future OAS related package. Only 1 OAS package for now.

Introduce a new CLI only package to act as the main gateway for all upcoming OAS tooling. Only 1 command for now.

Update documentation tooling pertaining to OAS to use the CLI instead.

## Test

### Prerequisite
From the monorepo root:
* `yarn install`
* `yarn build`

### Documentation

#### Case - validation only - success
* Run `yarn openapi:generate --dry-run`
* Expect console output `🟢 Valid OAS` but no mention of `🔵 Exported OAS`

#### Case - validation only - invalid
* Introduce a bug by renaming `@schema Cart` to `@schema Kart` in [models/cart.ts](0adb0d9ff9/packages/medusa/src/models/cart.ts (L2))
* Run `yarn build` to update `@medusajs/medusa` package with the bug.
* Run `yarn openapi:generate --dry-run`
* Expect console output `🔴 Invalid OAS` with a stack trace of the issue.

#### Case - docs generation
* Run `yarn openapi:generate`
* Expect `docs/api/` directory to contain:
  * `admin.oas.json` (raw OAS)
  * `store.oas.json` (raw OAS)
  * `admin.oas.yaml` (sanitized OAS)
  * `store.oas.yaml` (sanitized OAS)
  * `admin/` (updated redocly split output)
  * `store/` (updated redocly split output)

### CLI

#### Case - crawl additional paths
* From a local medusa server (`medusa-starter-default`), add an `index.ts` file in `src/models/`
* In the `index.ts`, add dummy OAS JSDoc like `/** @schema Foobar */`
* From the root of the monorepo, run `yarn medusa-oas --type store --paths path-to-medusa-server/src`
* Expect a `store.oas.json` to be created at the root of the monorepo.
* The `store.oas.json` should contain an additional `Foobar` entry in `components.schemas`.
2023-02-15 14:55:58 +00:00
Patrick
53532df8d5 feat(OAS): sanitize circular reference for Redocly (#3198)
### What

Add OAS build step to patch known circular references that prevent Redocly from rendering the API documentation.

### Why

We've encountered crashing and loading issues with Redocly when the OAS contained circular references. We have been working around the limitation by omitting some known problematic $ref in our source OAS. We wish to move away from this strategy in order to always explicitly include $ref in our OAS.

### How

We are introducing a custom Redocly CLI plugin that will replace `$ref` by `type: object` base on a configurable set of instructions. These instructions can be modified in `docs-util/redocly/config.yaml`

We are adding a `redocly bundle` step in the current OAS build process in order to sanitize problematic circular references.

We updated the redocly-cli package version in order to ensure that plugins are supported.

### Test

We will use [Cart.payment](fd5c185159/packages/medusa/src/models/cart.ts (L72-L74)) to ensure that the new process is properly sanitizing.

* Run `yarn openapi:generate`
* Open `docs/api/store/components/schemas/Cart.yaml`
  * Expect the `payment` property to have been sanitized to `type: object`
* Run `yarn redocly preview-docs docs/api/store/openapi.yaml --config=docs-util/redocly/config.yaml`
* Visit http://127.0.0.1:8080/#tag/Cart/operation/GetCartsCart
  * In the response, expect cart.payment to not list the properties of the Payment schema.
2023-02-08 13:01:03 +00:00
Shahed Nasser
c1659f81ac chore: cleanup typedoc plugin (#2801)
* chore: added gitignore for typedoc plugin

* remove unnecessary files

* docs: added a note about building the plugin

* chore: added .yarn to gitignore

Co-authored-by: olivermrbl <oliver@mrbltech.com>
2022-12-14 19:48:48 +02:00
Shahed Nasser
2ffeaf567f docs: delete unused doc files (#2732) 2022-12-06 18:13:38 +02:00
Carlos R. L. Rodrigues
c3f8297599 feat(medusa): manage payment sessions from payment collection (#2402)
* feat: manage payment sessions from payment collection
2022-11-02 13:34:29 -03:00
Carlos R. L. Rodrigues
a94d9816fe chore: Centralise ESLint rules (#2162)
* chore: centrilize eslint rules
2022-09-13 07:42:33 -03:00
Adrien de Peretti
bd031ef7ad feat(medusa:) Convert PaymentProvider + PaymentProviderInterface to TS + (#1773)
* feat(payments): Refactor core Payment related

* fix(medusa): typings

* test(unit): fix suite

* test(unit): fix suite

* feat(medusa): Improve payment provider container typings

* fix(medusa): typings

* styles(medusa): renove comments

* feat(medusa): cleanup

* feat(medusa): Add uniq constraint on payment session and idem key on create-payment-session end point

* fix(medusa): migration

* fix(medusa): create payment session

* feat(medusa): cleanup
2022-08-10 17:26:16 +02:00
Shahed Nasser
3b28f46705 docs: added reference for JS Client (#1629)
* added reference for JS Client

* added reference for JS Client

* added reference for JS Client
2022-07-08 18:21:46 +03:00
Sebastian Mateos Nicolajsen
897ccf475a Feat/note on order (#399)
* added NoteService and related endpoints && tests

* removed snapshots

* corrected error in service

* removed snapshot

* added the ability to note down author using a string

* updated model for note

* refactored to access logged in user

* added other user id option

* removed snapshot

* updated according to feedback

* removed snapshots

* reintroduced snapshots

* updated to snake case

* removed try catch from use-db
2021-09-22 15:19:35 +02:00
Sebastian Rindom
31d5bb017d fix: merge 2021-03-16 22:27:09 +01:00
Sebastian Rindom
3d0dff58c4 docs: fixture improvements + small fixes (#204)
* fix: deref arrays

* docs: clean up

* fix: update license
2021-03-16 18:15:41 +01:00
Sebastian Rindom
7c7f86e8e8 fix: allows shipping option filters in return (#202)
* fix: allows shipping option filters in return

* fix: test

* chore: update fixtures

* docs: update openapi
2021-03-12 14:23:03 +01:00
Sebastian Rindom
8edb32c742 docs: oas (#197)
Adds OpenAPI specification of Storefront and Admin APIs.
Updates docs project.
2021-03-10 11:51:54 +01:00