-
Notifications
You must be signed in to change notification settings - Fork 127
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
Remove uninitialized ActiveVersion field from Service struct? #242
Comments
👋🏻 @asobrien Thanks for opening this issue. I'm reaching out to our API team to find out if I'll update you once I have some feedback. |
Hi @asobrien thanks for your patience. After some investigation (which also revealed that parts of the API documentation was incorrect) it would seem that the underlying confusion stems from the reuse of the For example, You are indeed correct that the API response data to I don't necessarily think this is a big concern, as the zero value in this case would indicate there's no active version information available, and for It would be nice if we didn't have to include the With that in mind I'm inclined not to make any changes at this point in time. |
Thanks for the response @Integralist.
I just verified that this is indeed true. I initially thought Ultimately, I think the source of confusion stems from API documentation for the Service resource. I'd agree that it doesn't make sense that to return multiple distinct
I'd agree with this given that |
The fastly client's
GetService()
method returns aService
struct which includes anActiveVersion
field, however the Fastly API docs for theGET /service/{service_id}
endpoint (which the method in question utilizes) does not include anactive_version
field in its response:The consequence of this is that the
Service
struct advertises anActiveVersion
in the docs (e.g., godoc) although it will never be initialized and will always be equal to the underlying type's zero-value (i.e.,0
). The fact that this unused public field is part of theService
struct can be misleading.(I stumbled upon this issue by using the
ActiveVersion
in aService
struct which led to downstream errors. TheGetServiceDetails()
method and its returnedServiceDetail
struct worked as expected.)This all leads to following question:
Should the
Service
struct'sActiveVersion
field be removed?Removing it does introduce a breaking change. However, any end users rely on the
ActiveVersion
field from aService
would likely be dealing with unexpected behavior in any case. Note that none of the API's service endpoints return aactive_version
key in their response. I'd advocate for the field's removal (I did open this issue after all) but I'm curious what the maintainers/community have to say given the breaking change that would be introduced.The text was updated successfully, but these errors were encountered: