Anja Gruss
05/18/2022, 12:03 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Anja Gruss
05/18/2022, 12:11 PMAnja Gruss
05/18/2022, 1:15 PMOAS=$(cat ${CI_BUILDS_DIR}/${CI_PROJECT_PATH}/target/openApi/openapi.yml | base64 -w0)
Anja Gruss
05/18/2022, 1:16 PMcurl \
-X PUT \
-H "Authorization: Bearer ${PACT_BROKER_TOKEN}" \
-H "Content-Type: application/json" \
"${PACT_BROKER_BASE_URL}/contracts/provider/${PACTICIPANT}/version/${CI_COMMIT_SHORT_SHA}" \
-d '{ "content": "'$OAS'", "contractType": "oas", "contentType": "application/yaml", "verificationResults": { "success": '$SUCCESS', "content": '$REPORT', "contentType": "text/plain", "verifier": "verifier" } }'
the output of the curl:
==> Uploading OAS to Pactflow
196 % Total % Received % Xferd Average Speed Time Time Time Current
197 Dload Upload Total Spent Left Speed
198100 13839 100 6973 100 6866 4849 4774 00001 00001 -- -- 9617
199{"error":"Error parsing JSON - Error parsing JSONMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
$REPORT
a string or a a primitive? I think it would need escaping also if it’s a string (update: definitely needs quoting if a string, see below)Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
export REPORT="aoeuaeou"
export SUCCESS=true
echo '{ "content": "'$OAS'", "contractType": "oas", "contentType": "application/yaml", "verificationResults": { "success": '$SUCCESS', "content": '$REPORT', "contentType": "text/plain", "verifier": "verifier" } }' | jq .
parse error: Invalid numeric literal at line 1, column 137
Anja Gruss
05/18/2022, 1:36 PMAnja Gruss
05/18/2022, 1:37 PMAnja Gruss
05/18/2022, 1:39 PMMatt (pactflow.io / pact-js / pact-go)
Anja Gruss
05/18/2022, 1:42 PMAnja Gruss
05/18/2022, 1:42 PMAnja Gruss
05/18/2022, 1:44 PMAnja Gruss
05/18/2022, 1:46 PM