-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple consecutive path parameters result in unusable code #2527
Comments
Thanks for reporting this. Before we invest time into fixing this, I'd like to make sure I understand the problem properly. GitHub has this API pattern /repos/{owners}/{repo}/pulls. client.Repos["owner"]["repo"].Pulls.GetAsync(); Should roughly give us that in Java client.ReposByOwner("owner").ByRepo("repo").Get(); Are you saying that an API segment is missing here? If so the problem is probably located somewhere around here.
Also as we try to correct this, we really need to respect the pattern of on path segment maps to one code path segment. So no aggregating to ByOwnerAndRepo in this example. |
That's correct and is included in the reproducer. |
Alright, thanks for the precision here. This last us to close on a conversation we had forgotten about. See the details in #2528 |
update on this one, here is the PR #2532 It should look something like that now client.repos().withOwner("owner").withRepo("repo").get(); |
and while working on testing the previous PR, I found another edge case, which I don't thing impacts your scenario here but just in case #2534 |
In presence of multiple consecutive path parameters, the generator is emitting unusable code (at least in Go and Java).
And endpoint like:
Is going to produce
Builders
up to the first parameter(x
in the example) but will not include the second and the endpoint is unusable from Kiota-generated code (despite the code compiles).Reproducer
git clone [email protected]:andreaTP/kiota.git --depth 1 --branch consecutive-path-params
cd kiota
(cd src/kiota && dotnet build)
./it/generate-code.ps1 -descriptionUrl ./tests/Kiota.Builder.IntegrationTests/NoUnderscoresInModel.yaml -language java -dev
./it/exec-cmd.ps1 -descriptionUrl ./tests/Kiota.Builder.IntegrationTests/NoUnderscoresInModel.yaml -language java
The test will execute, but you can notice that the generated code doesn't allows to call the
baz
endpoint: https://github.com/andreaTP/kiota/blob/a70d00049a3135fc7be0e0420db51854a9c2919a/it/java/no-underscores/src/test/java/BasicAPITest.java#L18-L20Proposed solution
In presence of consecutive path parameters, we can generate "synthetic" path segments(e.g.
and
orthen
) enabling the rest of the generation to be effective.@lucamolteni is stepping up as a volunteer to take a stab at this issue if we have an agreement on the solution.
The text was updated successfully, but these errors were encountered: