MCPcopy Create free account
hub / github.com/goadesign/goa / openAPITypeFormat

Function openAPITypeFormat

http/codegen/openapi/v2/builder.go:399–421  ·  view source on GitHub ↗
(at *expr.AttributeExpr)

Source from the content-addressed store, hash-verified

397}
398
399func 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
423func resolvedAliasAttribute(at *expr.AttributeExpr) *expr.AttributeExpr {
424 if expr.IsAlias(at.Type) {

Callers 3

paramForFunction · 0.85
itemsFromExprFunction · 0.85
headersFromExprFunction · 0.85

Calls 3

resolvedAliasAttributeFunction · 0.85
NameMethod · 0.65
KindMethod · 0.65

Tested by

no test coverage detected