Skip to content

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

Closed

Description

@Exellion

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

Activity

  1. TimothyMakkison commented on Oct 19, 2024

    @TimothyMakkison
    Collaborator

    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?

  2. Exellion commented on Oct 23, 2024

    @Exellion
    Author
  3. github-actions commented on Nov 7, 2024

    @github-actions

    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.

  4. locked as resolved and limited conversation to collaborators on Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions