(t reflect.Type)
| 169 | } |
| 170 | |
| 171 | func (api *API) getModelName(t reflect.Type) string { |
| 172 | pkgPath, typeName := t.PkgPath(), t.Name() |
| 173 | if t.Kind() == reflect.Pointer { |
| 174 | pkgPath = t.Elem().PkgPath() |
| 175 | typeName = t.Elem().Name() + "Ptr" |
| 176 | } |
| 177 | if t.Kind() == reflect.Map { |
| 178 | typeName = fmt.Sprintf("map[%s]%s", t.Key().Name(), t.Elem().Name()) |
| 179 | } |
| 180 | schemaName := api.normalizeTypeName(pkgPath, typeName) |
| 181 | if typeName == "" { |
| 182 | schemaName = fmt.Sprintf("AnonymousType%d", len(api.models)) |
| 183 | } |
| 184 | return schemaName |
| 185 | } |
| 186 | |
| 187 | func getSchemaReferenceOrValue(name string, schema *openapi3.Schema) *openapi3.SchemaRef { |
| 188 | if shouldBeReferenced(schema) { |
no test coverage detected