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

LAN PCC field cannot be cleared #23

Open
avorima opened this issue Apr 7, 2022 · 3 comments
Open

LAN PCC field cannot be cleared #23

avorima opened this issue Apr 7, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@avorima
Copy link

avorima commented Apr 7, 2022

Description

To reset or clear the lan.properties.pcc field the cloud API expects the JSON field to have the value null.

The PCC field is a string pointer that annotated with omitempty. This means that when it is marshaled with the Go value nil the field is omitted.

Since the model can never have any value that produces the required JSON value of null in the PCC field, it is not possible to clear this value using this SDK.

I fixed this here by adding a separate struct that only contains the PCC field and allows to output null.

@avorima avorima added the bug Something isn't working label Apr 7, 2022
@cristiGuranIonos
Copy link
Contributor

We will make the field nullable.

@avorima
Copy link
Author

avorima commented Apr 7, 2022

We will make the field nullable.

Please bear in mind that the field should still be optional. If the default value produces null then it can't really be used for PATCH anymore because it must be set to the previous value to prevent overwrites

@avorima
Copy link
Author

avorima commented Apr 7, 2022

I would propose a custom MarshalJSON function that renders the empty string as null. That way nil can still be omitted and "" will unset the field. I think using the empty string is OK, because it is not a valid PCC ID value to begin with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants