Export Google-internal library

Exporting the Google-internal CAP library as submitted at HEAD. Also, fixing the CAP validator to be compatible with it.

The new CAP library has a bunch of new features, bug fixes and validation heuristics. More details to follow in the notes of the upcoming release.
Should these lines be deleted?