Skip to content
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

Cannot apply indexing with [] #6053

Closed
TomaszGrzmilas opened this issue Jan 23, 2025 · 4 comments
Closed

Cannot apply indexing with [] #6053

TomaszGrzmilas opened this issue Jan 23, 2025 · 4 comments
Labels
Csharp Pull requests that update .net code Status: No Recent Activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:question An issue that's a question

Comments

@TomaszGrzmilas
Copy link

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Windows executable

Client library/SDK language

Csharp

Describe the bug

I'm trying to get data as described in the documentation, using []:

https://learn.microsoft.com/en-us/openapi/kiota/request-builders

I' using .NET 9 and client was generated using Kiota 1.22.3:

I get error: Cannot apply indexing with [] to an expression of type 'UsersRequestBuilder'

Expected behavior

I think that this should work as described in documentation.

How to reproduce

var tokenProvider = new IFSAccessTokenProvider();
var authProvider = new BaseBearerTokenAuthenticationProvider(tokenProvider);

var pnfr = new ParseNodeFactoryRegistry();
var json = new JsonParseNodeFactory();

pnfr.ContentTypeAssociatedFactories.TryAdd(json.ValidContentType, json);

var adapter = new HttpClientRequestAdapter(authProvider, pnfr);
var client = new UserHandlingClient(adapter);

var user = await client.Users["user1"].GetAsync();

Open API description file

No response

Kiota Version

1.22.3

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

No response

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ```
</details>


### Other information

_No response_
@TomaszGrzmilas TomaszGrzmilas added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jan 23, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jan 23, 2025
@msgraph-bot msgraph-bot bot added the Csharp Pull requests that update .net code label Jan 23, 2025
@baywet
Copy link
Member

baywet commented Jan 23, 2025

Hi @TomaszGrzmilas
Thank you for using kiota and for reaching out.

Can you please share the OpenAPI description you're using to generate the client?

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:question An issue that's a question and removed type:bug A broken experience status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Jan 23, 2025
@baywet baywet moved this from Needs Triage 🔍 to Waits for author 🔁 in Kiota Jan 23, 2025
@TomaszGrzmilas
Copy link
Author

Hi @TomaszGrzmilas Thank you for using kiota and for reaching out.

Can you please share the OpenAPI description you're using to generate the client?

Hi, sure:

UserHandling.json

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close Status: No Recent Activity labels Jan 31, 2025
@baywet
Copy link
Member

baywet commented Feb 10, 2025

Thank you for the additional information. And for your patience.

There's no path item equal to or starting with /users/{user-id} in this description (the variable name itself doesn't matter, what matters is that it's the only variable in the path segment, and there are no constants around it).

Why would you expect an indexer to be generated in those conditions?

I can also see this description contains path items with /Users(Identity='{Identity}') which should be available in the client with something like client.Users.ByIdentity()

Let us know if you have any additional comments or questions.

@baywet baywet added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed Needs: Attention 👋 labels Feb 10, 2025
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@github-project-automation github-project-automation bot moved this from Waits for author 🔁 to Done ✔️ in Kiota Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Csharp Pull requests that update .net code Status: No Recent Activity status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close type:question An issue that's a question
Projects
Status: Done ✔️
Development

No branches or pull requests

2 participants