Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Fix non-deterministic ordering of 'required' field in OpenAPI spec into release/1.13.x #20905

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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