Anypoint Studio
-
Studio updates
- Keep your Anypoint Studio up-to-date (Install Studio Updates when available)
API Custom Policy Projects in Anypoint Studio
- Use Anypoint Studio to create new API Custom Policies
XML indentation and formatting
- Define a line width in your Anypoint Studio XML editor preferences, e.g. 140
- Indent the policy xml before committing to the source code repository
Naming Conventions
Category |
Convention |
Pattern |
Examples |
---|---|---|---|
API Custom Policy Projects | kebab-case | {name}-policy | governance-policy
sql-injection-prevention-policy |
Policy component names | kebab-case | {significant-description} | http-request-config
access-denied-filter policy-violation-response |
Policy Components
Transformations
- Use Dataweave:
- To transform/enrich the data and build error/response messages instead of custom scripting code
- Define the input content-type to avoid verbosive messages in the Log e.g.
< dw:transform-message doc:name = "Build Approval Message" > < dw:input-payload mimeType = "application/java" /> < dw:set-payload resource = "classpath:dw/governance/build-approval-status-response.dwl" /> </ dw:transform-message > |
- For more information:
Before section
- Use message enricher in order to keep the original payload intact
- Use processor-chain inside the enricher if you have more than 1 element in the logic
- Use variables to store the results in order to be used in the filters
- Use filters with expressions to handle the policy logic results
After section
- Use message enricher if you don’t want to change the payload