📐 Category schemas
Category schemas validate reusable category data and each Category route's path, body, or query inputs.
Inventory
| Export | Request location | Contract |
|---|---|---|
categorySchema | N/A | Optional description, name, parent, and status strings; rejects additional properties. |
createCategorySchema | Body | Base object with required name, description, and status. |
updateCategorySchema | Path, body | categoryId plus optional description, name, and parent. |
getCategorySchema | Path | Required string categoryId. |
deleteCategorySchema | Path | Required string categoryId. |
enableCategorySchema | Path | Required string categoryId. |
disableCategorySchema | Path | Required string categoryId. |
findCategoriesSchema | Query | Optional category filters plus page and limit. |
View shared source context
const categoryIdPathParameter: OpenAPIParameter = {
in: 'path',
name: 'categoryId',
required: true,
schema: {
type: 'string',
},
};
Details
categorySchema
Definition
Reusable stored/request shape. It accepts no extra properties; creation spreads this shape, while update has a narrower inline body shape.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| N/A | description | string | No | — |
| N/A | name | string | No | — |
| N/A | parent | string | No | — |
| N/A | status | string | No | — |
Used by route: indirectly createCategoryRoute. Used by feature: indirectly createCategoryFeature.View complete source
createCategorySchema
Definition
Requires an application/json body. It spreads categorySchema, so additional properties are rejected; parent is optional.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Body | description | string | Yes | application/json |
| Body | name | string | Yes | application/json |
| Body | parent | string | No | application/json |
| Body | status | string | Yes | application/json |
Used by route: createCategoryRoute. Used by feature: createCategoryFeature.View complete source
updateCategorySchema
Definition
Requires a string categoryId and an application/json body. The body itself is required, but every permitted field is optional; status is not accepted and is changed through the status routes.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | categoryId | string | Yes | — |
| Body | description | string | No | application/json; no additional properties |
| Body | name | string | No | application/json; no additional properties |
| Body | parent | string | No | application/json; no additional properties |
Used by route: updateCategoryRoute. Used by feature: editCategoryFeatures.View complete source
getCategorySchema
Definition
Requires the shared string categoryId path parameter.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | categoryId | string | Yes | — |
Used by route: getCategoryRoute. Used by feature: getCategoryFeatures.View complete source
deleteCategorySchema
Definition
Requires the shared string categoryId path parameter; it has no request body.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | categoryId | string | Yes | — |
Used by route: deleteCategoryRoute. Used by feature: deleteCategoryFeatures.View complete source
enableCategorySchema
Definition
Requires the shared string categoryId path parameter; it has no request body.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | categoryId | string | Yes | — |
Used by route: enableCategoryRoute. Used by feature: enableCategoryStatusFeatures.View complete source
disableCategorySchema
Definition
Requires the shared string categoryId path parameter; it has no request body.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | categoryId | string | Yes | — |
Used by route: disableCategoryRoute. Used by feature: disableCategoryStatusFeatures.View complete source
findCategoriesSchema
Definition
All filters are optional string query parameters. It spreads the shared pagination parameters: page and limit are optional integers from 1 through 1000 and 1 through 50, respectively. At runtime, withPagination defaults them to page 1 and limit 10, removes both fields from the MongoDB filter, and the normalizer preserves the resulting metadata.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Query | description | string | No | — |
| Query | name | string | No | — |
| Query | parent | string | No | — |
| Query | status | string | No | — |
| Query | page | integer | No | minimum 1, maximum 1000; runtime default 1 |
| Query | limit | integer | No | minimum 1, maximum 50; runtime default 10 |
Used by route: findCategoriesRoute. Used by feature: findCategoriesFeatures.View complete source