@@ -472,6 +472,8 @@ func describeAPI(name string, resourcesRes *schema.GetResourcesResponse, flagVer
472472
473473 out += titleStr ("Model Input Signature" )
474474
475+ out += describeModelInput (groupStatus , apiEndpoint )
476+
475477 if modelName , ok := yaml .ExtractAtSymbolText (api .Model ); ok {
476478 model := ctx .Models [modelName ]
477479 resIDs := strset .New ()
@@ -489,51 +491,51 @@ func describeAPI(name string, resourcesRes *schema.GetResourcesResponse, flagVer
489491 }
490492 sort .Strings (samplePlaceholderFields )
491493 samplesPlaceholderStr := `{ "samples": [ { ` + strings .Join (samplePlaceholderFields , ", " ) + " } ] }"
492- out += "Payload: " + samplesPlaceholderStr + "\n "
493- } else {
494- if groupStatus .Available () == 0 {
495- out += "Waiting for API to be ready"
496- return out , nil
497- }
494+ out += "\n \n Payload: " + samplesPlaceholderStr
495+ }
498496
499- modelInput , err := getModelInput (urls .Join (apiEndpoint , "signature" ))
500- if err != nil {
501- out += "Waiting for API to be ready"
502- return out , nil
503- }
497+ return out , nil
498+ }
504499
505- rows := make ([][]interface {}, len (modelInput .Signature ))
506- rowNum := 0
507- for inputName , featureSignature := range modelInput .Signature {
508- shapeStr := make ([]string , len (featureSignature .Shape ))
509- for idx , dim := range featureSignature .Shape {
510- if dim == 0 {
511- shapeStr [idx ] = "?"
512- } else {
513- shapeStr [idx ] = s .Int (dim )
514- }
515- }
516- rows [rowNum ] = []interface {}{
517- inputName ,
518- featureSignature .Type ,
519- s .ObjFlatNoQuotes (shapeStr ),
500+ func describeModelInput (groupStatus * resource.APIGroupStatus , apiEndpoint string ) string {
501+ if groupStatus .Available () == 0 {
502+ return "Waiting for API to be ready"
503+ }
504+
505+ modelInput , err := getModelInput (urls .Join (apiEndpoint , "signature" ))
506+ if err != nil {
507+ return "Waiting for API to be ready"
508+ }
509+
510+ rows := make ([][]interface {}, len (modelInput .Signature ))
511+ rowNum := 0
512+ for inputName , featureSignature := range modelInput .Signature {
513+ shapeStr := make ([]string , len (featureSignature .Shape ))
514+ for idx , dim := range featureSignature .Shape {
515+ if dim == 0 {
516+ shapeStr [idx ] = "?"
517+ } else {
518+ shapeStr [idx ] = s .Int (dim )
520519 }
521- rowNum ++
522520 }
523-
524- t := table.Table {
525- Headers : []table.Header {
526- {Title : "FEATURE" , MaxWidth : 32 },
527- {Title : "TYPE" , MaxWidth : 10 },
528- {Title : "SHAPE" , MaxWidth : 20 },
529- },
530- Rows : rows ,
521+ rows [rowNum ] = []interface {}{
522+ inputName ,
523+ featureSignature .Type ,
524+ "(" + strings .Join (shapeStr , ", " ) + ")" ,
531525 }
526+ rowNum ++
527+ }
532528
533- out += table .MustFormat (t )
529+ t := table.Table {
530+ Headers : []table.Header {
531+ {Title : "FEATURE" , MaxWidth : 32 },
532+ {Title : "TYPE" , MaxWidth : 10 },
533+ {Title : "SHAPE" , MaxWidth : 20 },
534+ },
535+ Rows : rows ,
534536 }
535537
536- return out , nil
538+ return table . MustFormat ( t )
537539}
538540
539541func getModelInput (infoAPIPath string ) (* schema.ModelInput , error ) {
0 commit comments