-
Notifications
You must be signed in to change notification settings - Fork 19
Development Guide
The API Checker library allows checking a rest servlet against a contract written in WADL. The library is meant to be used within a servlet filter a sample servlet filter is in the filter directory.
CLI utilities exist to support the ability to convert a normalized WADL to the CheckerFormat, and from CheckerFormat to WADL.
The API Checker library has the following phases to create a validator given a WADL:
Phase 1: Normalize the WADL
Phase 2: WADL to CheckerFormat (custom XML format)
Phase 3: CheckerFormat to State Machine
A WADL may have external resources (XSDs, other WADL references) that are needed in order to produce a complete state machine to support the validation of a request. The normalize phase will resolve all external resources and generate a single wadl file that can then be used by Phase 2.
Development Tips
To manually normalize a WADL to support testing of phase 2:
- Clone the wadl-tools repository $ git clone [email protected]:rackerlabs/wadl-tools.git
- Normalize your WADL using the wadltools utilities (cloned from github) $ wadl-tools/bin/normalizeWadl.sh -w {location of your wadl file} -f tree
checker-builder.scala: WADLCheckerBuilder
Transforms normalized WADL using a number of stylesheets into the CheckerFormat (XML). Configuration flags influence the checks that are added to the generated CheckerFormat XML. Stylesheets used by WADLCheckerBuilder include: raxRoles.xsl, builder.xsl
CLI utility: Wadl2Checker
dot-builder.scala: WADLDotBuilder
Create the state machine from the CheckerFormat. The state machine is then used by the validator to validate requests. State machine is created from CheckerFormat XML using the checker2dot stylesheet.
CLI utility: Wadl2Dot
- Saxon License: obtain one and setup your SAXON_HOME environment variable
- Oxygen XML Editor: allows easier development and troubleshooting of XML Stylesheets
- wadl-tools used by api-checker to normalize a WADL. Includes useful CLI utilities to perform the normalization step
- Review the TODO.org file for a historical checklist of implemented features.
- Review the RELEASE.md for release notes
The default maven test phase will run all tests, including tests that require a SAXON license. To exclude tests that don't require a saxon license, use the -Pxerces-only maven cmdline setting.
To properly execute all tests in this source repository, do the following: 1. Obtain a Saxon-PE license and save it in a local file named saxon-license.lic 2. Export a SAXON_HOME environment variable that contains the path to the directory where you saved your saxon-license.lic file