Change OpenAPI code generator to extract request objects (#14217)

This commit is contained in:
Anton Averchenkov
2022-03-11 19:00:26 -05:00
committed by GitHub
parent ef8ce03e70
commit dcb5942bd1
11 changed files with 150 additions and 58 deletions

View File

@@ -301,9 +301,17 @@ func (p *Path) helpCallback(b *Backend) OperationFunc {
return nil, errwrap.Wrapf("error executing template: {{err}}", err)
}
// The plugin type (e.g. "kv", "cubbyhole") is only assigned at the time
// the plugin is enabled (mounted). If specified in the request, the type
// will be used as part of the request/response names in the OAS document
var requestResponsePrefix string
if v, ok := req.Data["requestResponsePrefix"]; ok {
requestResponsePrefix = v.(string)
}
// Build OpenAPI response for this path
doc := NewOASDocument()
if err := documentPath(p, b.SpecialPaths(), b.BackendType, doc); err != nil {
if err := documentPath(p, b.SpecialPaths(), requestResponsePrefix, b.BackendType, doc); err != nil {
b.Logger().Warn("error generating OpenAPI", "error", err)
}