<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ilya R. on Medium]]></title>
        <description><![CDATA[Stories by Ilya R. on Medium]]></description>
        <link>https://medium.com/@rodin.dev?source=rss-9ecc245fcfde------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wp1b5sSZn2PkQshn7UD-lQ@2x.jpeg</url>
            <title>Stories by Ilya R. on Medium</title>
            <link>https://medium.com/@rodin.dev?source=rss-9ecc245fcfde------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 01:43:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rodin.dev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Stopped Showing Screenshots to My AI Agent]]></title>
            <link>https://javascript.plainenglish.io/how-i-stopped-showing-screenshots-to-my-ai-agent-5e86151af121?source=rss-9ecc245fcfde------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e86151af121</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Ilya R.]]></dc:creator>
            <pubDate>Sun, 04 Oct 2026 21:47:31 GMT</pubDate>
            <atom:updated>2026-10-13T22:38:03.798Z</atom:updated>
            <content:encoded><![CDATA[<h4>My agent now fixes failing Playwright screenshot tests from a few lines of whydiff text instead of three PNGs.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLYZ4gu4sjzltd6V_QfZ8A.png" /><figcaption><strong>Three screenshots of a failed test vs the whydiff report naming the CSS rule</strong></figcaption></figure><p>It usually goes like this. A Playwright screenshot test fails, and my AI agent opens the expected image, the actual image and the diff, looks at a patch of red pixels for a while and then tells me what changed. Often it sees nothing at all. And when it does see something, it’s often wrong.</p><p>So I started describing the screenshots to it myself: “The Save button got wider. The card under it moved down. The header is fine.” At some point I realized I was writing alt text for my own test suite, by hand, just so that a model could read it.</p><p>That held up until a UI library upgrade landed. The suite came back with 123 results, and 117 screens no longer matched their baselines. I wasn’t going to describe 117 screenshots by hand. So I wrote whydiff: it reads the DOM and the CSS under the changed pixels and writes the answer into the failed test.</p><h3>What the failed toHaveScreenshot actually says</h3><p>Before whydiff adds anything, this is all Playwright prints for a failed screenshot assertion:</p><pre>Error: expect(page).toHaveScreenshot(expected) failed<br><br>  5323 pixels (ratio 0.01 of all image pixels) are different.<br><br>  Snapshot: settings.png</pre><p>The first line names the matcher. The second is the count of pixels that pixelmatch flagged, and the ratio is that count divided by the image area, rounded up to two decimals. When the two images differ in size, the line starts with <em>Expected an image 646px by 169px, received 646px by 168px.</em> When there is no baseline yet, you get <em>A snapshot doesn&#39;t exist at ..., writing actual.</em> instead, and the test fails so that you look at the new file before committing it. Playwright up to 1.48 printed <em>Screenshot comparison failed:</em> as the header, which is why that phrase still leads to GitHub issues from 2023. Three PNGs land in <em>test-results/</em>, named <em>-expected</em>, <em>-actual</em> and <em>-diff</em>. Nothing in any of this says which element or which stylesheet changed.</p><h3>Red pixels tell you where, not why</h3><p>A diff PNG is good at exactly one question: where did the pixels change? The more useful question is why, and that answer lives in the DOM and the CSS: which element changed, which property, and which rule in which stylesheet. None of that makes it into the image, so the model pays for three images per failed test and still has to guess.</p><figure><img alt="Input tokens for one failed screenshot test: three PNGs vs whydiff’s lines in the error message" src="https://cdn-images-1.medium.com/max/1024/1*uP-MsaIXuew5RWEVMsqVCg.png" /><figcaption><strong>Input tokens for one failed screenshot test: three PNGs vs whydiff’s lines in the error message</strong></figcaption></figure><p>If the agent opens all three images of a 1280x720 test, that’s 3,588 input tokens by <a href="https://platform.claude.com/docs/en/build-with-claude/vision">Claude’s own published formula</a>. The lines whydiff adds to the same error message come to about 70.</p><p>None of this is a new idea, by the way. Microsoft’s Playwright MCP already gives models an accessibility snapshot instead of screenshots by default. Text works better for a model than pixels, and whydiff simply applies the same idea to visual diffs.</p><h3>The answer goes where my agent already looks</h3><p>Now the explanation lands in the error of the failed test, which is the one thing my agent reads anyway. There is no image to open and nothing for the agent to install:</p><pre>Error: expect(page).toHaveScreenshot(expected) failed<br><br>  5323 pixels (ratio 0.01 of all image pixels) are different.<br><br>  whydiff, expected -&gt; actual:<br>  - the &quot;Email&quot; text field is 6 px taller (was 36, now 42), and 1 more element changed with it<br>  - the &quot;Cancel&quot; button is 16 px wider (was 80, now 96), and 1 more element changed with it<br>  details when the run ends: npx whydiff explain s2ilf9b<br><br>  Snapshot: settings.png</pre><p>The same lines land in Playwright’s HTML report too, under the pixel count, with whydiff’s one-line annotation sitting above the errors, so whoever opens the report sees the change before they see the diff:</p><figure><img alt="A failed test in Playwright’s HTML report. The annotation and the lines under the pixel count come from whydiff." src="https://cdn-images-1.medium.com/max/1024/1*F1YfUTtHd9V9mnJ_0_noTA.png" /><figcaption><strong>A failed test in Playwright’s HTML report. The annotation and the lines under the pixel count come from whydiff.</strong></figcaption></figure><p>The first whydiff line names the element and what happened to it, with the old value and the new one. The rule behind it is one step further. The command under that line, or the page attached to the failed test, gives you the rule and the way back:</p><pre>- `.ui-btn` from `ui-kit.css` (unlayered) changed its declaration of padding-left, padding-right (was 16px, now 24px)<br>- to restore it: change the rule in `ui-kit.css`, or set padding-left, padding-right back to 16px in your own stylesheet if `ui-kit.css` comes from a dependency</pre><p>So there it is: the element, the property, and the rule with the file it lives in. The “to restore it” line even says what to change, and what to override instead when the stylesheet isn’t yours to edit.</p><h3>What whydiff prints</h3><p>When the run ends, the reporter writes the whole run as text next to the Playwright config. This is report.md for the three screens of the README’s example app, captured before and after an update of its UI kit stylesheet:</p><pre># whydiff: 3 of 3 screenshots changed | 2 causes | 1 unexplained region<br>compared: before -&gt; after | chromium 153.0.8010.12 480x320<br><br>2 causes appear on all 3 changed screenshots, 87% of changed pixels; they account for every changed pixel on 2 of them:<br>- 9 buttons are 8 px wider, on all 3 changed screenshots, 69% of changed pixels (`.ui-button`, c35ew6y)<br>- the corners of 3 `&lt;div&gt;` elements are rounder, on 1 of 3 changed screenshots, 18% of changed pixels (`:root`, c29t82f)<br><br>1 unexplained region on 1 screenshot holds 13% of changed pixels.<br><br>## 9 buttons are 8 px wider, on all 3 changed screenshots, 69% of changed pixels (`.ui-button`, c35ew6y)<br>- for example, the &quot;Help&quot; button is 8 px wider (was 55, now 63), at `getByRole(&#39;button&#39;, { name: &#39;Help&#39; })` in &quot;items&quot; (sy77idc)<br>- `.ui-button` from `ui-kit.css` (unlayered) changed its declaration of padding-left, padding-right (was 12px, now 16px)<br>- to restore it: change the rule in `ui-kit.css`, or set padding-left, padding-right back to 12px in your own stylesheet if `ui-kit.css` comes from a dependency<br>- all occurrences: `npx whydiff explain c35ew6y`<br><br>## Unexplained regions (1)<br>Pixels changed, no DOM, style or geometry change found under the region.<br>Usual reasons: image content, canvas, icon font, text anti-aliasing.<br>- 1 region on &quot;usage&quot; (sgh10bo), 420 changed pixels: 1 under `&lt;canvas&gt;`</pre><p>Each heading is one cause, with the screenshots it touched and its share of the changed pixels. The chart on a canvas has no DOM to compare, so its pixels stay listed as unexplained instead of being blamed on a rule.</p><h3>12 red screenshots, 2 causes</h3><figure><img alt="Twelve failed screenshots collapse into two causes in the whydiff report" src="https://cdn-images-1.medium.com/max/1024/1*KtW5c2j5bEHlzlJEYKKNnQ.png" /><figcaption><strong>Twelve failed screenshots collapse into two causes in the whydiff report</strong></figcaption></figure><p>Here’s the thing about an upgrade: most of the red screenshots are the same few changes, showing up on different pages. whydiff turns the same cause across many tests into one entry, with the stylesheet rule to fix and every screenshot it touched. Lines that start with “as a result” are things that only moved because something else grew, so they don’t need a fix of their own. In the demo above, that’s twelve failed screenshots and two things to look at.</p><p>When the run ends, whydiff writes all of it down as one page and links that page from every failed test in the HTML report, so the whole upgrade fits on a single screen.</p><h3>Why one upgrade turns a hundred screenshots red</h3><p>A UI kit or a CSS framework ships each rule once and every page reads it, so one changed declaration shows up on every screenshot with a button, a card or a heading. Playwright compares each screenshot on its own and reports each one as its own failure, which is correct and useless at the same time: 117 failures were not 117 problems. Grouping the failures by the rule that changed, not by the test, turns an afternoon of opening PNGs into a list you read in a minute, and the list names the file to open.</p><p>I also wanted to see it on code I didn’t write, so I picked a public upgrade after the fact. ComfyUI_frontend (GPL-3.0) moved from Tailwind 3 to 4 in <a href="https://github.com/Comfy-Org/ComfyUI_frontend/pull/5246">pull request #5246</a>, before whydiff existed, and nobody there used it. Replaying their own Playwright suite with whydiff added, on the commits before and after that PR, gives <strong>128 changed</strong> screenshots out of 132, which whydiff traces to <strong>4 causes</strong>, apart from one screenshot with a canvas it can’t see into. The biggest one, 1,373 buttons 2 px taller, on 125 of them, is the border-width: initial trap I describe below.</p><figure><img alt="The run page of the ComfyUI_frontend replay: 4 causes across 128 changed screenshots, the first one with its rule." src="https://cdn-images-1.medium.com/max/1024/1*xX6I-URLLVo96Waj8mrlqw.png" /><figcaption><strong>The run page of the ComfyUI_frontend replay: 4 causes across 128 changed screenshots, the first one with its rule.</strong></figcaption></figure><h3>Under the hood: snapshots, not a model</h3><figure><img alt="How whydiff works: capture, compare, explain, group, then the failed test’s error message and annotation, the run page and report.md" src="https://cdn-images-1.medium.com/max/1024/1*93FXnSa5qsmCXEp99fkgJg.png" /><figcaption><strong>How whydiff works: capture, compare, explain, group, then the failed test’s error message and annotation, the run page and report.md</strong></figcaption></figure><p>Next to every screenshot, whydiff records a snapshot of the page’s render tree: each element’s box, its computed styles and the stylesheet rule that set them. When a screenshot changes, it matches the elements of the two snapshots and finds the change under each changed region, and the same cause across many screenshots becomes one entry. There’s no AI inside: the same snapshots give the same report, byte for byte.</p><p>Because it works from the CSS rather than the pixels, it can name causes that a diff image has no way to show. When a value comes through a CSS variable, whydiff names the rule that changed the variable, not every rule that reads it:</p><pre>- `:root` from `app.css` (unlayered) changed its declaration of --ui-space (was 4px, now 5px)<br>- --ui-space is read by column-gap, margin-bottom, padding (all sides), row-gap</pre><p>And when a rule replaces a browser default, it tells you which one. This one is sneaky: a reset like button { border-width: initial } looks harmless, but initial is medium, which is 3px, while the browser’s own default for buttons is 2px, so every button quietly gets a pixel bigger on each side:</p><pre>- `button` from `reset.css` (unlayered) now sets border-width (all sides, was 2px, now 3px) in place of the browser&#39;s default `button { border-width: 2px }`</pre><p>Pixels that change without any DOM, style or geometry change under them, a chart on a canvas, an icon font, text anti-aliasing after a Chromium update, are listed separately as unexplained regions with the nearest locator. A real CSS regression never hides among them, and they never get blamed on a rule.</p><p>Big visual testing platforms like Applitools and Percy already show the DOM and CSS behind a diff in their review dashboards. whydiff is a smaller thing: it plugs into Playwright’s own toHaveScreenshot, runs locally with no model in the loop, and writes the answer as text an agent can read. It never changes a test’s result; it only adds its explanation to the failure.</p><h3>Intended change or regression, without opening a PNG</h3><p>whydiff does not decide whether a change was wanted; it gives you the two facts the decision needs. If the rule that changed lives in a file your pull request touched, the change is probably intended, and <em>npx playwright test --update-snapshots</em> is the right move. If it lives in a dependency’s stylesheet you never opened, it is the dependency’s change, and the “to restore it” line says what to override in your own CSS instead of editing node_modules. Lines that start with “as a result” are elements that only moved because a neighbour grew, so they need no decision at all. An agent can follow the same rule, which is why the README suggests one paragraph for AGENTS.md: update a baseline only when the change is intended, and override a dependency’s rule rather than patching the dependency.</p><h3>Trying it on your own suite</h3><pre>npm install -D @whydiff/playwright whydiff<br>npx whydiff init<br>npx playwright test</pre><p>init shows every edit as a diff before it writes anything: the fixtures file, the reporter in your Playwright config, and the imports of your specs.</p><p>The first run records a snapshot next to each baseline, and every screenshot that fails after that comes with its explanation. If your suite is already red, <a href="https://github.com/rodindev/whydiff#the-first-run">the README</a> shows how to record the old side first. whydiff works in Chromium only for now. And if you don’t have a test suite at all, npx whydiff snap and npx whydiff diff compare two states of any URL.</p><p>whydiff is open source (MIT). If it names the wrong cause on your project, I’d really like to see it, so please tell me on GitHub.</p><p>Thank you for reading!</p><p><a href="https://github.com/rodindev/whydiff">GitHub</a> | <a href="https://www.npmjs.com/package/whydiff">npm</a></p><p><em>Written with help from AI tools.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e86151af121" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-i-stopped-showing-screenshots-to-my-ai-agent-5e86151af121">How I Stopped Showing Screenshots to My AI Agent</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interactive OpenAPI Docs for VitePress]]></title>
            <link>https://javascript.plainenglish.io/interactive-openapi-docs-for-vitepress-04f9f0df2170?source=rss-9ecc245fcfde------2</link>
            <guid isPermaLink="false">https://medium.com/p/04f9f0df2170</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ilya R.]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 17:59:24 GMT</pubDate>
            <atom:updated>2026-04-24T15:43:08.348Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vhq74uZuhILms8H76ez9dA.png" /><figcaption>VitePress page rendering an OpenAPI endpoint in two columns — documentation on the left, a sticky Try-It panel on the right</figcaption></figure><p>Three years ago, I wrote about <a href="https://medium.com/@rodin.dev/interactive-api-documentation-with-vuepress-7a13bf6dc03e">building interactive API documentation with VuePress</a>. The core of that article was vuepress-api-playground— a Vue 2 component that turned a documentation page into a place where you could actually test an endpoint, not just read about it.</p><p>That component kept bugging me. Not because it was bad, but because it wasn’t enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YApGIbHDYabur9gGTKAfEg.png" /><figcaption><em>Screenshot of the original vuepress-api-playground from 2023</em></figcaption></figure><p>Here’s what using vuepress-api-playground looked like in practice: I’d write an OpenAPI spec, then go through each endpoint and manually create a VuePress page for it. Copy the URL, list the parameters, paste response examples, wire up the component. For 10 endpoints — fine. For 50 — painful. And the spec already had all of this. I was just transcribing it.</p><p>I kept thinking there should be a layer that reads the spec and builds the docs for me.</p><h3>The rewrite</h3><p>VitePress replaced VuePress. Vue 3 replaced Vue 2. The component had to be rewritten anyway, so I rebuilt it as vue-api-playground<em> </em>— zero dependencies, Vue 3 Composition API, TypeScript, CSS variables that pick up whatever theme the host app uses. About 3 KB gzipped.</p><p>The new component was better, but the workflow was still the same. Spec in one hand, manual pages in the other. I wanted the plugin.</p><p>Before writing anything, I checked what already existed.</p><p><strong>Swagger UI</strong> — everyone knows it, everyone has used it. The problem: it’s a standalone widget. You get a full-page API reference or nothing. No way to mix it with guides, tutorials, or narrative documentation in a shared page tree.</p><p><strong>Scalar</strong> — really well done. Beautiful UI, a great “Try It” panel that works as an API client. Ships as a web component, works anywhere. But “works anywhere” means shadow DOM, and shadow DOM means isolation. Your VitePress theme can’t style it, and you can’t drop an endpoint between two paragraphs of a tutorial.</p><p><strong>vitepress-openapi</strong> by Enzo Notario — the closest to what I wanted. Vue-native, VitePress-native, in production since 2023, with a mature component set ( OASpec, OAOperation), a playground, code samples, and helpers like useSidebar and groupByTags. The difference between our projects is philosophy, not capability. vitepress-openapi hands you building blocks and keeps you in control of how pages are structured, which sidebar you build, and where each operation appears — a design choice plenty of people prefer, because control beats automation when your docs need a custom shape. I was after the other end of the trade-off: a plugin that, given a spec, produces the pages, sidebar, and navigation on its own. Same ecosystem, different defaults.</p><p>None of these were wrong. They just weren’t the shape I was looking for.</p><h3>Two minutes to working docs</h3><p>Here’s the quickest path:</p><pre>npm create vitepress-openapi-docs@latest my-docs</pre><p>The CLI asks for a site title, a path to your OpenAPI spec (or just use the bundled demo), and a server URL. Then it scaffolds a VitePress project, installs dependencies, and initializes git.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OpCVggOoTeHOKVlDHK--tw.png" /><figcaption>npm create, a few prompts, working docs</figcaption></figure><pre>cd my-docs &amp;&amp; npm run dev</pre><p>If you have a spec ready:</p><pre>npm create vitepress-openapi-docs@latest my-docs -- --spec ./openapi.yaml</pre><p>For an existing VitePress site — install the package and add this to your config:</p><pre>import { openApiDocs } from &#39;vitepress-openapi-docs/vitepress&#39;<br><br>export default defineConfig({<br>  extends: await openApiDocs({<br>    specs: [{ name: &#39;api&#39;, spec: &#39;docs/openapi/api.yaml&#39; }],<br>  }),<br>})</pre><p>One call. It parses the spec, generates a page per operation, builds the sidebar grouped by tags, registers the Vite plugins. Done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgwZjxFM04OgVRt2kQNtAg.png" /><figcaption>Swagger Petstore docs landing page</figcaption></figure><h4>A two-column layout that stays out of the way</h4><p>By default, each endpoint renders in two columns: the documentation card on the left (path, description, parameters, response examples), and a sticky Try-It aside on the right (SDK snippet, auth, server, parameters, Send request button). You can scroll the docs while the Try-It panel stays in view. On narrow screens the layout falls back to a single stacked column automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2x-2SVQR7V6-0nSfFhasKQ.png" /><figcaption>Two columns</figcaption></figure><p>If you prefer the old stacked look — say, for endpoints embedded inside a tutorial — switch per-endpoint: &lt;OpenApiEndpoint id=”...” layout=”stacked” /&gt;, or globally via the plugin’s defaults. The stacked variant is a compact panel with collapsible sections and a capped parameter list, so long specs don’t overflow the page.</p><h4>Endpoints live inside your prose</h4><p>This is the thing I cared about most. The components render in the light DOM — regular Vue components, not web components, not iframes. You write markdown, drop in an endpoint, keep writing:</p><pre>## Creating a user<br><br>Before calling this endpoint, make sure you have a valid API key.<br>See the [Authentication guide](/guide/auth) for details.<br><br>&lt;OpenApiEndpoint id=&quot;createUser&quot; /&gt;<br><br>The response includes a `Location` header pointing to the new resource.</pre><p>The endpoint inherits VitePress typography, reacts to the dark mode toggle, scrolls with the page. It’s part of the page, not bolted onto it.</p><p>Because the components live in light DOM, they also participate in the theme cascade. Method chips, status pills, and code-span tints resolve through --vp-c-* variables, so a custom VitePress theme repaints the endpoint UI without any plugin-specific overrides. Hex fallbacks keep it working on non-VitePress hosts.</p><h4>What you get per endpoint</h4><p>Every &lt;OpenApiEndpoint&gt; pulls from your spec and renders:</p><p><strong>Parameters</strong> in a compact table with name, type, location (query, path, header), and description. The first five rows show by default; a “Show all N parameters” toggle expands the rest. Required fields get a badge.</p><p><strong>Response examples</strong> in an accordion by status code, with JSON payloads syntax-highlighted inline.</p><p><strong>SDK snippets</strong> — curl, fetch, and Python. When you fill in a bearer token in the auth input, all three snippets update with the real token. Each one is syntax-highlighted by a built-in tokenizer — no Prism, no Shiki, no extra dependency. Copy the curl, paste into a terminal, it works.</p><p><strong>Auth controls</strong> — bearer, API key, basic, OAuth2. Credentials are saved in sessionStorage, so you type your token once and it stays as you navigate between endpoints.</p><p><strong>Try It panel</strong> — powered by vue-api-playground. Fill in parameters, hit Send request, see the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9hnpVA-SDiem0VCezfmcTw.png" /><figcaption>Endpoint example</figcaption></figure><h4>Cmd+K</h4><p>OperationJumper adds fuzzy search. Hit Cmd+K, type a few characters, and it shows matching operations and schemas across all your specs. Method badge, name, tag, path, spec name — all visible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q47d2Ctt4VTyhw850HTTOA.png" /><figcaption>OperationJumper</figcaption></figure><h4>Multiple APIs in one site</h4><p>The config takes an array. Each spec gets its own sidebar, URL prefix, and schema pages. One Cmd+K indexes everything.</p><pre>specs: [<br>  { name: &#39;public&#39;, spec: &#39;docs/openapi/public.yaml&#39;, prefix: &#39;/api/public&#39; },<br>  { name: &#39;admin&#39;, spec: &#39;docs/openapi/admin.yaml&#39;, prefix: &#39;/api/admin&#39; },<br>]</pre><p>Public API and Admin API in one VitePress site, separate sidebars, shared theme.</p><h4>The rest</h4><p>The client JS lands just under 13 KB gzipped with the tokenizers included (peer deps excluded). The plugin also generates schema pages with clickable $ref links and a changelog built from git history — it diffs the spec file across commits and shows which operations were added, removed, or renamed, with inline markdown rendered inside each delta.</p><pre>npm create vitepress-openapi-docs@latest</pre><p><a href="https://github.com/rodindev/vitepress-openapi-docs">GitHub</a> · <a href="https://www.npmjs.com/package/vitepress-openapi-docs">npm</a> · <a href="https://rodindev.github.io/vitepress-openapi-docs/">Documentation</a></p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04f9f0df2170" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/interactive-openapi-docs-for-vitepress-04f9f0df2170">Interactive OpenAPI Docs for VitePress</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From QR Codes to Voyager: How Reed-Solomon Codes Work]]></title>
            <link>https://medium.com/@rodin.dev/from-qr-codes-to-voyager-how-reed-solomon-codes-work-e249dcfa8474?source=rss-9ecc245fcfde------2</link>
            <guid isPermaLink="false">https://medium.com/p/e249dcfa8474</guid>
            <category><![CDATA[space]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[science]]></category>
            <dc:creator><![CDATA[Ilya R.]]></dc:creator>
            <pubDate>Sat, 08 Jun 2024 16:16:39 GMT</pubDate>
            <atom:updated>2024-06-08T16:16:39.809Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EscDhhuNkCowuzsZeFkpUQ.jpeg" /></figure><p>Try scanning the QR code from the image above. Surprisingly, despite the hole revealing the infinite expanse of space, it remains readable. What is the “magic” behind it, and how does it improve our lives? Let’s find out.</p><h3>Polynomial Codes Over Certain Finite Fields</h3><p>In the 1950s and 1960s, the first space programs began, various types of communications and technologies developed, and the military sought ways to enhance security and reliability of data transmission. All of that required reliable methods that could detect and correct errors in data, which was extremely important for transmitting information in noisy environments.</p><blockquote>“The fundamental problem of communication is that of reproducing at one point either exactly or approximately a message selected at another point.” — Claude Shannon, 1948</blockquote><p>The breakthrough in error correction came with the work “Polynomial Codes over Certain Finite Fields” by Irving Reed and Gustave Solomon, which led to creation of Reed-Solomon (RS) codes. These codes revolutionized data transmission by providing efficient error detection and correction methods. Before their work, various coding methods existed, but many of them were not efficient enough. For example, Hamming codes, invented by Richard Hamming in 1950, suitable for correction of single errors but ineffective for a more significant number of such.</p><p>One of the earliest and most significant applications of RS codes was in the Voyager mission, considered <a href="https://ntrs.nasa.gov/citations/20060042332">the first “full-blown” use</a> of Reed-Solomon codes on a space mission. With RS codes, we were able to receive critical scientific data (and continue to receive it to this day!), as well as the first significant images of Jupiter and other planets. Since then, these codes have become an integral part of our lives, playing crucial roles in telecommunications, data storage (hard drives, CDs, DVDs, and Blu-ray), digital television and radio, space missions, computer networks, and, of course, QR codes.</p><h3>How it works?</h3><p>Let’s consider the principle of RS codes operation with a simple example: imagine we are trying to transmit a message from Voyager to Earth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ER2zuNd11liYDSglkJEK2Q.png" /></figure><p>Judging by the image above, the message has become significantly distorted on its way to Earth; instead of “hello world,” we received “jelly worms.” Obviously, we need to process the original message to reach the recipient in its original form. This is where RS codes come in handy.</p><p>In simple terms, RS codes consist of two main components: an encoder and a decoder. The encoder takes the original message, processes it, and adds parity symbols. The decoder then uses these parity symbols to detect and correct errors that occur during data transmission, restoring the original message. Thus, our scheme should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gqSkD0I2NuG51w1TewW0jA.png" /></figure><p>A rather complex mathematical model lies behind these simple steps. RS codes are based on the theory of finite fields, or Galois fields. Encoding involves representing the message as a polynomial over a finite field and adding parity symbols, which are also polynomials. These parity symbols are calculated so that they can detect and correct errors occurring during data transmission.</p><p>Decoding involves several steps, such as error detection using syndromes, determining the error locations and their magnitudes using the Euclidean algorithm to find the greatest common divisor of polynomials, and correcting the errors in the encoded message.</p><p>Fortunately, the Python library <a href="https://pypi.org/project/reedsolo/">reedsolo</a> handles all this out of the box. Let’s implement the scheme described above into practice.</p><p>First, let’s convert the characters of our message into numerical form:</p><pre>message = &quot;hello world&quot;<br>message_bytes = list(message.encode(&#39;utf-8&#39;))<br>print(&quot;Message as array:&quot;, message_bytes)<br># Message as array: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]</pre><p>Now, we have the numerical representation of the message, and we can encode it.</p><pre>import reedsolo<br><br>rs = reedsolo.RSCodec(8)<br>encoded_message = rs.encode(message_bytes)<br>print(&quot;Encoded message:&quot;, list(encoded_message))<br># Encoded message: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 48, 119, 255, 37, 228, 214, 10, 133]</pre><p>As we can see, redundant data has appeared in our message. Note that when creating the RS encoder, we used the number 8, representing the number of parity symbols. The number of parity symbols affects the length of the encoded message and the allowable number of errors. The decoder can correct a number of errors equal to the number of parity symbols divided by 2. Since our example had four errors in the original message, we need to add eight parity symbols.</p><blockquote>By the way, QR codes can also use different amounts of redundant data. Four error correction levels (L, M, Q, and H) are used for this purpose, the highest of which can recover information even with a loss of up to 30%. For the QR code presented at the beginning of this article, we used the highest error correction level (H) so we could read it without any issues.</blockquote><p>Let’s add four random errors to the encoded message:</p><pre>import random<br><br>def introduce_errors(data, num_errors):<br>    data = bytearray(data)<br>    for _ in range(num_errors):<br>        index = random.randint(0, len(data) - 1)<br>        data[index] = random.randint(0, 255)<br>    return bytes(data)<br><br>corrupted_message = introduce_errors(encoded_message, 4)<br>print(&quot;Corrupted message:&quot;, list(corrupted_message))<br># Corrupted message: [104, 101, 6, 18, 67, 32, 119, 111, 114, 108, 100, 48, 119, 255, 37, 228, 214, 235, 133]</pre><p>The errors have even affected the parity symbols. The good news is that the decoder will manage this without any issues. Now we can decode the message:</p><pre>decoded_message_tuple = rs.decode(corrupted_message)<br>decoded_message = decoded_message_tuple[0]  # Extract the decoded message<br>print(&quot;Decoded message:&quot;, decoded_message.decode(&#39;utf-8&#39;))<br># Decoded message: hello world</pre><p>Great, we have retrieved the original message and are no longer afraid of noise when transmitting essential data.</p><p>You can refer to <a href="https://pypi.org/project/reedsolo/">the documentation</a> if you want to learn more about the capabilities of the reedsolo library.</p><h3>Conclusion</h3><p>To sum up, Reed-Solomon codes are more than just a mathematical curiosity; they are a vital component of our technological infrastructure, ensuring that our messages, whether from a spacecraft millions of miles away or a QR code on a product, are delivered accurately and reliably. The “magic” of RS codes lies in their ability to make the impossible possible, transforming garbled transmissions into clear, understandable data and, in doing so, improving our lives in countless ways.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e249dcfa8474" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making the Most of Axios in Vue.js: Interceptors, Request Cancellation, and More]]></title>
            <link>https://medium.com/@rodin.dev/making-the-most-of-axios-in-vue-js-interceptors-request-cancellation-and-more-fa40dbc44b55?source=rss-9ecc245fcfde------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa40dbc44b55</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[axios]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Ilya R.]]></dc:creator>
            <pubDate>Tue, 14 Mar 2023 05:41:53 GMT</pubDate>
            <atom:updated>2023-03-14T05:44:54.295Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oifag4AjSVdsaTT8k_PYeg.png" /></figure><p>When it comes to making HTTP requests in a <a href="https://vuejs.org/">Vue.js</a> application, using a third-party library like <a href="https://axios-http.com/">Axios</a> can offer additional benefits and flexibility over the built-in Fetch API. With advanced features like interceptors, request cancellation, and automatic data serialization, Axios can help us build more robust and performant applications.</p><p>In this article, we’ll explore how to use Axios in a Vue.js application and take advantage of some of its advanced features.</p><h3>Installing and Setting Up Axios</h3><p>To use Axios in a Vue.js application, we first need to install it using npm or yarn:</p><pre>npm install axios</pre><p>or</p><pre>yarn add axios</pre><p>Once you’ve installed Axios, you can import it into your Vue.js application and use it to make HTTP requests:</p><pre>import axios from &#39;axios&#39;</pre><h3>Adding Axios Globally to Your Vue.js Application</h3><p>To avoid importing Axios in every component where we need to use it, we can add it globally to our Vue.js application using Vue’s prototype (Vue 2) or globalProperties (Vue 3):</p><pre>//main.js<br><br>import axios from &#39;axios&#39;<br><br>//Vue 3<br>app.config.globalProperties.$axios = axios<br><br>//Vue 2<br>/* Vue.prototype.$axios = axios */</pre><p>Here, we’ve added Axios to the Vue prototype (globalProperties) as $axios. Now, we can use $axios in any Vue component without importing Axios every time:</p><pre>//Component.vue<br><br>export default {<br>  mounted() {<br>    this.$axios.get(&#39;/users&#39;)<br>  }<br>}</pre><h3>Setting a Global Base URL</h3><p>If your Vue.js application communicates with a single API server, it can be useful to set a global base URL for all Axios requests. This can be done using axios.defaults.baseURL.</p><p>Here’s an example of how to set a global base URL:</p><pre>//main.js<br><br>import axios from &#39;axios&#39;<br><br>axios.defaults.baseURL = &#39;https://api.example.com&#39;</pre><blockquote>Setting the base URL globally like this can be useful in larger applications where we want to avoid hard-coding the URL in every request, and to be able to easily switch between different environments (e.g. local development, staging, production).</blockquote><p>It’s important to note that we can still override the base URL for individual requests by providing a full URL instead of just an endpoint, like this:</p><pre>axios.get(&#39;https://specific-endpoint.example.com/users&#39;)</pre><h3>Using Interceptors in Axios</h3><p>Axios provides a powerful feature called “interceptors” that allow us to intercept requests and responses before they are sent or received. This can be useful for adding authentication headers, handling loading states, or modifying response data. To add an interceptor to an Axios instance, we can use the interceptors property:</p><pre>//main.js<br><br>import axios from &#39;axios&#39;<br><br>// Request interceptor<br>axios.interceptors.request.use((config) =&gt; {<br>  // Modify the request config here<br>  return config<br>})<br><br>// Response interceptor<br>axios.interceptors.response.use((response) =&gt; {<br>  // Handle the response here<br>  return response<br>}, (error) =&gt; {<br>  // Handle errors here<br>  console.error(error)<br>  return Promise.reject(error)<br>})</pre><p>In the above code, we’ve added a request interceptor and a response interceptor to the Axios. The request interceptor is called before the request is sent, and allows us to modify the request configuration. The response interceptor is called after the response is received, and allows us to modify the response or handle errors.</p><blockquote>Using interceptors can help us keep our code organized and reduce duplication across multiple components.</blockquote><p>For example, we could use a request interceptor to add an authentication token to every request:</p><pre>axios.interceptors.request.use((config) =&gt; {<br>  const token = localStorage.getItem(&#39;authToken&#39;)<br>  if (token) {<br>    config.headers.Authorization = `Bearer ${token}`<br>  }<br>  return config<br>})</pre><p>Here, we’ve added a request interceptor to the Axios instance that adds an authorization token to every request by setting the Authorization header.</p><h3>Handling HTTP errors globally</h3><p>Sometimes, we want to handle HTTP errors globally in our application instead of handling them in each component where we make requests. We can achieve this by adding a response interceptor to the Axios instance that handles errors:</p><pre>axios.interceptors.response.use(<br>  (response) =&gt; response,<br>  (error) =&gt; {<br>    if (error.response) {<br>      if (error.response.status === 401) {<br>        // Redirect to login page<br>        router.push(&#39;/login&#39;)<br>      } else {<br>        // Show a generic error message<br>        alert(&#39;An error occurred. Please try again later.&#39;)<br>      }<br>    }<br>    return Promise.reject(error)<br>  },<br>);</pre><p>As you can see, a response interceptor was added that checks the status code of the response. If it’s a 401 Unauthorized error, we redirect the user to the login page. Otherwise, we show a generic error message. By returning a rejected promise, we propagate the error to the calling function.</p><p>See <a href="https://axios-http.com/docs/handling_errors">Axios documentation</a> for more tips.</p><h3>Canceling Requests in Axios</h3><p>Another powerful feature of Axios is the ability to cancel requests using a cancellation token. This can be useful for scenarios in which a user navigates away from a page before a long-running request is complete, or when a component is unmounted before a request has finished.</p><p>To use request cancellation in Axios, we first need to create a new CancelToken object and pass it to the request configuration:</p><pre>//Component.vue<br><br>const source = this.$axios.CancelToken.source();<br><br>this.$axios.get(&#39;/users&#39;, {<br>  cancelToken: source.token,<br>})<br>  .then((response) =&gt; {<br>    console.log(response.data);<br>  })<br>  .catch((error) =&gt; {<br>    if (this.$axios.isCancel(error)) {<br>      console.log(&#39;Request cancelled&#39;);<br>    } else {<br>      console.error(error);<br>    }<br>  });<br><br>// Cancel the request after 1 millisecond<br>setTimeout(() =&gt; {<br>  source.cancel(&#39;Request cancelled by user&#39;);<br>}, 1);</pre><p>Here, we’ve created a new CancelToken object using axios.CancelToken.source() and passed it to the CancelToken property of the request configuration. We’ve also set a timeout of 1 millisecond to cancel the request using source.cancel(&#39;Request canceled by user&#39;).</p><p>If the request is canceled before it completes, Axios will throw a Cancel error, which we can catch using axios.isCancel(error). We can then handle the cancellation appropriately in our code.</p><blockquote>Using cancellation tokens can help us prevent unnecessary network requests and improve the performance of our Vue.js applications.</blockquote><h3>Using Axios with async/await</h3><p>Axios works great with async/await, making it easy to write asynchronous code that’s easy to read and understand. Here’s an example of using Axios with async/await:</p><pre>//Component.vue<br><br>methods: {<br>  async fetchData() {<br>    try {<br>      const response = await this.$axios.get(&#39;/users&#39;)<br>      console.log(response.data)<br>    } catch (error) {<br>      console.error(error)<br>    }<br>  }<br>}</pre><h3>Using axios.all() to make multiple requests</h3><p>Sometimes, we need to make multiple requests to different endpoints at the same time. We can use the axios.all() method to make concurrent requests with Axios:</p><pre>const usersRequest = this.$axios.get(&#39;/users&#39;)<br>const postsRequest = this.$axios.get(&#39;/posts&#39;)<br>this.$axios<br>  .all([usersRequest, postsRequest])<br>  .then(this.$axios.spread((...responses) =&gt; {<br>    const usersResponse = responses[0]<br>    const postsResponse = responses[1]<br>  }))<br>  .catch(() =&gt; {})<br>  .then(() =&gt; {})</pre><p>In this example, we are using axios.all() to make two concurrent requests to the /users and /posts endpoints, and then handling the responses using axios.spread().</p><h3>Conclusion</h3><p>In this article, we’ve explored some of the advanced features of Axios and how they can be used in a Vue.js application. These features help build robust and performant applications of any design complexity with less code.</p><p>We would be glad to answer any questions and discuss the subject in the comments below. For more details check out the <a href="https://axios-http.com/docs/intro">Axios documentation</a> on this powerful tool.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa40dbc44b55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interactive API Documentation with VuePress]]></title>
            <link>https://medium.com/@rodin.dev/interactive-api-documentation-with-vuepress-7a13bf6dc03e?source=rss-9ecc245fcfde------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a13bf6dc03e</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Ilya R.]]></dc:creator>
            <pubDate>Fri, 10 Mar 2023 11:15:04 GMT</pubDate>
            <atom:updated>2023-03-13T16:20:39.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*StTHvrr7L3_rTibiwZW0_A.png" /></figure><p>API documentation is crucial for developers who need to understand how to interact with a web-based application or service. While there are many tools available for generating API documentation, <a href="https://vuepress.vuejs.org/">VuePress</a> is an excellent choice for small to medium-sized projects that require a simple and lightweight documentation system. In this article, we’ll explore why VuePress is a great option and provide a step-by-step guide on how to create API documentation using VuePress.</p><h3>Why to Choose VuePress for API Documentation</h3><p>First of all, VuePress is a highly flexible documentation system that can be customized to fit your specific needs.</p><p>We highlight three main features:</p><ol><li>Customizable themes and layouts</li><li>Integration with the Vue.js ecosystem</li><li>Ability to write documentation in Markdown syntax</li></ol><p>In addition, we will use the <a href="https://rodindev.github.io/vuepress-api-playground/">VuePress API Playground</a> component to create interactive documentation, which provides an easy way for developers to test and interact with the API without leaving the documentation page.</p><p>While <a href="https://swagger.io/">Swagger</a> offers a range of features that can be beneficial for large-scale API development, VuePress is a simpler and lighter option that’s ideal for small projects.</p><h3>Getting Started</h3><p>Following the <a href="https://vuepress.vuejs.org/guide/getting-started.html">documentation</a>, let’s use a <a href="https://github.com/vuepressjs/create-vuepress-site/">create-vuepress-site generator</a>.</p><p>Open up your terminal in the desired directory and run the following command:</p><pre>yarn create vuepress-site</pre><p>After this, we can navigate into a newly scaffolded directory, install the dependencies, and start the local server.</p><pre>cd docs<br>yarn install<br>yarn dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dB0CwO-Bt2fhrUBOXrrnbA.png" /><figcaption>Here we go!</figcaption></figure><h3>Configuration</h3><p>In addition to its out-of-the-box features, VuePress also allows customizing the documentation using the <a href="https://vuepress.vuejs.org/config/">Config</a> file.</p><p>The essential file for configuring a VuePress site is src/.vuepress/config.js. Check out the <a href="https://vuepress.vuejs.org/config/">Config Reference</a> for a full list of options.</p><p>You can also customize a start page by editing the src/index.md file.</p><h3>The First Article</h3><ol><li>Create an updating-resource.md file in src/.vuepress/guide</li><li>In that file, put the following code</li></ol><pre># Updating a resource<br><br>## Request<br><br>- HTTP Method: `PUT`<br>- Content Type: `application/json`<br>- URL: `http://example.com/users/{id}`<br><br>## Parameters<br><br>| Property | Type | Required | Description |<br>| -------- | ---- | -------- | ----------- |<br>| ``name`` | String | false | The name of the user. |<br>| ``age`` | Number | false | The age of the user. |<br><br>## Request example<br><br>``` js<br>fetch(&#39;http://example.com/users/1&#39;, {<br>  method: &#39;PUT&#39;,<br>  body: JSON.stringify({<br>    name: &#39;John Doe&#39;,<br>    age: 27,<br>  }),<br>  headers: {<br>    &#39;Content-type&#39;: &#39;application/json&#39;,<br>  },<br>})<br>  .then((response) =&gt; response.json())<br>  .then((json) =&gt; console.log(json));<br>```<br><br>## Response example<br><br>``` JSON<br>{<br>  &quot;id&quot;: 1,<br>  &quot;name&quot;: &quot;John Doe&quot;,<br>  &quot;age&quot;: 27<br>}<br>```</pre><p>Now we can update src/.vuepress/config.js with the following code:</p><pre>...<br>sidebar: {<br>  &#39;/guide/&#39;: [<br>    {<br>      title: &#39;Guide&#39;,<br>      collapsable: false,<br>      children: [<br>        &#39;&#39;,<br>        &#39;updating-resource&#39;,<br>      ]<br>    }<br>  ],<br>}<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9gyucEKNkAS4-m9MX1_PPg.png" /><figcaption>Looks good!</figcaption></figure><h3>Being Interactive</h3><p>In addition to providing clear and concise documentation, it’s also important to make your API documentation interactive. By including an API playground in your documentation, you can allow users to test your API directly from your documentation site.</p><p>To do this, we’ll use the <a href="https://rodindev.github.io/vuepress-api-playground/">VuePress API Playground</a> component.</p><p>Open up your terminal and run the following command:</p><pre>yarn add vuepress-api-playground --dev</pre><p>Open the enhanceApp.js file in your VuePress project and add the following code:</p><pre>import VuepressApiPlayground from &#39;vuepress-api-playground&#39;<br>import &#39;vuepress-api-playground/styles/index.stylus&#39;<br><br>export default ({ Vue }) =&gt; {<br>  Vue.use(VuepressApiPlayground)<br>}</pre><p>Once this is done, we can update the updating-resource.md file with the following code:</p><pre>## Playground<br><br>&lt;VuepressApiPlayground<br>  url=&quot;http://example.com/users/{id}&quot;<br>  method=&quot;put&quot;<br>  :headers=&quot;{<br>    &#39;Content-Type&#39;: &#39;application/json&#39;,<br>  }&quot;<br>  :data=&quot;[<br>    {<br>      name: &#39;id&#39;,<br>      value: &#39;1&#39;,<br>      type: &#39;number&#39;,<br>    },<br>    {<br>      name: &#39;name&#39;,<br>      value: &#39;John Doe&#39;,<br>      type: &#39;text&#39;,<br>    },<br>    {<br>      name: &#39;age&#39;,<br>      value: 27,<br>      type: &#39;number&#39;,<br>    },<br>  ]&quot;<br>/&gt;</pre><p>Let’s see the results!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CiA791lRqaIe7zffsrcYUg.png" /><figcaption>Users can now try your API!</figcaption></figure><p>In this example, the URL http://example.com/users/{id} includes the parameter {id}, which will be replaced with a specific value when the API call is made. The data must include the parameter from the URL.</p><p>When the component is rendered, it will make a PUT request to the URL http://example.com/users/1.</p><h3>Conclusion</h3><p>We hope this article has helped you to understand the benefits of using VuePress for your API documentation needs.</p><p>If you have any questions or comments, please feel free to leave them below. And don’t forget to check out the <a href="https://vuepress.vuejs.org/">VuePress documentation</a> for more information on how to get the most out of this powerful tool. Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a13bf6dc03e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>