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

Add feeds field to Answer #242

Merged
merged 1 commit into from
Sep 23, 2024
Merged

Add feeds field to Answer #242

merged 1 commit into from
Sep 23, 2024

Conversation

marcsello
Copy link
Contributor

This PR adds the missing "Feeds" field to the "Answer" struct as described in this issue: #240

Comment on lines +15 to +16
FeedID string `json:"feed"`
SourceID string `json:"source"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi; I'm not sure if they can be missing, but just in case, can you make these fields omitempty?

Suggested change
FeedID string `json:"feed"`
SourceID string `json:"source"`
FeedID *string `json:"feed,omitempty"`
SourceID *string `json:"source,omitempty"`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the feedback!

As far as I know, omitempty is only relevant when marshaling a field, and it seems to me that these fields would never get marshaled, they are only present in the API response.

Also what would be the benefit of using pointers here? Empty strings are already invalid for this data type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose I'm mostly worried about Terraform, who tends to write what it reads and has a bad habit of adding extra elements in arrays, both of which would result in empty strings being sent in an update; but looking at the code it will just ignore the new field, so I admit it should be fine.

@fformica fformica merged commit 0874e7e into ns1:v2 Sep 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants