Skip to content

Commit 97e3887

Browse files
committed
fix: remove whitespaces from the collection
1 parent 1ce77d4 commit 97e3887

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tools/postman/scripts/transform-for-api.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
## NOTE: Use JS script instead.
5+
## Script is kept only for backwards compatibilty
6+
47
#########################################################
58
# Prepare collection for Postman API
69
# Environment variables:
@@ -27,7 +30,6 @@ DESCRIPTION_FILE=${DESCRIPTION_FILE:-"../collection-description.md"}
2730

2831
TOGGLE_INCLUDE_BODY=${TOGGLE_INCLUDE_BODY:-true}
2932
TOGGLE_ADD_DOCS_LINKS=${TOGGLE_ADD_DOCS_LINKS:-true}
30-
TOKEN_URL_ENV=${TOKEN_URL_ENV:-""}
3133

3234
current_api_revision=$(<"$OPENAPI_FOLDER/$VERSION_FILE_NAME")
3335

@@ -117,13 +119,10 @@ else
117119
cp intermediateCollectionWithLinks.json intermediateCollectionPostBody.json
118120
fi
119121

120-
if [ "$TOKEN_URL_ENV" != "" ]; then
121-
echo "Adding client credentials auth url variable $TOKEN_URL_ENV"
122-
jq --arg token_url "$TOKEN_URL_ENV" '.collection.variable += [{"key": "clientCredentialsTokenUrl", "value": $token_url}]' \
123-
intermediateCollectionPostBody.json > "$COLLECTION_TRANSFORMED_FILE_NAME"
124-
else
125-
cp intermediateCollectionPostBody.json "$COLLECTION_TRANSFORMED_FILE_NAME"
126-
fi
122+
# Remove trailing whitespaces by reformatting the JSON
123+
echo "Removing trailing whitespaces from the final JSON file"
124+
jq '.' "$COLLECTION_TRANSFORMED_FILE_NAME" > tmp.json && mv tmp.json "$COLLECTION_TRANSFORMED_FILE_NAME"
125+
127126

128127
# Clean up temporary files
129128
echo "Removing temporary files"

0 commit comments

Comments
 (0)