buildpacks / libcnb

A non-opinionated language binding for the Cloud Native Buildpack Buildpack and Extension specifications
Apache License 2.0
31 stars 13 forks source link

Make API fields read only #143

Open samj1912 opened 2 years ago

samj1912 commented 2 years ago

There are quite a few structs in libcnb that are both public read/writeable. We should make sure that any fields generated by the library and expected to have a consistent value cannot be changed by end users.

dmikusa commented 11 months ago

@samj1912 What were you thinking here. As far as I know, there's no magic "read-only" flag for structs. I think we'd have to change all the fields to private and export getters for the values, which would be a pretty big API change.

I've not observed this as a problem, having someone change fields that shouldn't be changed. You're really just shooting yourself in the foot by doing that. Have you observed this as an issue? or were you thinking of this as a nice to have?

We've got quite a few changes to the API already, just trying to gauge the impact of this change and see if it's worth adding more changes to the list. Thanks

loewenstein commented 3 months ago

@dmikusa @samj1912 is this in the 2.0 milestone because it cannot be done in 1.x or because it is a requirement to release 2.0?