GitXplorerGitXplorer
o

policify

public
5 stars
3 forks
2 issues

Commits

List of commits on branch master.
Unverified
0a2b1c2b7d49e71fdebc1c123c15f203f46253d8

0.0.13

oorangewise committed 7 years ago
Unverified
ca3fbab4761a9f2c6d16e6dee582d32454d34ca5

fix readme

oorangewise committed 7 years ago
Unverified
b143ad64d47557f88cda6ba3584ce6fed0d0ad29

typo

oorangewise committed 8 years ago
Unverified
39f0c81a442ccf4dd952232028fd840475c50d3a

0.0.12

oorangewise committed 8 years ago
Unverified
74ed30be38c823828c6a11cdbdf4b666808b49df

adopt standard style

oorangewise committed 8 years ago
Unverified
a9b6d0d2b82443af1e497b4dcf73de90242524dc

0.0.11

oorangewise committed 8 years ago

README

The README file for this repository.

policify

npm version Build Status JavaScript Style Guide

Bundle node dependencies and use them in Apigee Edge javascript policies. Built upon the excellent Browserify project.

Install

npm install policify

Usage

Bundle up the node module you would like to use in Apigee Edge

Create a policify module

In the example below we use the z-schema module in a new module 'policify'. The policify modules will be used in Apigee.

// validate-schema.js
var ZSchema = require('z-schema')

ZSchema = new ZSchema({
  breakOnFirstError: true,
  noExtraKeywords: true,
  ignoreUnknownFormats: false,
  reportPathAsArray: true
})

var policify = {
  validateSchema: function (injected, schema) {
    return ZSchema.validate(injected, schema)
  }
}

module.exports = policify

Bundle it up with policify

npm install policify uglify-js
policify ./validate-schema.js | uglifyjs > bundle.js

Add it to Apigee using a JS policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Javascript timeLimit="200" async="false" continueOnError="true" enabled="true" name="Add Output Validation">
  <DisplayName>Add Output Validation</DisplayName>
  <IncludeURL>jsc://bundle.js</IncludeURL>
  <ResourceURL>jsc://schema-validation.js</ResourceURL>
</Javascript>

Use it (schema-validation.js)

...
var bundle = context.getVariable('bundle')
bundle.policify.validateSchema(target, schema)
...