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

chore(oas): replace response with $ref class JSDoc (Admin SHI-V) #3031

Merged
merged 3 commits into from
Jan 15, 2023

Conversation

patrick-medusajs
Copy link
Contributor

Scope

Admin routes directories SHI to V.

What

Move inline OAS response schema declaration under their respective class declarations in order to expose them through #/components/schemas. Replace inline OAS response schema with a $ref reference pointing to the newly declared schema.

Why

Having response declared as its own "named" schema will allow OAS code generators to output typed entities/DTO that can be consumed without having to reference the route/operation.

How

Declare a new @Schema JSDoc for each "Res" class used to parse and validate request body. Move the current inline requestBody to the new @Schema.

Test

  • Ran OAS validator.
  • Ran docs build script.

Expect no visible changes to the documentation.

@patrick-medusajs patrick-medusajs self-assigned this Jan 13, 2023
@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2023

🦋 Changeset detected

Latest commit: 9ed7b3c

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

This PR includes changesets to release 1 package
Name Type
@medusajs/medusa 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.

* description: Whether or not the items were deleted.
* default: true
*/
export type AdminDeleteShippingProfileRes = DeleteResponse
Copy link
Contributor Author

Choose a reason for hiding this comment

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

simply moved below all relation declarations

export type AdminStockLocationsRes = {
stock_location: StockLocationDTO
}

export type AdminStockLocationsDeleteRes = DeleteResponse
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No usage found across the codebase. Not implemented.

@patrick-medusajs patrick-medusajs marked this pull request as ready for review January 13, 2023 21:27
@patrick-medusajs patrick-medusajs requested a review from a team as a code owner January 13, 2023 21:27
@patrick-medusajs patrick-medusajs requested review from shahednasser and a team January 13, 2023 21:27
Copy link
Contributor

@olivermrbl olivermrbl 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 27a29ef into develop Jan 15, 2023
@kodiakhq kodiakhq bot deleted the chore/oas-response-schema-SHI-V branch January 15, 2023 19:04
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