Skip to content

CSharp - Path Parameters should keep their name and descriptions #2978

@pillowfication

Description

@pillowfication

Using the OpenAPI 3.0.0 petstore sample

kiota generate -d "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json" -l CSharp

The part of interest is

"paths": {
  "/pets/{petId}": {
    "get": {
      "parameters": [
        {
          "name": "petId",
          "in": "path",
          "required": true,
          "description": "The id of the pet to retrieve",
          "schema": {
            "type": "string"
          }
        }
      ]
    }
  }
}

Current Behavior

The following block of code is created for the indexer

/// <summary>Gets an item from the ApiSdk.pets.item collection</summary>
public WithPetItemRequestBuilder this[string position] { get {
    var urlTplParams = new Dictionary<string, object>(PathParameters);
    if (!string.IsNullOrWhiteSpace(position)) urlTplParams.Add("petId", position);
    return new WithPetItemRequestBuilder(urlTplParams, RequestAdapter);
} }

current behavior

Expected Behavior

I would like for the position variable to be named the same as the path parameter petId. I would also like for path parameter's description to be kept and placed in a corresponding <param/> documentation.

/// <summary>Gets an item from the ApiSdk.pets.item collection</summary>
/// <param name="petId">The id of the pet to retrieve</param>
public WithPetItemRequestBuilder this[string petId] { get {
    var urlTplParams = new Dictionary<string, object>(PathParameters);
    if (!string.IsNullOrWhiteSpace(petId)) urlTplParams.Add("petId", petId);
    return new WithPetItemRequestBuilder(urlTplParams, RequestAdapter);
} }

expected behavior

Metadata

Metadata

Assignees

Labels

WIPenhancementNew feature or requestgeneratorIssues or improvements relater to generation capabilities.

Type

No type

Projects

Status

Done ✔️

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions