-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 to res class JSDoc OAS (Admin A-C) #3002
Conversation
|
There was a problem hiding this 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.
export type AdminBatchJobRes = { | ||
batch_job: BatchJob | ||
} | ||
|
||
export type AdminBatchJobDeleteRes = DeleteResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find usage in codebase. Delete operation not implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, it is mostly for consistency if the client lib want to use it
export type AdminDeleteProductsFromCollectionRes = { | ||
id: string | ||
object: string | ||
removed_products: string[] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/collections/remove-products.ts
response shape had not equivalent class declared.
Our JS client is wrongfully typed with AdminCollectionsDeleteRes
. See file.
* limit: | ||
* type: integer | ||
* description: The number of items per page | ||
* $ref: "#/components/schemas/AdminCustomersListRes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this endpoint references a response shape from admin/customers/
and not admin/customer-groups/
since it returns a list of customers.
export type AdminCustomersRes = { | ||
customer: Customer | ||
} | ||
|
||
export type AdminCustomersDeleteRes = DeleteResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't find usage in codebase. Delete operation not implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! 🎉 would get a second pair of eyes on this tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looping in @shahednasser for final sign off 💪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe should be good to merge! 😄
Scope
Admin routes directories A to C.
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
Expect no visible changes to the documentation.