📐 Attribute schemas
Attribute schemas define the reusable group shape and the body, path, and query contracts consumed by Attribute routes.
Inventory
| Export | Request location | Contract |
|---|---|---|
attributesSchema | N/A | Optional name and non-empty items; top-level additional properties are rejected. |
createAttributesSchema | Body | name and items required. |
updateAttributesSchema | Path, body | Optional name only; additional properties rejected. |
getAttributeSchema | Path | String attribute-group ID. |
deleteAttributeSchema | Path | String attribute-group ID. |
findAttributesSchema | Query | String name filter plus shared pagination parameters. |
View shared source context
const attributeIdPathParameter: OpenAPIParameter = {
in: 'path',
name: 'attributeId',
required: true,
schema: {
type: 'string',
},
};
export const paginationQueryParametersSchema: OpenAPIParameter[] = [
{
in: 'query',
name: 'page',
required: false,
schema: {
maximum: 1000,
minimum: 1,
type: 'integer',
},
},
{
in: 'query',
name: 'limit',
required: false,
schema: {
maximum: 50,
minimum: 1,
type: 'integer',
},
},
];
Details
attributesSchema
Definition
Reusable stored/request shape. The top-level object has additionalProperties: false; its nested items objects do not declare that restriction in source.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| N/A | name | string | No | — |
| N/A | items | array | No | minItems: 1 |
| Item | key | string | Yes | — |
| Item | value | string | Yes | — |
Used by feature: N/A — reusable schema.
Used by route: N/A — reused by createAttributesSchema.
Composed by: createAttributesSchema.View complete source
createAttributesSchema
Definition
Required JSON body using the reusable shape. name and items are required; top-level additional properties are rejected.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Body | name | string | Yes | — |
| Body | items | array | Yes | At least one item |
| Body item | key | string | Yes | — |
| Body item | value | string | Yes | — |
Used by feature: createAttributeFeature.
Used by route: createAttributeRoute.View complete source
updateAttributesSchema
Definition
Requires a string attributeId path parameter and a JSON body. The schema permits {} because it declares no required body field, but updateAttributeGroup rejects an empty body with 400.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | attributeId | string | Yes | — |
| Body | name | string | No | No additional body properties |
Used by feature: updateAttributeFeature.
Used by route: updateAttributeRoute.View complete source
getAttributeSchema
Definition
Requires the string attributeId path parameter.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | attributeId | string | Yes | — |
Used by feature: getAttributeFeature.
Used by route: getAttributeRoute.View complete source
deleteAttributeSchema
Definition
Requires the string attributeId path parameter.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Path | attributeId | string | Yes | — |
Used by feature: deleteAttributeFeature.
Used by route: deleteAttributeRoute.View complete source
findAttributesSchema
Definition
Optional query contract. name is an Attribute-specific string filter; pagination fields come from paginationQueryParametersSchema.
| Location | Field | Type | Required | Constraints |
|---|---|---|---|---|
| Query | name | string | No | — |
| Query | page | integer | No | Minimum 1, maximum 1000 |
| Query | limit | integer | No | Minimum 1, maximum 50 |
Used by feature: findAttributesFeature.
Used by route: findAttributesRoute.View complete source