Skip to content

Commit 7688c8d

Browse files
Jamie Tannajamietanna
authored andcommitted
feat(x-deprecated-reason): add default deprecation message
In the case that we have a field deprecated, but no reason, the deprecation comment isn't ideal. We can improve this by adding a default message in the case of no `x-deprecated-reason`.
1 parent 5369d1f commit 7688c8d

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

examples/extensions/xdeprecatedreason/gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/test/schemas/schemas.gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/codegen/utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,8 @@ func DeprecationComment(reason string) string {
881881
content := "Deprecated:" // The colon is required at the end even without reason
882882
if reason != "" {
883883
content += fmt.Sprintf(" %s", reason)
884+
} else {
885+
content += " this property has been marked as deprecated upstream, but no `x-deprecated-reason` was set"
884886
}
885887

886888
return stringToGoCommentWithPrefix(content, "")

0 commit comments

Comments
 (0)