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: remove products from product collection type in generated references #7812

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/medusa/src/models/product-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class ProductCollection extends SoftDeletableEntity {
@Column({ nullable: true })
handle: string

/**
* @apiIgnore
*/
@OneToMany(() => Product, (product) => product.collection)
products: Relation<Product>[]

Expand Down Expand Up @@ -73,6 +76,7 @@ export class ProductCollection extends SoftDeletableEntity {
* description: The details of the products that belong to this product collection.
* type: array
* x-expandable: "products"
* x-ignore: true
* items:
* $ref: "#/components/schemas/Product"
* created_at:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const TagOperationParameters = ({
const propertyName = schemaObject.parameterName || schemaObject.title || ""

const getElement = () => {
if (schemaObject["x-ignore"]) {
return <></>
}

if (schemaObject.anyOf || schemaObject.allOf) {
return (
<TagOperationParametersUnion
Expand Down Expand Up @@ -106,8 +110,6 @@ const TagOperationParameters = ({
isRequired={isRequired}
/>
)

return <></>
}

return <div className={className}>{getElement()}</div>
Expand Down
1 change: 1 addition & 0 deletions www/apps/api-reference/types/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export type SchemaObject = (ArraySchemaObject | NonArraySchemaObject) & {
isRequired?: boolean
"x-featureFlag"?: string
"x-expandable"?: string
"x-ignore"?: boolean
}

export type PropertiesObject = {
Expand Down
Loading