Closed jasonjoh closed 2 years ago
Thanks for reporting that @jasonjoh, this is most likely caused by the parameters cleanup regex which is failing to recognize it's an indexable collection, falling back to a path parameter, and trying to generate the naming convention without being able to extract the parameters names https://github.com/microsoft/kiota/blob/8654a5ee338b72373fb20c798371cffb64a0146b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs#L30
The same issue affects CLI when generating the request builders for the API endpoint /users/{user-id}/licenseDetails/{licenseDetails-id}
.
In this instance, there are 2 classes with the same name. When generating CLI code, this situation causes a stack overflow error. For the .NET sdks, there doesn't seem to be any runtime error, but the operations under the Item.LicenseDetailsRequestBuilder
are unreachable via the fluent API.
The above image shows the cause of the stack overflow on line 29.
update: I've authored #1455 to address this issue. As per your comment @calebkiage I think there are two bugs at play here:
I think the second bug should be handled separately for the CLI. Checkout the dotnet generation code which has added logic to circumvent that case.
An Open API path like
/ToDoItems/{id}
will result in an extra model class being generated namedWith
, and aWithRequestBuilder
being generated to handle GET (for a single item), DELETE, and PATCH. The PATCH method (PatchAsync
) doesn't behave as expected - you cannot pass an instance of theToDoItem
class to it, it requires an instance of theWith
class.I was able to work around this by changing my Open API description's path to
/ToDoItems/{ToDoItem-id}
.Repro OpenAPI