Skip to content

Commit d4b0f69

Browse files
authored
CLOUDP-308303: remove whitespaces to reduce collection size (#603)
1 parent bbca316 commit d4b0f69

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,21 @@ else
125125
cp intermediateCollectionPostBody.json "$COLLECTION_TRANSFORMED_FILE_NAME"
126126
fi
127127

128+
# Remove trailing whitespaces by reformatting the JSON
129+
echo "Removing all whitespaces from the final JSON file"
130+
jq -c '.' "$COLLECTION_TRANSFORMED_FILE_NAME" > tmpnowhitespaces.json && mv tmpnowhitespaces.json "$COLLECTION_TRANSFORMED_FILE_NAME"
131+
128132
# Clean up temporary files
129133
echo "Removing temporary files"
130134
rm intermediateCollectionWrapped.json \
131-
intermediateCollectionDisableQueryParam.json \
132-
intermediateCollectionNoPostmanID.json \
133-
intermediateCollectionNoCircular.json \
134-
intermediateCollectionWithName.json \
135-
intermediateCollectionWithDescription.json \
136-
intermediateCollectionWithBaseURL.json \
137-
intermediateCollectionWithLinks.json \
138-
intermediateCollectionPostBody.json \
139-
intermediateCollectionWithNoVar.json
135+
intermediateCollectionDisableQueryParam.json \
136+
intermediateCollectionNoPostmanID.json \
137+
intermediateCollectionNoCircular.json \
138+
intermediateCollectionWithName.json \
139+
intermediateCollectionWithDescription.json \
140+
intermediateCollectionWithBaseURL.json \
141+
intermediateCollectionWithLinks.json \
142+
intermediateCollectionPostBody.json \
143+
intermediateCollectionWithNoVar.json
140144

141145
popd -0

tools/postman/scripts/transform-postman.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function loadJsonFile(filePath) {
119119
}
120120

121121
function saveJsonFile(filePath, json) {
122-
fs.writeFileSync(filePath, JSON.stringify(json, null, 2), 'utf8');
122+
fs.writeFileSync(filePath, JSON.stringify(json, null, 0), 'utf8');
123123
}
124124

125125
// hack

0 commit comments

Comments
 (0)