MCPcopy Index your code
hub / github.com/docker/cli / validateSchemaVersion

Function validateSchemaVersion

cli-plugins/manager/plugin.go:138–154  ·  view source on GitHub ↗

validateSchemaVersion validates if the plugin's schemaVersion is supported. The current schema-version is "0.1.0", but we don't want to break compatibility until v2.0.0 of the schema version. Check for the major version to be < 2.0.0. Note that CLI versions before 28.4.1 may not support these vers

(version string)

Source from the content-addressed store, hash-verified

136// Note that CLI versions before 28.4.1 may not support these versions as they were
137// hard-coded to only accept "0.1.0".
138func validateSchemaVersion(version string) error {
139 if version == "0.1.0" {
140 return nil
141 }
142 if version == "" {
143 return errors.New("plugin SchemaVersion version cannot be empty")
144 }
145 major, _, ok := strings.Cut(version, ".")
146 majorVersion, err := strconv.Atoi(major)
147 if !ok || err != nil {
148 return fmt.Errorf("plugin SchemaVersion %q has wrong format: must be <major>.<minor>.<patch>", version)
149 }
150 if majorVersion > 1 {
151 return fmt.Errorf("plugin SchemaVersion %q is not supported: must be lower than 2.0.0", version)
152 }
153 return nil
154}
155
156// RunHook executes the plugin's hooks command
157// and returns its unprocessed output.

Callers 1

newPluginFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…