ppcv
v1.0.4
Published
CLI validator for Power Platform custom connector files (apiDefinition.swagger.json, apiProperties.json, script.csx)
Downloads
481
Maintainers
Readme
ppcv
Power Platform Connector Validator. Checks apiDefinition.swagger.json, apiProperties.json, and script.csx against official Microsoft schemas and documented requirements.
Install
npm install -g ppcvOr run without installing:
npx ppcv ./MyConnectorUsage
ppcv [path] [options]
Arguments:
path Path to a connector folder or apiDefinition.swagger.json
(defaults to current directory)
Options:
--json, -j Output results as JSON (for CI/CD pipelines)
--help, -h Show help
--version, -v Show versionExamples
# Validate a connector folder
ppcv ./MyConnector
# JSON output for CI/CD
ppcv ./MyConnector --json
# Validate current directory
ppcv
# Pipe JSON to jq
ppcv ./MyConnector -j | jq '.errors'
# Batch validate all connectors
for dir in */; do
if [ -f "$dir/apiDefinition.swagger.json" ]; then
ppcv "$dir" --json
fi
doneWhat It Checks
apiDefinition.swagger.json
- Required fields (
swagger,info,paths) - Swagger 2.0 version
- Host and basePath format
- Unique operationIds
- Response definitions on every operation
- Parameter completeness (name, in, type, required)
- Path parameters have
x-ms-url-encoding - Array schemas include
items - Security definitions have
type x-ms-connector-metadatapresence
apiProperties.json
- Required
properties.iconBrandColor(hex format) - Connection parameter types and OAuth
identityProvidervalues scriptOperationscross-checked against swagger operationIds- Valid
capabilitiesvalues
script.csx
Per MS Learn: Write code in a custom connector:
- File size under 1 MB
- Class named
ScriptextendingScriptBase - Implements
ExecuteAsyncmethod - Only supported namespaces in
usingstatements - No
new HttpClient()(usethis.Context.SendAsync) - Fully qualified
Newtonsoft.Json.Formatting(avoids ambiguous references) - Balanced braces (catches truncated files)
JSON Output Schema
{
"connector": "MyConnector",
"path": "/path/to/MyConnector",
"valid": true,
"operations": 12,
"errors": [],
"warnings": ["..."],
"files": {
"apiDefinition.swagger.json": { "valid": true, "errors": [], "warnings": [] },
"apiProperties.json": { "valid": true, "errors": [], "warnings": [] },
"script.csx": { "valid": true, "errors": [], "warnings": [] }
}
}CI/CD Integration
GitHub Actions
- name: Validate connectors
run: |
npx ppcv ./MyConnector --json > result.json
if [ $(jq '.valid' result.json) = "false" ]; then
jq '.errors[]' result.json
exit 1
fiLicense
MIT
