gen/goav2gen/definition.go
func (a *APIAnalyzer) typeForRef(ec EvalCtx, r Ref) gen.DataType {
	switch r.Type() {
	case "array":
		fail("References to arrays not implemented yet")
	case "object":
		def := a.Doc.Ref(r)
		if def == nil {
			fail("No ref for %+v", r)
		}
		dt := a.AnalyzeDefinition(ec, def, r.ID())
		if objDT, ok := dt.(*gen.ObjectDataType); ok {
			a.addType(ec, objDT, r)
		}
		return dt
	}
	return basicType(r.Type())

}
func (a *APIAnalyzer) typeForRef(ec EvalCtx, r Ref) gen.DataType {
	switch r.Type() {
	case "array":
		fail("References to arrays not implemented yet")
	case "object":
		def := a.Doc.Ref(r)
		if def == nil {
			fail("No ref for %+v", r)
		}
		dt := a.AnalyzeDefinition(ec, def, r.ID())
		if objDT, ok := dt.(*gen.ObjectDataType); ok {
			a.addType(ec, objDT, r)
		}
		return dt
	}
	return basicType(r.Type())

}
// typeForRef converts a "$ref" reference in the swagger definition to a concrete type, usually an object.