Various fixes

This fixes array classes with $ref to correctly build/return the innerList with Schemaclasses.

Also correctly used `discriminant` in the variant for the switch instead of the hardcoded "type", just to be a bit more future-proof :)