mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
OpenAPI: Sort parameters for stable output (#22043)
In my recent #21942, I overlooked the need to sort another part of the OpenAPI document to ensure stable output. I've also removed `strings.ToLower()` from the code I copied from, as this code is sorting Vault API parameter names, which are all lowercase anyway!
This commit is contained in:
@@ -316,7 +316,7 @@ func documentPath(p *Path, backend *Backend, requestResponsePrefix string, doc *
|
||||
|
||||
// Sort parameters for a stable output
|
||||
sort.Slice(pi.Parameters, func(i, j int) bool {
|
||||
return strings.ToLower(pi.Parameters[i].Name) < strings.ToLower(pi.Parameters[j].Name)
|
||||
return pi.Parameters[i].Name < pi.Parameters[j].Name
|
||||
})
|
||||
|
||||
// Process each supported operation by building up an Operation object
|
||||
@@ -462,6 +462,11 @@ func documentPath(p *Path, backend *Backend, requestResponsePrefix string, doc *
|
||||
}
|
||||
op.Parameters = append(op.Parameters, p)
|
||||
}
|
||||
|
||||
// Sort parameters for a stable output
|
||||
sort.Slice(op.Parameters, func(i, j int) bool {
|
||||
return op.Parameters[i].Name < op.Parameters[j].Name
|
||||
})
|
||||
}
|
||||
|
||||
// Add tags based on backend type
|
||||
|
||||
Reference in New Issue
Block a user