Move version out of SDK. (#14229)

Move version out of SDK.  For now it's a copy rather than move: the part not addressed by this change is sdk/helper/useragent.String, which we'll want to remove in favour of PluginString.  That will have to wait until we've removed uses of useragent.String from all builtins.
This commit is contained in:
Nick Cabatoff
2022-12-07 13:29:51 -05:00
committed by GitHub
parent b2354e5aed
commit 35df9489c7
47 changed files with 289 additions and 65 deletions

View File

@@ -317,7 +317,19 @@ func (p *Path) helpCallback(b *Backend) OperationFunc {
}
// Build OpenAPI response for this path
doc := NewOASDocument()
vaultVersion := "unknown"
if b.System() != nil {
// b.System() should always be non-nil, except tests might create a
// Backend without one.
env, err := b.System().PluginEnv(context.Background())
if err != nil {
return nil, err
}
if env != nil {
vaultVersion = env.VaultVersion
}
}
doc := NewOASDocument(vaultVersion)
if err := documentPath(p, b.SpecialPaths(), requestResponsePrefix, false, b.BackendType, doc); err != nil {
b.Logger().Warn("error generating OpenAPI", "error", err)
}