TypeRefWithPrefix produces the JSON reference to the type definition and adds the provided prefix to the type name
(api *expr.APIExpr, ut *expr.UserTypeExpr, prefix string)
| 261 | // TypeRefWithPrefix produces the JSON reference to the type definition and adds the provided prefix |
| 262 | // to the type name |
| 263 | func TypeRefWithPrefix(api *expr.APIExpr, ut *expr.UserTypeExpr, prefix string) string { |
| 264 | typeName := ut.TypeName |
| 265 | if prefix != "" { |
| 266 | typeName = codegen.Goify(prefix, true) + codegen.Goify(ut.TypeName, true) |
| 267 | } |
| 268 | if n, ok := ut.Meta["openapi:typename"]; ok { |
| 269 | typeName = codegen.Goify(n[0], true) |
| 270 | } |
| 271 | if _, ok := Definitions[typeName]; !ok { |
| 272 | GenerateTypeDefinitionWithName(api, ut, typeName) |
| 273 | } |
| 274 | return fmt.Sprintf("#/$defs/%s", typeName) |
| 275 | } |
| 276 | |
| 277 | // GenerateResultTypeDefinition produces the JSON schema corresponding to the |
| 278 | // given media type and given view. |
no test coverage detected