Skip to content

Commit

Permalink
api: Explain how to adapt to visibility changes in future APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Barnes committed May 3, 2024
1 parent 8307aaf commit 05e7060
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/api/v20240610preview/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ func EnumValidateTag[S ~string](values ...S) string {
}

func init() {
// NOTE: If future versions of the API expand field visibility, such as
// a field with @visibility("read","create") becoming updatable,
// then earlier versions of the API will need to override their
// StructTagMap to maintain the original visibility flags. This
// is where such overrides should happen, along with a comment
// about what changed and when. For example:
//
// // This field became updatable in version YYYY-MM-DD.
// clusterStructTagMap["Properties.Spec.FieldName"] = reflect.StructTag("visibility:\"read create\"")
//

api.Register(version{})

// Register enum type validations
Expand Down

0 comments on commit 05e7060

Please sign in to comment.