This directory holds locally-developed policies for testing and iteration
during development. Policies here are not included in production builds
unless explicitly listed in gateway/build.yaml.
-
Create a directory under
dev-policies/for your policy (e.g.dev-policies/my-policy/). It must contain at minimum:go.mod– module definition (depend on the SDK:github.com/wso2/api-platform/sdk)- A
.gofile implementingpolicy.Policy policy-definition.yaml– the policy's parameter schema
-
If you are working on a new policy, copy the
policy-definition.yamlto the default policies directory:cp dev-policies/my-policy/policy-definition.yaml \ gateway-controller/default-policies/my-policy.yaml
Important: The file must be renamed to match your policy name (e.g.,
my-policy.yaml) so the gateway controller can load the policy definition. -
Register it in
gateway/build.yamlusing afilePathentry:policies: - name: my-policy filePath: ./dev-policies/my-policy
-
Build locally:
cd gateway/gateway-runtime make build
Remove your filePath entry from gateway/build.yaml and the copied policy
definition from gateway-controller/default-policies/ so that CI and
production builds are not affected. The policy source under dev-policies/
can stay — it is ignored by the builder unless referenced in the manifest.
count-letters/ is a sample dev policy that counts character occurrences
in response bodies. Use it as a reference for structure and conventions.