(at *expr.AttributeExpr)
| 397 | } |
| 398 | |
| 399 | func openAPITypeFormat(at *expr.AttributeExpr) (string, string) { |
| 400 | at = resolvedAliasAttribute(at) |
| 401 | p, ok := at.Type.(expr.Primitive) |
| 402 | if !ok { |
| 403 | return at.Type.Name(), "" |
| 404 | } |
| 405 | switch p.Kind() { |
| 406 | case expr.IntKind, expr.UIntKind, expr.Int64Kind, expr.UInt64Kind: |
| 407 | return "integer", "int64" |
| 408 | case expr.Int32Kind, expr.UInt32Kind: |
| 409 | return "integer", "int32" |
| 410 | case expr.Float32Kind: |
| 411 | return "number", "float" |
| 412 | case expr.Float64Kind: |
| 413 | return "number", "double" |
| 414 | case expr.BytesKind: |
| 415 | return "string", "byte" |
| 416 | case expr.AnyKind: |
| 417 | return "", "" |
| 418 | default: |
| 419 | return p.Name(), "" |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | func resolvedAliasAttribute(at *expr.AttributeExpr) *expr.AttributeExpr { |
| 424 | if expr.IsAlias(at.Type) { |
no test coverage detected