Added generated code examples.
Return definition referenced types as a set, fixed #393.
Assert base is a message when adding subtypes, fixed #388.