Skip to content

Commit

Permalink
backport of commit e65d295
Browse files Browse the repository at this point in the history
  • Loading branch information
maxb committed May 31, 2023
1 parent 7fb4bbf commit 1b25ff8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/20881.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
sdk/framework: Fix non-deterministic ordering of 'required' fields in OpenAPI spec
```
4 changes: 4 additions & 0 deletions sdk/framework/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ func documentPath(p *Path, specialPaths *logical.Paths, requestResponsePrefix st
s.Properties[name] = &p
}

// Make the ordering deterministic, so that the generated OpenAPI spec document, observed over several
// versions, doesn't contain spurious non-semantic changes.
sort.Strings(s.Required)

// If examples were given, use the first one as the sample
// of this schema.
if len(props.Examples) > 0 {
Expand Down

0 comments on commit 1b25ff8

Please sign in to comment.