The model validator changed into a temporary directory, but the generator derived its output directory from its script location and still wrote into the source tree. Accept an optional API-directory argument and pass the temporary module directory during validation. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>