From bca25b86badf847b17edfb939eead321022a0fb5 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Wed, 19 Aug 2026 12:17:46 +0800 Subject: [PATCH] fix(scripts): quote collection paths so lint stops word-splitting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `lint-collections.sh` looped over an unquoted `$yaml_files`, so every collection directory containing a space was split into separate words. The first token, `./postman/collections/Fleetbase`, does not exist, so `postman collection lint` failed with ENOENT and `set -e` aborted the run — after `validate-collections.js` had already printed its success line, which made the failure look spurious. It was not only noise: the abort happened on the very first iteration, so the v3 YAML schema lint never actually linted anything. Lint each collection directory instead of each YAML fragment. The Postman CLI accepts a directory and understands the Native Git layout, resolving all 288 requests with their `.params`/`.queryParams` siblings. Iterating the 697 individual fragments would also have worked once quoted, but at ~2.5s of CLI startup each that is ~30 minutes per run versus ~12 seconds for the five directories. Also quote the collection paths in the `postman:run:*` package scripts, which had the same defect: `run-collection.sh` received `postman/collections/Fleetbase` as `$1` and a stray `API` argument. Verified: `npm run postman:lint` exits 0, validating 5 collections and 3 environments with 288 requests scanned and no issues. Corrupting a request file makes it exit 1 and report the errors, confirming the gate is live rather than vacuously passing. --- package.json | 10 +++++----- scripts/lint-collections.sh | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 8b872bc..7646f98 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,11 @@ "scripts": { "postman:lint": "./scripts/lint-collections.sh", "postman:run": "./scripts/run-collection.sh", - "postman:run:fleetbase": "./scripts/run-collection.sh postman/collections/Fleetbase API", - "postman:run:core": "./scripts/run-collection.sh postman/collections/Fleetbase Core API", - "postman:run:storefront": "./scripts/run-collection.sh postman/collections/Fleetbase Storefront API", - "postman:run:ledger": "./scripts/run-collection.sh postman/collections/Fleetbase Ledger API", - "postman:run:integrated-vendor": "./scripts/run-collection.sh postman/collections/Fleetbase Integrated Vendor Flow" + "postman:run:fleetbase": "./scripts/run-collection.sh 'postman/collections/Fleetbase API'", + "postman:run:core": "./scripts/run-collection.sh 'postman/collections/Fleetbase Core API'", + "postman:run:storefront": "./scripts/run-collection.sh 'postman/collections/Fleetbase Storefront API'", + "postman:run:ledger": "./scripts/run-collection.sh 'postman/collections/Fleetbase Ledger API'", + "postman:run:integrated-vendor": "./scripts/run-collection.sh 'postman/collections/Fleetbase Integrated Vendor Flow'" }, "keywords": [ "fleetbase", diff --git a/scripts/lint-collections.sh b/scripts/lint-collections.sh index f8497cd..b3593fa 100755 --- a/scripts/lint-collections.sh +++ b/scripts/lint-collections.sh @@ -4,12 +4,11 @@ set -eu node ./scripts/validate-collections.js if command -v postman >/dev/null 2>&1; then - yaml_files="$(find ./postman/collections -name '*.yaml' -print)" - if [ -n "$yaml_files" ]; then - for yaml_file in $yaml_files; do - postman collection lint "$yaml_file" --fail-severity error - done - fi + for collection in ./postman/collections/*/; do + [ -d "$collection" ] || continue + echo "Linting $(basename "$collection")..." + postman collection lint "$collection" --fail-severity error + done else echo "Postman CLI not found; skipped v3 YAML schema lint." fi