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

Make API fields read only #143

Closed
sambhav opened this issue May 24, 2022 · 3 comments
Closed

Make API fields read only #143

sambhav opened this issue May 24, 2022 · 3 comments
Labels
type:task A general task
Milestone

Comments

@sambhav
Copy link
Member

sambhav commented May 24, 2022

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.

@sambhav sambhav added this to the 2.0 milestone Jun 3, 2022
@dmikusa
Copy link
Contributor

dmikusa commented Oct 3, 2023

@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
Copy link

@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?

@dmikusa
Copy link
Contributor

dmikusa commented Oct 25, 2024

I'm going to close this as we've cut release v2 and this didn't make it in. If we want to revisit this, I'll let whomever is interested in driving the effort open a new issue.

@dmikusa dmikusa closed this as completed Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:task A general task
Projects
None yet
Development

No branches or pull requests

4 participants