Files
progcode/web/public/assets/editorial/2019/rest-api-contract-map-2019.svg
huncode 18adfa80b4
Build and deploy / deploy (push) Successful in 13s
revise June and August 2019 articles
2026-07-31 10:49:16 +03:00

45 lines
4.1 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 1160" role="img" aria-labelledby="title desc">
<title id="title">Контракт одной REST API-операции</title>
<desc id="desc">Вертикальная схема показывает запрос списка заказов, явную развилку ответов 200 и 400 и проверку клиентом статуса, Content-Type и схемы тела.</desc>
<rect width="720" height="1160" fill="#0f172a"/>
<rect x="42" y="34" width="636" height="112" rx="18" fill="#172554"/>
<text x="360" y="80" text-anchor="middle" fill="#ffffff" font-size="29" font-family="Arial, sans-serif" font-weight="700">Контракт одной операции</text>
<text x="360" y="116" text-anchor="middle" fill="#cbd5e1" font-size="22" font-family="Arial, sans-serif">URL — только начало договора</text>
<rect x="85" y="190" width="550" height="132" rx="18" fill="#0f766e" stroke="#5eead4" stroke-width="3"/>
<text x="360" y="234" text-anchor="middle" fill="#ffffff" font-size="28" font-family="Arial, sans-serif" font-weight="700">GET /api/v1/orders</text>
<text x="360" y="270" text-anchor="middle" fill="#ccfbf1" font-size="23" font-family="Arial, sans-serif">limit=20; cursor — строка или отсутствует</text>
<path d="M360 322v48" stroke="#cbd5e1" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="175" y="376" width="370" height="58" rx="29" fill="#fef3c7"/>
<text x="360" y="414" text-anchor="middle" fill="#1e293b" font-size="22" font-family="Arial, sans-serif" font-weight="700">проверка входа</text>
<path d="M360 434v40" stroke="#cbd5e1" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="85" y="480" width="550" height="148" rx="18" fill="#14532d" stroke="#86efac" stroke-width="3"/>
<text x="360" y="526" text-anchor="middle" fill="#ffffff" font-size="29" font-family="Arial, sans-serif" font-weight="700">200 OK · application/json</text>
<text x="360" y="564" text-anchor="middle" fill="#dcfce7" font-size="23" font-family="Arial, sans-serif">items: Order[]</text>
<text x="360" y="598" text-anchor="middle" fill="#dcfce7" font-size="23" font-family="Arial, sans-serif">page.nextCursor: string | null</text>
<path d="M360 628v44" stroke="#cbd5e1" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="85" y="678" width="550" height="148" rx="18" fill="#7f1d1d" stroke="#fca5a5" stroke-width="3"/>
<text x="360" y="724" text-anchor="middle" fill="#ffffff" font-size="29" font-family="Arial, sans-serif" font-weight="700">400 Bad Request</text>
<text x="360" y="762" text-anchor="middle" fill="#fee2e2" font-size="23" font-family="Arial, sans-serif">application/problem+json</text>
<text x="360" y="796" text-anchor="middle" fill="#fee2e2" font-size="23" font-family="Arial, sans-serif">type, status, detail, errors[].code</text>
<path d="M360 826v44" stroke="#cbd5e1" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="70" y="876" width="580" height="170" rx="18" fill="#1e293b" stroke="#64748b" stroke-width="3"/>
<text x="360" y="924" text-anchor="middle" fill="#ffffff" font-size="27" font-family="Arial, sans-serif" font-weight="700">Клиент проверяет три вещи</text>
<text x="360" y="962" text-anchor="middle" fill="#cbd5e1" font-size="23" font-family="Arial, sans-serif">1. HTTP status</text>
<text x="360" y="994" text-anchor="middle" fill="#cbd5e1" font-size="23" font-family="Arial, sans-serif">2. Content-Type</text>
<text x="360" y="1026" text-anchor="middle" fill="#cbd5e1" font-size="23" font-family="Arial, sans-serif">3. schema тела</text>
<rect x="70" y="1080" width="580" height="46" rx="14" fill="#334155"/>
<text x="360" y="1111" text-anchor="middle" fill="#e2e8f0" font-size="21" font-family="Arial, sans-serif">JSON сам по себе не равен успеху</text>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
<path d="M0 0L10 5L0 10z" fill="#cbd5e1"/>
</marker>
</defs>
</svg>