Repository: microsoft/kiota (csharp)

Issue:
Adaptive card OpenAPI extension not correctly written to plugin manifest
### What are you generating using Kiota, clients or plugins?

Kiota plugin

### In what context or format are you using Kiota?

Nuget tool

### Client library/SDK language

None

### Describe the bug

When trying to generate an api plugin from an OpenAPI file, Kiota does not correctly map the x-ai-adaptive card to the plugin manifest. Kiota expects a `dataPath` property instead of `data_path` as set in the extension



### Expected behavior

```json
"capabilities": { 
                "response_semantics": { 
                    "data_path": "$.items", 
                    "static_template": { 
                        "file": "path_to_the_file" 
                    } 
                } 
        } 
```

### How to reproduce

```json
"x-ai-adaptive-card": { 
                   "data_path": "$.items", 
                   "file": "path_to_file" 
                }, 
```


### Open API description file

_No response_

### Kiota Version

1.24.1

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

_No response_

### Known Workarounds

_No response_

### Configuration

_No response_

### Debug output

<details><summary>Click to expand log</summary>
```


<log output here>

```
</details>


### Other information

_No response_

Pull request description:
closes #6351

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f68a555d91..597552ac2b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Added
 
 ### Changed
+- Fixed a bug with reading adaptive card OpenAPI extension and writing to plugin manifest. [#6351](https://github.com/microsoft/kiota/issues/6351)
 
 ## [1.24.2] - 2025-03-25
 
diff --git a/src/Kiota.Builder/OpenApiExtensions/OpenApiAiAdaptiveCardExtension.cs b/src/Kiota.Builder/OpenApiExtensions/OpenApiAiAdaptiveCardExtension.cs
index 0fe538b364..0c2b2e0e04 100644
--- a/src/Kiota.Builder/OpenApiExtensions/OpenApiAiAdaptiveCardExtension.cs
+++ b/src/Kiota.Builder/OpenApiExtensions/OpenApiAiAdaptiveCardExtension.cs
@@ -22,7 +22,7 @@ public static OpenApiAiAdaptiveCardExtension Parse(JsonNode source)
     {
         if (source is not JsonObject rawObject) throw new ArgumentOutOfRangeException(nameof(source));
         var extension = new OpenApiAiAdaptiveCardExtension();
-        if (rawObject.TryGetPropertyValue(nameof(DataPath).ToFirstCharacterLowerCase(), out var dataPath) && dataPath is JsonValue dataPathValue && dataPathValue.GetValueKind() is JsonValueKind.String && dataPathValue.TryGetValue<string>(out var dataPathStrValue))
+        if (rawObject.TryGetPropertyValue(nameof(DataPath).ToFirstCharacterLowerCase().ToSnakeCase(), out var dataPath) && dataPath is JsonValue dataPathValue && dataPathValue.GetValueKind() is JsonValueKind.String && dataPathValue.TryGetValue<string>(out var dataPathStrValue))
         {
             extension.DataPath = dataPathStrValue;
         }
@@ -41,7 +41,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
         if (!string.IsNullOrEmpty(DataPath) && !string.IsNullOrEmpty(File))
         {
             writer.WriteStartObject();
-            writer.WritePropertyName(nameof(DataPath).ToFirstCharacterLowerCase());
+            writer.WritePropertyName(nameof(DataPath).ToFirstCharacterLowerCase().ToSnakeCase());
             writer.WriteValue(DataPath);
             writer.WritePropertyName(nameof(File).ToFirstCharacterLowerCase());
             writer.WriteValue(File);


Test patch:
diff --git a/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiAiAdaptiveCardExtensionTests.cs b/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiAiAdaptiveCardExtensionTests.cs
index 619fd0bf12..dd2154f742 100644
--- a/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiAiAdaptiveCardExtensionTests.cs
+++ b/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiAiAdaptiveCardExtensionTests.cs
@@ -27,7 +27,7 @@ public void Parses()
         var oaiValueRepresentation =
         """
         {
-            "dataPath": "$.items",
+            "data_path": "$.items",
             "file": "path_to_file"
         }
         """;
@@ -65,7 +65,7 @@ public async Task ParsesInDocumentAsync()
                 items:
                   $ref: '#/components/schemas/User'
       x-ai-adaptive-card:
-        dataPath: $.users
+        data_path: $.users
         file: path_to_file
   /users/{id}:
     get:
@@ -85,7 +85,7 @@ public async Task ParsesInDocumentAsync()
               schema:
                 $ref: '#/components/schemas/User'
       x-ai-adaptive-card:
-        dataPath: $.user
+        data_path: $.user
         file: path_to_file
 components:
   schemas:
@@ -128,6 +128,6 @@ public void Serializes()
 
         value.Write(writer, OpenApiSpecVersion.OpenApi3_0);
         var result = sWriter.ToString();
-        Assert.Equal("{\"dataPath\":\"$.items\",\"file\":\"path_to_file\"}", result);
+        Assert.Equal("{\"data_path\":\"$.items\",\"file\":\"path_to_file\"}", result);
     }
 }
diff --git a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs
index 6a8f080b12..1c9c3872c5 100644
--- a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs
+++ b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs
@@ -322,7 +322,7 @@ public async Task GeneratesManifestWithAdaptiveCardExtensionAsync()
         description: external docs for test path
         url: http://localhost/test
       x-ai-adaptive-card:
-        dataPath: $.test
+        data_path: $.test
         file: path_to_file
       responses:
         '200':