fix
This commit is contained in:
1 parent
321f11e817
commit
6fcdc74843
157 files changed
+2895
-7544
No files matched your search
@@ -132,5 +132,44 @@ export function validateDocsGuideTree(tree: DocsGuideTree): string[] {
|
||||
errors.push(`escapeLinks docs href must use RapiDoc ids (no braces): ${link.href}`);
|
||||
}
|
||||
}
|
||||
collectForbiddenDocsCopy(tree, errors);
|
||||
return errors;
|
||||
}
|
||||
|
||||
function rejectForbiddenDocsCopy(where: string, text: string | undefined, errors: string[]): void {
|
||||
if (!text) return;
|
||||
if (/legacy/i.test(text)) {
|
||||
errors.push(`${where} must not mention legacy`);
|
||||
}
|
||||
if (/\bA1\b/.test(text)) {
|
||||
errors.push(`${where} must not mention A1`);
|
||||
}
|
||||
}
|
||||
|
||||
function collectForbiddenDocsCopy(tree: DocsGuideTree, errors: string[]): void {
|
||||
rejectForbiddenDocsCopy("disclaimer", tree.disclaimer, errors);
|
||||
for (const link of tree.escapeLinks) {
|
||||
rejectForbiddenDocsCopy(`escapeLinks "${link.href}"`, link.label, errors);
|
||||
}
|
||||
for (const [id, node] of Object.entries(tree.nodes)) {
|
||||
rejectForbiddenDocsCopy(`node "${id}" title`, node.title, errors);
|
||||
rejectForbiddenDocsCopy(`node "${id}" body`, node.body, errors);
|
||||
if (node.kind === "question") {
|
||||
for (const c of node.choices) {
|
||||
rejectForbiddenDocsCopy(`question "${id}" choice "${c.id}" label`, c.label, errors);
|
||||
rejectForbiddenDocsCopy(`question "${id}" choice "${c.id}" description`, c.description, errors);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
rejectForbiddenDocsCopy(`answer "${id}" outcome`, node.outcome, errors);
|
||||
rejectForbiddenDocsCopy(`answer "${id}" tip`, node.tip, errors);
|
||||
rejectForbiddenDocsCopy(`answer "${id}" warning`, node.warning, errors);
|
||||
rejectForbiddenDocsCopy(`answer "${id}" authNote`, node.authNote, errors);
|
||||
for (const ep of node.endpoints ?? []) {
|
||||
rejectForbiddenDocsCopy(`answer "${id}" endpoint ${ep.method} ${ep.path}`, ep.summary, errors);
|
||||
}
|
||||
for (const link of node.links ?? []) {
|
||||
rejectForbiddenDocsCopy(`answer "${id}" link "${link.href}"`, link.label, errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,8 +145,8 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
body: "Do not mix bodies or response envelopes between these two surfaces.",
|
||||
choices: [
|
||||
{
|
||||
id: "legacy",
|
||||
label: "Legacy EAN batch",
|
||||
id: "ean",
|
||||
label: "EAN batch",
|
||||
description: "POST /products/process · { data: { process_id } }",
|
||||
nextId: "answer.process.legacy"
|
||||
},
|
||||
@@ -300,7 +300,7 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
endpoints: [
|
||||
endpoint("GET", "/health", "Liveness (also /healthz and /readyz on the API host)"),
|
||||
endpoint("GET", "/openapi.yaml", "This OpenAPI document"),
|
||||
endpoint("GET", "/products", "List products (legacy { data, meta } envelope)")
|
||||
endpoint("GET", "/products", "List products ({ data, meta } envelope)")
|
||||
],
|
||||
links: [
|
||||
{ label: "Settings → API keys", href: "/settings?tab=api-keys", kind: "app" },
|
||||
@@ -325,7 +325,7 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
endpoints: [
|
||||
endpoint("GET", "/health", "No key required — confirm the viewer reaches the API"),
|
||||
endpoint("GET", "/products", "Authenticated smoke list (page=1&limit=1)"),
|
||||
endpoint("POST", "/products/process", "Legacy process — after Authorize"),
|
||||
endpoint("POST", "/products/process", "EAN batch — after Authorize"),
|
||||
endpoint("POST", "/process", "Jobs process — after Authorize")
|
||||
],
|
||||
links: [
|
||||
@@ -417,20 +417,20 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
"answer.process.legacy": {
|
||||
kind: "answer",
|
||||
id: "answer.process.legacy",
|
||||
pathKey: "process.legacy",
|
||||
pathKey: "process.ean",
|
||||
synonyms: ["ean", "items[].ean", "products/process"],
|
||||
title: "Legacy public process (EAN batch)",
|
||||
outcome: "Start and poll enrichment using the legacy Descrybe contract.",
|
||||
title: "Public process (EAN batch)",
|
||||
outcome: "Start and poll enrichment using POST/GET /products/process.",
|
||||
body: "POST body uses items[].ean (preferred). Handler also accepts raw_product_ids as an alternate on this same path. Responses use HTTP 200 with { data: { process_id, … } } and completed items[] when done.",
|
||||
authNote: AUTH_NOTE,
|
||||
endpoints: [
|
||||
endpoint("POST", "/products/process", "Start processing by EAN (legacy public contract)"),
|
||||
endpoint("POST", "/products/process", "Start processing by EAN"),
|
||||
endpoint("GET", "/products/process/{id}", "Processing job status by process_id")
|
||||
],
|
||||
links: [
|
||||
{ label: "Legacy start in docs", href: docsOperationHref("POST", "/products/process"), kind: "docs" },
|
||||
{ label: "Start in docs", href: docsOperationHref("POST", "/products/process"), kind: "docs" },
|
||||
{
|
||||
label: "Legacy status in docs",
|
||||
label: "Status in docs",
|
||||
href: docsOperationHref("GET", "/products/process/{id}"),
|
||||
kind: "docs"
|
||||
},
|
||||
@@ -448,7 +448,7 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
synonyms: ["raw_product_ids", "cancel job", "retry job"],
|
||||
title: "Dashboard-style processing jobs",
|
||||
outcome: "Start flat JSON jobs by raw_product_ids; poll, cancel, or retry.",
|
||||
body: "Same body shape as dashboard POST /api/processing/jobs. Start/retry return 202 Accepted with flat JSON (no data wrapper). Prefer /products/process for legacy integrations.",
|
||||
body: "Same body shape as dashboard POST /api/processing/jobs. Start/retry return 202 Accepted with flat JSON (no data wrapper). Prefer /products/process for EAN-batch integrations.",
|
||||
authNote: AUTH_NOTE,
|
||||
endpoints: [
|
||||
endpoint("POST", "/process", "Start processing job by raw_product_ids"),
|
||||
@@ -473,15 +473,15 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
pathKey: "process.which",
|
||||
synonyms: ["which process", "dual contract"],
|
||||
title: "Which process API should I use?",
|
||||
outcome: "Pick legacy EAN for integrations; pick /process for dashboard-style jobs.",
|
||||
body: "1) Legacy public: POST/GET /products/process — items[].ean, HTTP 200 { data: { process_id } }. 2) Jobs: POST/GET /process — raw_product_ids, flat JSON, 202 on start. Mixing envelopes is the most common integration bug.",
|
||||
outcome: "Pick EAN batch for integrations; pick /process for dashboard-style jobs.",
|
||||
body: "1) Public process: POST/GET /products/process — items[].ean, HTTP 200 { data: { process_id } }. 2) Jobs: POST/GET /process — raw_product_ids, flat JSON, 202 on start. Mixing envelopes is the most common integration bug.",
|
||||
authNote: AUTH_NOTE,
|
||||
endpoints: [
|
||||
endpoint("POST", "/products/process", "Legacy EAN batch"),
|
||||
endpoint("POST", "/products/process", "EAN batch"),
|
||||
endpoint("POST", "/process", "Dashboard-style jobs")
|
||||
],
|
||||
links: [
|
||||
{ label: "Legacy process", href: docsOperationHref("POST", "/products/process"), kind: "docs" },
|
||||
{ label: "EAN process", href: docsOperationHref("POST", "/products/process"), kind: "docs" },
|
||||
{ label: "Jobs process", href: docsOperationHref("POST", "/process"), kind: "docs" },
|
||||
{
|
||||
label: "Dual-mode overview",
|
||||
@@ -575,13 +575,13 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
endpoints: [
|
||||
endpoint("GET", "/categories", "List categories"),
|
||||
endpoint("POST", "/categories", "Create category"),
|
||||
endpoint("POST", "/categories/create", "Create category (legacy alias)"),
|
||||
endpoint("POST", "/categories/create", "Create category (alias of POST /categories)"),
|
||||
endpoint("GET", "/categories/{id}", "Get category by UUID"),
|
||||
endpoint("PATCH", "/categories/{id}", "Update category"),
|
||||
endpoint("DELETE", "/categories/{id}", "Delete category by unique_id"),
|
||||
endpoint("GET", "/attributes", "List attributes"),
|
||||
endpoint("POST", "/attributes", "Create attribute"),
|
||||
endpoint("POST", "/attributes/create", "Create attribute (legacy alias)"),
|
||||
endpoint("POST", "/attributes/create", "Create attribute (alias of POST /attributes)"),
|
||||
endpoint("PATCH", "/attributes/{id}", "Update attribute"),
|
||||
endpoint("DELETE", "/attributes/{id}", "Delete attribute")
|
||||
],
|
||||
@@ -592,7 +592,7 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
{ label: "Attributes tag", href: docsTagHref("Attributes"), kind: "docs" },
|
||||
{ label: "Authorize", href: docsAuthHref(), kind: "docs" }
|
||||
],
|
||||
tip: "Prefer canonical POST /categories and POST /attributes; /create aliases exist for legacy clients.",
|
||||
tip: "Prefer canonical POST /categories and POST /attributes; /create aliases exist for existing integrations.",
|
||||
relatedIds: ["answer.feeds.mapping", "answer.products"]
|
||||
},
|
||||
|
||||
@@ -615,7 +615,7 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
{ label: "Try GET /products", href: docsOperationHref("GET", "/products"), kind: "docs" },
|
||||
{ label: "Authorize", href: docsAuthHref(), kind: "docs" }
|
||||
],
|
||||
tip: "List uses legacy query params: page, limit, status, search, sortBy, sortOrder, feedId.",
|
||||
tip: "List uses query params: page, limit, status, search, sortBy, sortOrder, feedId.",
|
||||
relatedIds: ["answer.products.quality", "answer.process.legacy"]
|
||||
},
|
||||
|
||||
@@ -648,13 +648,13 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
synonyms: ["campaigns", "calendar", "seasonal"],
|
||||
title: "Marketing calendar (API)",
|
||||
outcome: "List seasonal presets and prepare a calendar export via the public API.",
|
||||
body: "Public /api/v1/marketing/calendar* (and legacy /campaigns aliases) are API-key routes for the content calendar. They are separate from session email campaigns under /api/campaigns in the dashboard UI.",
|
||||
body: "Public /api/v1/marketing/calendar* (and /campaigns aliases) are API-key routes for the content calendar. They are separate from session email campaigns under /api/campaigns in the dashboard UI.",
|
||||
authNote: AUTH_NOTE,
|
||||
endpoints: [
|
||||
endpoint("GET", "/marketing/calendar", "List seasonal campaign presets"),
|
||||
endpoint("POST", "/marketing/calendar/prepare", "Prepare seasonal campaign export"),
|
||||
endpoint("GET", "/campaigns", "List presets (legacy alias)"),
|
||||
endpoint("POST", "/campaigns/prepare", "Prepare export (legacy alias)")
|
||||
endpoint("GET", "/campaigns", "List presets (alias of GET /marketing/calendar)"),
|
||||
endpoint("POST", "/campaigns/prepare", "Prepare export (alias of POST /marketing/calendar/prepare)")
|
||||
],
|
||||
links: [
|
||||
{
|
||||
@@ -684,7 +684,7 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
{ label: "Settings", href: "/settings", kind: "app" },
|
||||
{ label: "Contact support", href: "/support/new", kind: "support" }
|
||||
],
|
||||
tip: "After upgrading, retry the same process endpoint you already chose (legacy vs jobs).",
|
||||
tip: "After upgrading, retry the same process endpoint you already chose (EAN batch vs jobs).",
|
||||
relatedIds: ["answer.error.job", "answer.process.chooser"]
|
||||
},
|
||||
|
||||
@@ -722,7 +722,7 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
authNote: AUTH_NOTE,
|
||||
endpoints: [
|
||||
endpoint("POST", "/feeds/{id}/sync", "Sync (rate-limited)"),
|
||||
endpoint("POST", "/products/process", "Legacy process (rate-limited)"),
|
||||
endpoint("POST", "/products/process", "EAN process (rate-limited)"),
|
||||
endpoint("POST", "/process", "Jobs process (rate-limited)"),
|
||||
endpoint("POST", "/export-feeds/{id}/generate", "Generate export (rate-limited)")
|
||||
],
|
||||
@@ -741,10 +741,10 @@ export const DOCS_GUIDE_TREE: DocsGuideTree = {
|
||||
synonyms: ["job failed", "pending", "cancel", "retry"],
|
||||
title: "Process job pending or failed",
|
||||
outcome: "Poll the matching status endpoint; cancel/retry only on the /process job surface.",
|
||||
body: "Legacy: GET /products/process/{id} (data envelope). Jobs: GET /process/{id} plus POST …/cancel|terminate|retry. Confirm you started the job on the same contract you are polling.",
|
||||
body: "EAN batch: GET /products/process/{id} (data envelope). Jobs: GET /process/{id} plus POST …/cancel|terminate|retry. Confirm you started the job on the same contract you are polling.",
|
||||
authNote: AUTH_NOTE,
|
||||
endpoints: [
|
||||
endpoint("GET", "/products/process/{id}", "Legacy poll"),
|
||||
endpoint("GET", "/products/process/{id}", "EAN batch poll"),
|
||||
endpoint("GET", "/process/{id}", "Jobs poll"),
|
||||
endpoint("POST", "/process/{id}/retry", "Retry failed/cancelled job")
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user