Skip to content

troystaylor/ppcv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 ppcv

Or run without installing:

npx ppcv ./MyConnector

Usage

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 version

Examples

# 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
done

What 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-metadata presence

apiProperties.json

  • Required properties.iconBrandColor (hex format)
  • Connection parameter types and OAuth identityProvider values
  • scriptOperations cross-checked against swagger operationIds
  • Valid capabilities values

script.csx

Per MS Learn: Write code in a custom connector:

  • File size under 1 MB
  • Class named Script extending ScriptBase
  • Implements ExecuteAsync method
  • Only supported namespaces in using statements
  • No new HttpClient() (use this.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
    fi

License

MIT

About

Power Platform Connector Validator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages