Closed Henry-Sarabia closed 5 years ago
As of now, I am taking option 1 off the table - there needs to be some sort of sane documented behavior. That leaves options 2 and 3.
Option 2 is the simplest, but the package will be less valuable to users who need some sort of expansion support.
Option 3 does give the aforementioned users some sort of recourse, but requires vastly increasing the surface area of the package's public API. There is, however, a compromise that could be made. A new, single Client function can be introduced that will take an endpoint and return the untyped map of the JSON object. This function, perhaps named RawGet or UnsafeGet, provides a sort of escape hatch but gives no guarantees about the returned objects' contents.
For now, I will implement option 2 until I can figure out exactly how I want to handle the unsafe get function.
The IGDB API now supports field expansion. Field expansion allows a user to denote subfields to retrieve in addition to the regular fields of a request. Because Go is a statically typed language, when additional subfields are sent back in the JSON object, the object will no longer match the defined struct and the JSON decoder will return an error.
Here are three options for dealing with this problem.