-
Notifications
You must be signed in to change notification settings - Fork 16
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
JSON tags added to types #42
Comments
One can go through and "alias" your struct with tags and then type cast onto the alias but this is fragile and does require a consistent check of https://docs.fastly.com/signalsciences/api/#_corps__corpName__sites__siteName__feed_requests_get to make sure there are no changes. |
shawnps
added a commit
that referenced
this issue
Feb 14, 2023
Looks great, thanks so much for the fast turn around! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When consuming the API there are times one might want to marshal the go types. For example when using the go sdk to get the request feed, marshal, then log the marshaled payloads. When doing this however you end up with different marshaled json to a call directly to the API with "accept/json". This is due to the go types not having json tags.
A slimmed down example. The go type:
Would generate marshaled json as
However hitting the API directly would give you a json encoded response of
Tags should be added to the go struct to match the API encoding. Like this
The text was updated successfully, but these errors were encountered: