fix $refs parsing in nested arrays, add schema.to_h method returning plain hash with de-referenced $refs