MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetSchema

Method GetSchema

backend/api/mcp/openapi_index.go:511–530  ·  view source on GitHub ↗

GetSchema returns the schema properties for a component schema by name. Supports both full name (bytebase.v1.Instance) and short name (Instance).

(name string)

Source from the content-addressed store, hash-verified

509// GetSchema returns the schema properties for a component schema by name.
510// Supports both full name (bytebase.v1.Instance) and short name (Instance).
511func (idx *OpenAPIIndex) GetSchema(name string) ([]PropertyInfo, bool) {
512 if idx.doc.Model.Components == nil || idx.doc.Model.Components.Schemas == nil {
513 return nil, false
514 }
515
516 // Try exact name first
517 if props := idx.getSchemaByName(name); props != nil {
518 return props, true
519 }
520
521 // Try with bytebase.v1. prefix
522 if !strings.HasPrefix(name, "bytebase.v1.") {
523 fullName := "bytebase.v1." + name
524 if props := idx.getSchemaByName(fullName); props != nil {
525 return props, true
526 }
527 }
528
529 return nil, false
530}
531
532func (idx *OpenAPIIndex) getSchemaByName(name string) []PropertyInfo {
533 schemaProxy, ok := idx.doc.Model.Components.Schemas.Get(name)

Calls 1

getSchemaByNameMethod · 0.95

Tested by

no test coverage detected