ApiSpecs/matchLoadedApiSpecs.js

bruno · packages/bruno-app/src/components/Sidebar/ApiSpecs/matchLoadedApiSpecs.js · javascript · MIT
integration

Matches workspace API spec entries with loaded specs by normalizing paths for cross-platform compatibility.

// Source: https://github.com/usebruno/bruno | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
import { getApiSpecPathKey } from 'utils/api-specs';

/**
 * Pairs each workspace API spec entry (from workspace.yml) with its loaded
 * counterpart in the redux store, matching by normalized (posixified) path.
 *
 * The two paths are derived independently: the workspace entry's path is stored
 * posixified (forward slashes) in workspace.yml, while the loaded spec's pathname
 * comes from the file watcher in native form (backslashes on Windows). A raw
 * `===` compare therefore fails on Windows (`C:/ws/api.yaml` !== `C:\ws\api.yaml`),
 * which hides the spec from the sidebar until a workspace switch. Normalizing both
 * sides makes them match on Windows while being a

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key