Framework for building portable, auto-validating and self-documenting APIs