This commit is contained in:
seb
2026-10-04 19:12:33 +02:00
parent a8e51724f8
commit a3926d3547
9 changed files with 165 additions and 17 deletions

View File

@@ -14615,8 +14615,8 @@
}
},
"post": {
"summary": "Add a child article to a father article",
"description": "Automatically generates SKU as fatherSku-nextFreeIndex (or accepts custom sku) and assigns the variant attribute.",
"summary": "Create and attach a new child article to a father article",
"description": "Automatically generates SKU as fatherSku-nextFreeIndex and name from father name + value. Rejects a caller-supplied sku.",
"tags": [
"Article"
],
@@ -14654,10 +14654,6 @@
"name": {
"type": "string",
"description": "Optional custom variant name"
},
"sku": {
"type": "string",
"description": "Optional custom SKU for the child article"
}
}
}
@@ -14681,7 +14677,93 @@
}
},
"400": {
"description": "Father not configured as father, missing value, duplicate variant, or child SKU already exists"
"description": "Father not configured as father, missing value, duplicate variant, or sku was provided in body"
}
}
},
"put": {
"summary": "Attach an existing article as a child to a father article",
"description": "Attaches an existing article to this father article. Idempotent if already a child. Returns 409 if the article already belongs to another father.",
"tags": [
"Article"
],
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "sku",
"required": true,
"schema": {
"type": "string"
},
"description": "Father article SKU"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"sku"
],
"properties": {
"sku": {
"type": "string",
"description": "SKU of the existing article to attach as child"
},
"attributeValueId": {
"type": "integer",
"description": "ID of existing attribute value for the father's attribute"
},
"value": {
"type": "string",
"description": "String value to find or create under the father's attribute"
},
"reparent": {
"type": "boolean",
"description": "Whether to allow re-parenting if child already belongs to another father"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Attached child article and list of children",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"article": {
"$ref": "#/components/schemas/Article"
},
"children": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
}
}
},
"400": {
"description": "Missing sku or attribute value, or invalid input"
},
"404": {
"description": "Father or child article not found"
},
"409": {
"description": "Article already belongs to another father, or variant value already exists"
}
}
}