Closed rners01 closed 1 month ago
Hi thank you for reporting this issue can you share the interface that was generated by kiota with us please?
Thanks for quick reply @baywet, here is generated interface
export interface UpdateEndpointRequest_my_object extends AdditionalDataHolder, Parsable {
/**
* Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
*/
additionalData?: Record<string, unknown>;
}
Thanks for sharing this, have you tried setting those extra properties in additional data, so something like
{
"myDictionaryObject": {
"additionalData": {
"someValue1": "someKey1",
"someValue2": "someKey2",
},
},
"description": "An example text",
}
They are dynamic keys and values, thats why it's
interface Directory {
[key: string]: string
}
I'm not sure I understand the last comment? The additional data property is a free form dictionary for properties that are not described in the schema, hence my suggestion to use it.
Hey @baywet, I'm not sure I understand.
I don't know about the names/values of dynamic dictionary, so what do you mean by this example with specific keys "someValue1
, ..."?
{
"myDictionaryObject": {
"additionalData": {
"someValue1": "someKey1",
"someValue2": "someKey2",
},
},
"description": "An example text",
}
In my case dynamic props are described like so
{
"myDictionaryObject": {
"description": "The job input schema.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
}
Hey @baywet, can you please explain your proposal?
@rners01 the additionalProperties
will be held in the additionalData
dictionary as key value pairs. What @baywet is suggesting is setting the values in additionalData
property rather than the root of the myDictionaryObject
s that's where the Kiota serializer will look for additional properties not described in the reference schema.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
What are you generating using Kiota, clients or plugins?
API Client/SDK
In what context or format are you using Kiota?
Windows executable
Client library/SDK language
TypeScript
Describe the bug
Im trying to send request data utilizing typescript Kiota client, but the client serializes request body with embedded dictionary object defaulting it to empty object =
{}
.My consoled payload before sending through Kiota client:
Payload form Network tab - after Kiota serialization
See
myDictionaryObject: {}
Potential problem
I think the problem could be with the way I'm describing my dictionary object, in terms of TS I expect here
Record<string, string>
my swagger specification snippet which I use to build kiota clientExpected behavior
send full data with embedded object key, value pairs
How to reproduce
send embedded data eg.
{key1: {key2: value1, key3: value2 }}
Kiota Version
1.14.0+fc4b39c65d89f7bfc8c7f1813c197e95e206da09
Configuration
Snippets
my swagger specification snippet which I use to build kiota client
entry file refine wrapper
My client setup