Skip to content

Route parameters not supported when string value #8

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

Closed
TheJayMann opened this issue Sep 8, 2021 · 2 comments · Fixed by #9
Closed

Route parameters not supported when string value #8

TheJayMann opened this issue Sep 8, 2021 · 2 comments · Fixed by #9

Comments

@TheJayMann
Copy link

Attempting to generate a method which has a parameter in the route template where the parameter is defined as a string causes the parameter to be ignored completely. This appears to be caused by only considering value typed parameters (not including CancellationToken) as valid. Given that string is often used as a primitive even though it is not a value type, I believe it should be special cased in, similar to how CancellationToken is currently special cased out.

@TheJayMann
Copy link
Author

One possible workaround for now is creating a wrapper type.

    public readonly struct StringWrapper {
        private readonly string _Value;

        public StringWrapper(string value) => _Value = value;

        public override string ToString() => _Value;

        public static implicit operator StringWrapper(string value) => new(value);

    }

@Jalalx
Copy link
Owner

Jalalx commented Sep 9, 2021

Thank you for reporting it. Please update to the NuGet version 0.6.1.

@Jalalx Jalalx closed this as completed Sep 9, 2021
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 a pull request may close this issue.

2 participants