-
Notifications
You must be signed in to change notification settings - Fork 218
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
Generate object type value giving unexpexced results #5971
Comments
Hi @Skulek This is working as expected:
Let us know if you have any additional comments or questions. |
Thank you for your quick response @baywet ! var httpClient = new HttpClient();
var adapter = new HttpClientRequestAdapter(new AnonymousAuthenticationProvider(), httpClient: httpClient);
adapter.BaseUrl = "http://localhost:7053";
var client = new CryptographyClient(adapter);
try
{
// Encrypt
var encryptResponse = await client.Encrypt.PostAsync(new EncryptRequest
{
// Value = "Test",
Value = new EncryptRequest_value()
});
Console.WriteLine($"Encrypted: {encryptResponse.Data}");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
} |
Thank you for the additional information. The snippet you've provided looks correct, do you get any error? |
Thank you for the additional information. Could you please share what resulting payload you'd expect? |
@baywet - sorry but I don't quite understand tbh. public sealed record EncryptRequest
{
public object? Value { get; set; }
public string? DataType { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Dictionary<string, string>? Properties { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Dictionary<string, object>? ContextItems { get; set; }
} i just want from the client itself create simple request like // Encrypt
var encryptResponse = await client.Encrypt.PostAsync(new EncryptRequest
{
// Value = "Test",
Value = new EncryptRequest_value("test"),
DataType = "string",
});
Console.WriteLine($"Encrypted: {encryptResponse.Data}"); |
Do you happen to have any updates on that @baywet ? does my answer is enough for you ? |
Hey @Skulek Given that the So, you would then have code like below leveraging the Value = new EncryptRequest_value
{
AdditionalData = new Dictionary<string, object>
{
{ "stringProperty", "stringValues"},
{ "intProperty", 77},
}
}; To have a json body produced that looks close to this {
"value": {
"stringProperty": "stringValue",
"intProperty": 77
}
} |
Hello,
I have a problem with generating the Request object with property type of object.
I have a specification from swagger.json that clearly says that it should be an object
but after kiota generation i dont have an access to fill in that value. This is the result of generation
The text was updated successfully, but these errors were encountered: