Generate code for validation. Not finished: now, there is to crete the schemes.