Skip to content
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 tools/cli/internal/openapi/filter/bump.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const (
stateFieldValueUpcoming = "Upcoming"
stateFieldValuePreview = "Preview"
betaFieldName = "x-beta"
description = "\nThis API is in preview. Breaking changes might be introduced before it is released. " +
"Don't use preview APIs in production."
)

func (f *BumpFilter) ValidateMetadata() error {
Expand Down Expand Up @@ -70,6 +72,7 @@ func (f *BumpFilter) includeBumpFieldForPreview() error {
}
op.Extensions[stateFieldName] = stateFieldValuePreview
op.Extensions[betaFieldName] = true
op.Description += description
}
}
return nil
Expand Down
2 changes: 2 additions & 0 deletions tools/cli/internal/openapi/filter/bump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func TestBumpFilter_Apply_Preview(t *testing.T) {
assert.Equal(t, "Preview", op.Extensions["x-state"])
assert.Contains(t, op.Extensions, "x-beta")
assert.Equal(t, true, op.Extensions["x-beta"])
assert.Contains(t, description, op.Description)
}

func TestBumpFilter_Apply_Upcoming(t *testing.T) {
Expand Down Expand Up @@ -115,6 +116,7 @@ func TestBumpFilter_Apply_Upcoming(t *testing.T) {
assert.Contains(t, op.Extensions, "x-state")
assert.Equal(t, "Upcoming", op.Extensions["x-state"])
assert.NotContains(t, op.Extensions, "x-beta")
assert.NotContains(t, op.Description, description)
}

func TestBumpFilter_Apply_Stable(t *testing.T) {
Expand Down
Loading