allow recursive dereferencing

I had an error in the `doc_type` method because the given dereferenced property was in fact itself a reference to another definition.

This simple change allows recursive dereferencing and fixes the issue.
Merge pull request #66 from olance/patch-1

allow recursive dereferencing