Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(oas): add missing x-codegen + fix schema naming and $ref #3312

Merged
merged 4 commits into from
Feb 22, 2023

Conversation

patrick-medusajs
Copy link
Contributor

What

Add missing x-codegen + fix schema naming and $ref

Why

OAS code generator was missing information to be able to match current JS client.

How

Ensure OAS matches JS client methods.

@patrick-medusajs patrick-medusajs self-assigned this Feb 22, 2023
@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2023

🦋 Changeset detected

Latest commit: 0378708

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@medusajs/medusa Patch
@medusajs/inventory Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor Author

@patrick-medusajs patrick-medusajs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review: highlighting noteworthy code changes

@@ -13,6 +13,9 @@ import { joinLevels } from "./utils/join-levels"
* - (path) id=* {string} The ID of the Inventory Item.
* - (query) expand {string} Comma separated list of relations to include in the results.
* - (query) fields {string} Comma separated list of fields to include in the results.
* x-codegen:
* method: retrieve
* queryParams: AdminGetInventoryItemsItemParams
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retrieve(
inventoryItemId: string,
query?: AdminGetInventoryItemsItemParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminInventoryItemsRes> {

@@ -51,6 +51,9 @@ import { AdminInventoryItemsListWithVariantsAndLocationLevelsRes } from "."
* - (query) height {string} height to search for.
* - (query) width {string} width to search for.
* - (query) requires_shipping {string} requires_shipping to search for.
* x-codegen:
* method: list
* queryParams: AdminGetInventoryItemsParams
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list(
query?: AdminGetInventoryItemsParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminInventoryItemsListWithVariantsAndLocationLevelsRes> {

@@ -15,6 +15,9 @@ import { FindParams } from "../../../../types/common"
* - (query) limit=20 {integer} Limit the number of stock locations levels returned.
* - (query) expand {string} Comma separated list of relations to include in the results.
* - (query) fields {string} Comma separated list of fields to include in the results.
* x-codegen:
* method: listLocationLevels
* queryParams: AdminGetInventoryItemsItemLocationLevelsParams
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listLocationLevels(
inventoryItemId: string,
query?: AdminGetInventoryItemsItemLocationLevelsParams,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminInventoryItemsLocationLevelsRes> {

@@ -63,6 +63,9 @@ import {
* - (query) limit=20 {integer} Limit the number of Reservations returned.
* - (query) expand {string} (Comma separated) Which fields should be expanded in the product category.
* - (query) fields {string} (Comma separated) Which fields should be included in the product category.
* x-codegen:
* method: list
* queryParams: AdminGetReservationsParams
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list(
query?: AdminGetReservationsParams,
customHeaders: Record<string, unknown> = {}
): ResponsePromise<AdminReservationsListRes> {

@@ -56,7 +56,7 @@ export default (app) => {
}

/**
* @schema AdminPostReservationsReq
* @schema AdminReservationsRes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: schema name was not matching type name

@@ -69,7 +69,7 @@ export type AdminReservationsRes = {
}

/**
* @schema AdminGetReservationReservationsReq
* @schema AdminReservationsListRes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: schema name was not matching type name

@patrick-medusajs patrick-medusajs marked this pull request as ready for review February 22, 2023 14:10
@patrick-medusajs patrick-medusajs requested a review from a team as a code owner February 22, 2023 14:10
Copy link
Contributor

@pKorsholm pKorsholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😄

@@ -40,7 +40,7 @@ import { extendedFindParamsMixin } from "../../../../types/common"
* content:
* application/json:
* schema:
* $ref: "#/components/schemas/AdminGetReservationReservationsReq"
* $ref: "#/components/schemas/AdminReservationsRes"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be AdminReservationsListRes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 🎣 . Done in efda8f4

Copy link
Member

@shahednasser shahednasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kodiakhq kodiakhq bot merged commit 935870e into develop Feb 22, 2023
@kodiakhq kodiakhq bot deleted the fix/oas-inventory branch February 22, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants