Skip to content

Dart serialization uses incorrect property names #6444

@papegaaij

Description

@papegaaij

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

Dart

Describe the bug

Since 1.25.1 code generation for Dart is using incorrect names for the serialization when a naming conflict occurs. This seems to be caused by #6393 (which is included in 1.25.1 even thought it's not mentioned in the release notes). The attached OpenAPI spec results in the following code in the (de)serialization:

writer.writeStringValue('CertificateGetResponseType', certificateGetResponseType);
writer.writeIntValue('type', type_);

Expected behavior

The generated code should have looked like this (which it was in 1.24.3):

writer.writeStringValue('\$type', certificateGetResponseType);
writer.writeIntValue('type', type_);

How to reproduce

Generate the Dart SDK for the openapi spec included below.

Open API description file

openapi.json

Kiota Version

1.25.1

Latest Kiota version known to work for scenario above?(Not required)

1.24.3

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ``` dbug: Kiota.Builder.KiotaBuilder[0] kiota version 1.25.1 info: Kiota.Builder.KiotaBuilder[0] loaded description from local source dbug: Kiota.Builder.KiotaBuilder[0] step 1 - reading the stream - took 00:00:00.0209366 dbug: Kiota.Builder.KiotaBuilder[0] step 2 - parsing the document - took 00:00:00.2969836 dbug: Kiota.Builder.KiotaBuilder[0] step 3 - updating generation configuration from kiota extension - took 00:00:00.0002843 dbug: Kiota.Builder.KiotaBuilder[0] step 4 - filtering API paths with patterns - took 00:00:00.0098076 info: Kiota.Builder.KiotaBuilder[0] Client root URL set to https://keyhub.example.com/keyhub/rest/v1 dbug: Kiota.Builder.KiotaBuilder[0] step 5 - checking whether the output should be updated - took 00:00:00.0408300 dbug: Kiota.Builder.KiotaBuilder[0] step 6 - create uri space - took 00:00:00.0065002 info: Kiota.Builder.KiotaBuilder[0] No changes detected, skipping generation Update of KeyHubClient client for Dart at /home/papegaaij/work/dart-test/lib/. completed Client base url set to https://keyhub.example.com/keyhub/rest/v1 Update of 1 clients completed successfully

Hint: use the info command to get the list of dependencies you need to add to your project.
Example: kiota info -d "/home/papegaaij/work/dart-test/openapi.json" -l Dart

</details>


### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done ✔️

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions