Sort security scheme provider names#311
Conversation
This ensures the generated constants are output in a deterministic order.
|
I think that unsorted
|
Sorting |
|
Sorry, I misunderstood because these are similar problems.
Yes, I was wrong. However, I've checked this problem on this PR branch. test.yaml openapi: 3.0.2
paths:
/a:
get:
oparationId: a
security:
- ApiId: []
ApiKey: []
components:
ApiId:
type: apiKey
in: header
name: X-Api-Id
ApiKey:
type: apiKey
in: header
name: X-Api-Key$ diff -u <(go run ./cmd/oapi-codegen/ test.yaml) <(go run ./cmd/oapi-codegen/ test.yaml)
--- /dev/fd/11 2021-03-17 13:02:42.000000000 +0900
+++ /dev/fd/12 2021-03-17 13:02:42.000000000 +0900
@@ -251,10 +251,10 @@
func (w *ServerInterfaceWrapper) GetA(ctx echo.Context) error {
var err error
- ctx.Set(ApiKeyScopes, []string{""})
-
ctx.Set(ApiIdScopes, []string{""})
+ ctx.Set(ApiKeyScopes, []string{""})
+
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetA(ctx)
return err |
This ensures the generated constants are output in a deterministic order.
This fixes #310 by ensuring that the generated constants are output in a deterministic (alphabetical) order.