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

[Bug]: [AliasAs(null)] does not omit property anymore #1878

Closed
Exellion opened this issue Oct 14, 2024 · 3 comments
Closed

[Bug]: [AliasAs(null)] does not omit property anymore #1878

Exellion opened this issue Oct 14, 2024 · 3 comments
Labels

Comments

@Exellion
Copy link

Describe the bug 🐞

Previously, I can use AliasAs(null) to mark some properties that shouldn't be included in query parameters. For now (v.7.2.1) it does not work anymore.

Step to reproduce

  1. Mark some property with attribute AliasAs(null)
public class QueryParams
{
     [AliasAs("data")]
     public string Data { get; set; }

     [AliasAs(null)]
     public string SomeForInternalUse { get; set; }
}
  1. Make request like similar
[Post("/api/v1/someEndpoint")]
Task MakeRequestAsync([Query] QueryParams parameters)
  1. Result url will be:
/api/v1/someEndpoint?data=<value>&SomeForInternalUse=<value>

Reproduction repository

https://github.com/reactiveui/refit

Expected behavior

The result url should be (and it was previously so)

/api/v1/someEndpoint?data=<value>

Screenshots 🖼️

No response

IDE

No response

Operating system

No response

Version

No response

Device

No response

Refit Version

7.2.1

Additional information ℹ️

No response

@Exellion Exellion added the bug label Oct 14, 2024
@TimothyMakkison
Copy link
Contributor

TimothyMakkison commented Oct 19, 2024

Hey, it looks like the behaviour of [AliasAs(null)] was unintentional and was unknowingly fixed in 1b45219.

I personally think that Refit could benefit from a feature like this. I don't know if a new attribute should be created or perhaps this quirk should be reintroduced but documented. Would you be open to creating a feature request for this?

@Exellion
Copy link
Author

Feature request created

Copy link

github-actions bot commented Nov 7, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants