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

setListOptions does not include options from embedded ListOptions #381

Closed
Freyert opened this issue Feb 15, 2023 · 3 comments
Closed

setListOptions does not include options from embedded ListOptions #381

Freyert opened this issue Feb 15, 2023 · 3 comments
Labels
stale A stale issue or PR

Comments

@Freyert
Copy link
Contributor

Freyert commented Feb 15, 2023

Describe the bug
setListOptions only captures struct fields from 1 level deep. It will not capture options from embedded structs like ListOptions.

So when I do the following:

mongodbatlas.EventListOptions{
		ListOptions: mongodbatlas.ListOptions{
			IncludeCount: false,
		},
		EventType: []string{
			"API_KEY_CREATED",
		},
	}

setListOptions drops:

ListOptions: mongodbatlas.ListOptions{
  IncludeCount: false,
},

Expected behavior
A clear and concise description of what you expected to happen.

When I use a struct that embeds ListOptions, the parameters from the embedded ListOptions will be added to my request.

Logs
If applicable, add logs to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. macOS]
  • Lib Version [e.g. 0.6.0]

Additional context
Add any other context about the problem here.

@gssbzn
Copy link
Collaborator

gssbzn commented Feb 16, 2023

Hi @Freyert if you are seeing this for IncludeCount I believe this this has nothing to do with nested structs and more to do with the fact that field has omitempty and false being considered empty,

IncludeCount bool `url:"includeCount,omitempty"`

To fix this we would need to change IncludeCount to be a pointer if you want to make that change we can review the impact as it will be a breaking change

@Freyert
Copy link
Contributor Author

Freyert commented Feb 21, 2023

Ah! Of course! Great point.

@github-actions
Copy link

This issue has gone 30 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!

@github-actions github-actions bot added the stale A stale issue or PR label Mar 24, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale A stale issue or PR
Projects
None yet
Development

No branches or pull requests

2 participants