Fixes in the generator

This commit provides fixes in the generator, making the generated
code compile. It also bring back type() instead of contentType().

If a type is provided in the API it is automatically recognized and
changed to <object_name>Type.