Replace &Option<T>
with &T
for UserListParams
& PluginListParams
#142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces
&Option<UserListParams>
with&UserListParams
&&Option<PluginListParams>
with&PluginListParams
.All fields in
UserListParams
&PluginListParams
are optional, so this is mostly a syntax sugar change. I think usingOption<&T>
for these types have better semantics, because it tells the user that this params might or might not be there and if it's there, it's a reference to it. However, we are unable to use that withuniffi
and have to opt for&Option<T>
which has both different semantics and different handling rules for it.I had reluctantly implemented it with
&Option<T>
back when I was first working on this, but it has been bugging me all this time. Now that I am working on generating these endpoints and request builders, this became more than a minor annoyance as I'd have to juggle between&Option<T>
andOption<&T>
from request builder to endpoint types.Using
UserListParams
&PluginListParams
is a good middle ground solution for this and will let me work on generating the request builders without the extra friction.Somewhat unrelated to this PR, I've added test cases for empty fields for filter users & filter plugins. I was just trying to make sure we were handling empty
UsersListParams
&PluginListParams
and ended up adding these cases. Surprisingly, I realized that the server will return all fields if the_fields=
is empty. I am not entirely sure if we are handling this case properly at the moment, but I think adding these tests will help make sure we pay attention to it and maybe iterate on it at a later time.To Test
make test-server && make dump-mysql && make backup-wp-content-plugins
cargo test --test '*' -- --nocapture --test-threads 1
cd native/kotlin && ./gradlew :api:kotlin:integrationTest cAT