-
Notifications
You must be signed in to change notification settings - Fork 208
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
QueryParameters Enum in Uri - Exception Illegal class passed as substitution #3693
Comments
Hi @infokomes, @andreaTP std uri template is unhappy because kiota abstractions is passing it enums values or arrays of enum values. |
Now on the phone, but, in general I agree. Just to mention, in general I would not be against |
Opened std-uritemplate/std-uritemplate#91 to showcase how the enum support may look like in |
I was able to implement a fix for dotnet. I'll start looking at other languages on how it could be implemented as well. |
And for Java microsoft/kiota-java#809 |
and the go version, gee the type system is limited microsoft/kiota-abstractions-go#120 |
took me a while to get to typescript because I was busy with other things but it's already supported, added a few unit tests to prevent regressions. |
@baywet, hello I'm still experiencing this in .NET MAUI. I'm on .NET 8 when using enums for query parameters. How can I help to post the diagnostics? Stacktrace: I'm using Kiota 1.8.2: I then tried this code: public async Task GetSymptoms()
{
var test = await _apiClient.Symptoms.GetAsync(client =>
{
client.QueryParameters = new SymptomsRequestBuilderGetQueryParameters
{
BirthYear = 2001,
BodyPart = "head",
Gender = "male"
};
});
} It says that BodyPart and Gender is deprecated (they're both stings) and I should use enums for it. However when I run it, this exception now appears: |
@echolumaque can you check the version of the used libraries? I do believe that updating to |
Thanks, works like a charm! |
Info:
"kiotaVersion": "1.8.2",
"language": "CSharp",
"usesBackingStore": false,
"excludeBackwardCompatible": false,
"includeAdditionalData": false,
PackageReference:
Method URI return Exception:
return new Uri(UriTemplate.Expand(UrlTemplate, dictionary));
System.ArgumentException
HResult=0x80070057
Message=Illegal class passed as substitution, found ...GetFormatQueryParameterType at col:62
Source=Std.UriTemplate
StackTrace:
at Std.UriTemplate.GetSubstitutionType(Object value, Int32 col)
class :
schema openapi: 3.0.3:
The text was updated successfully, but these errors were encountered: