Incorrect primitive_type in generated code causes "Encountered an unknown type during deserialization str" #5417
Labels
help wanted
Issue caused by core project dependency modules or library
Needs: Attention 👋
Python
type:bug
A broken experience
WIP
Milestone
What are you generating using Kiota, clients or plugins?
API Client/SDK
In what context or format are you using Kiota?
Linux executable
Client library/SDK language
Python
Describe the bug
When I use the versions below of Kiota the following error occurs:
Exception: Encountered an unknown type during deserialization str
I think that the bug is due to send_collection_of_primitive_async passing argument
primitive_type
asstr
instead of<class type[str]>
and located here: https://github.com/microsoft/kiota/blob/main/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs#L808"microsoft-kiota-abstractions==1.3.3",
"microsoft-kiota-http==1.3.3",
"microsoft-kiota-serialization-json==1.3.2",
"microsoft-kiota-serialization-text==1.0.0",
"microsoft-kiota-serialization-form==0.1.1",
"microsoft-kiota-serialization-multipart==0.1.0",
Expected behavior
The get method should return a list of strings (names).
How to reproduce
Have Kiota generate a python code for an endpoint that returns a JSON collection of string (python equivalent: List[str]).
Open API description file
Kiota Version
1.18.0+5c6b5d0ef23865ba2f9d9f0b9fe4b944cf26b1ec
Latest Kiota version known to work for scenario above?(Not required)
No response
Known Workarounds
Manually edited the generated code and replace
"str"
withstr
.Configuration
Can't see that it is specific to this configuration.
Debug output
Other information
The generated
get method
for the endpoint seems to be incorrect ("str"
instead ofstr
):return await self.request_adapter.send_collection_of_primitive_async(request_info, "str", None)
Which will cause the
if generic_type in primitive_types:
in JsonParseNode.get_collection_of_primitive_values to be Falsesince "str" is NOT in primitive_types due it being an actual string (and not str, i.e. a ).
Example:
The text was updated successfully, but these errors were encountered: